| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 5 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| (...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1097 // widgets gets aura activation changes. Only when desktop native widget is | 1097 // widgets gets aura activation changes. Only when desktop native widget is |
| 1098 // active, we can rely on aura activation to restore focused view. | 1098 // active, we can rely on aura activation to restore focused view. |
| 1099 if (GetWidget()->IsActive()) | 1099 if (GetWidget()->IsActive()) |
| 1100 GetWidget()->GetFocusManager()->RestoreFocusedView(); | 1100 GetWidget()->GetFocusManager()->RestoreFocusedView(); |
| 1101 } else if (lost_active == content_window_ && GetWidget()->HasFocusManager()) { | 1101 } else if (lost_active == content_window_ && GetWidget()->HasFocusManager()) { |
| 1102 DCHECK(!restore_focus_on_activate_); | 1102 DCHECK(!restore_focus_on_activate_); |
| 1103 restore_focus_on_activate_ = true; | 1103 restore_focus_on_activate_ = true; |
| 1104 // Pass in false so that ClearNativeFocus() isn't invoked. | 1104 // Pass in false so that ClearNativeFocus() isn't invoked. |
| 1105 GetWidget()->GetFocusManager()->StoreFocusedView(false); | 1105 GetWidget()->GetFocusManager()->StoreFocusedView(false); |
| 1106 } | 1106 } |
| 1107 |
| 1108 // Give the native widget a chance to handle any specific changes it needs. |
| 1109 desktop_window_tree_host_->OnNativeWidgetActivationChanged( |
| 1110 content_window_ == gained_active); |
| 1107 } | 1111 } |
| 1108 | 1112 |
| 1109 //////////////////////////////////////////////////////////////////////////////// | 1113 //////////////////////////////////////////////////////////////////////////////// |
| 1110 // DesktopNativeWidgetAura, aura::client::FocusChangeObserver implementation: | 1114 // DesktopNativeWidgetAura, aura::client::FocusChangeObserver implementation: |
| 1111 | 1115 |
| 1112 void DesktopNativeWidgetAura::OnWindowFocused(aura::Window* gained_focus, | 1116 void DesktopNativeWidgetAura::OnWindowFocused(aura::Window* gained_focus, |
| 1113 aura::Window* lost_focus) { | 1117 aura::Window* lost_focus) { |
| 1114 if (content_window_ == gained_focus) { | 1118 if (content_window_ == gained_focus) { |
| 1115 native_widget_delegate_->OnNativeFocus(); | 1119 native_widget_delegate_->OnNativeFocus(); |
| 1116 } else if (content_window_ == lost_focus) { | 1120 } else if (content_window_ == lost_focus) { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1204 if (cursor_reference_count_ == 0) { | 1208 if (cursor_reference_count_ == 0) { |
| 1205 // We are the last DesktopNativeWidgetAura instance, and we are responsible | 1209 // We are the last DesktopNativeWidgetAura instance, and we are responsible |
| 1206 // for cleaning up |cursor_manager_|. | 1210 // for cleaning up |cursor_manager_|. |
| 1207 delete cursor_manager_; | 1211 delete cursor_manager_; |
| 1208 native_cursor_manager_ = NULL; | 1212 native_cursor_manager_ = NULL; |
| 1209 cursor_manager_ = NULL; | 1213 cursor_manager_ = NULL; |
| 1210 } | 1214 } |
| 1211 } | 1215 } |
| 1212 | 1216 |
| 1213 } // namespace views | 1217 } // namespace views |
| OLD | NEW |