Code: void ShellSurface::OnSurfaceCommit() {
  surface_->CheckIfSurfaceHierarchyNeedsCommitToNewSurfaces();
  surface_->CommitSurfaceHierarchy();

  if (enabled() && !widget_)
    CreateShellSurfaceWidget(ui::SHOW_STATE_NORMAL);

  origin_ += pending_origin_offset_;
  pending_origin_offset_ = gfx::Vector2d();

  resize_component_ = pending_resize_component_;

  if (widget_) {
    geometry_ = pending_geometry_;

     UpdateWidgetBounds();
 
     gfx::Point surface_origin = GetSurfaceOrigin();
    gfx::Rect hit_test_bounds =
        surface_->GetHitTestBounds() + surface_origin.OffsetFromOrigin();
    bool activatable = activatable_ && !hit_test_bounds.IsEmpty();
    if (activatable != CanActivate()) {
      set_can_activate(activatable);
      aura::client::ActivationClient* activation_client =
          ash::Shell::GetInstance()->activation_client();
      if (activatable)
        activation_client->ActivateWindow(widget_->GetNativeWindow());
      else if (widget_->IsActive())
        activation_client->DeactivateWindow(widget_->GetNativeWindow());
     }
 
    surface_->window()->SetBounds(
        gfx::Rect(surface_origin, surface_->window()->layer()->size()));

    if (pending_scale_ != scale_) {
      gfx::Transform transform;
      DCHECK_NE(pending_scale_, 0.0);
      transform.Scale(1.0 / pending_scale_, 1.0 / pending_scale_);
      surface_->window()->SetTransform(transform);
      scale_ = pending_scale_;
    }

    if (pending_show_widget_) {
      DCHECK(!widget_->IsClosed());
      DCHECK(!widget_->IsVisible());
      pending_show_widget_ = false;
      widget_->Show();
    }
  }
}

Vulnerability Type: DoS 
CWE ID: CWE-416
Summary: Use-after-free vulnerability in the Web Workers implementation in Google Chrome before 38.0.2125.101 allows remote attackers to cause a denial of service or possibly have unspecified other impact via unknown vectors.
Commit Message: exo: Reduce side-effects of dynamic activation code.

This code exists for clients that need to managed their own system
modal dialogs. Since the addition of the remote surface API we
can limit the impact of this to surfaces created for system modal
container.

BUG=29528396

Review-Url: https://codereview.chromium.org/2084023003
Cr-Commit-Position: refs/heads/master@{#401115}