Chromium Code Reviews| Index: ui/views/widget/desktop_aura/desktop_native_widget_aura.cc |
| =================================================================== |
| --- ui/views/widget/desktop_aura/desktop_native_widget_aura.cc (revision 220608) |
| +++ ui/views/widget/desktop_aura/desktop_native_widget_aura.cc (working copy) |
| @@ -229,6 +229,35 @@ |
| capture_client_.reset(new corewm::ScopedCaptureClient(root)); |
| } |
| +void DesktopNativeWidgetAura::HandleActivationChanged(bool active) { |
| + native_widget_delegate_->OnNativeWidgetActivationChanged(active); |
| + aura::client::ActivationClient* activation_client = |
| + aura::client::GetActivationClient(root_window_.get()); |
| + if (!activation_client) |
| + return; |
| + if (active) { |
| + if (GetWidget()->HasFocusManager()) { |
| + // This function can be called before the focus manager has had a |
| + // chance to set the focused view. In which case we should get the |
| + // last focused view. |
| + View* focus_view = GetWidget()->GetFocusManager()->GetFocusedView(); |
| + if (!focus_view) |
| + focus_view = GetWidget()->GetFocusManager()->GetStoredFocusView(); |
| + if (focus_view) |
| + activation_client->ActivateWindow( |
| + focus_view->GetWidget()->GetNativeView()); |
|
sky
2013/09/03 18:21:51
Shouldn't we activate something if we can't find a
ananta
2013/09/03 19:03:31
Added code to activate the root view, if we don't
|
| + } |
| + } else { |
| + // If we're not active we need to deactivate the corresponding |
| + // aura::Window. This way if a child widget is active it gets correctly |
| + // deactivated (child widgets don't get native desktop activation changes, |
| + // only aura activation changes). |
| + aura::Window* active_window = activation_client->GetActiveWindow(); |
| + if (active_window) |
| + activation_client->DeactivateWindow(active_window); |
| + } |
| +} |
| + |
| //////////////////////////////////////////////////////////////////////////////// |
| // DesktopNativeWidgetAura, internal::NativeWidgetPrivate implementation: |