| 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/trace_event/trace_event.h" | 8 #include "base/trace_event/trace_event.h" |
| 9 #include "ui/aura/client/aura_constants.h" | 9 #include "ui/aura/client/aura_constants.h" |
| 10 #include "ui/aura/client/cursor_client.h" | 10 #include "ui/aura/client/cursor_client.h" |
| (...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1104 // DesktopNativeWidgetAura, aura::client::ActivationDelegate implementation: | 1104 // DesktopNativeWidgetAura, aura::client::ActivationDelegate implementation: |
| 1105 | 1105 |
| 1106 bool DesktopNativeWidgetAura::ShouldActivate() const { | 1106 bool DesktopNativeWidgetAura::ShouldActivate() const { |
| 1107 return native_widget_delegate_->CanActivate(); | 1107 return native_widget_delegate_->CanActivate(); |
| 1108 } | 1108 } |
| 1109 | 1109 |
| 1110 //////////////////////////////////////////////////////////////////////////////// | 1110 //////////////////////////////////////////////////////////////////////////////// |
| 1111 // DesktopNativeWidgetAura, aura::client::ActivationChangeObserver | 1111 // DesktopNativeWidgetAura, aura::client::ActivationChangeObserver |
| 1112 // implementation: | 1112 // implementation: |
| 1113 | 1113 |
| 1114 void DesktopNativeWidgetAura::OnWindowActivated(aura::Window* gained_active, | 1114 void DesktopNativeWidgetAura::OnWindowActivated( |
| 1115 aura::Window* lost_active) { | 1115 aura::client::ActivationChangeObserver::ActivationReason reason, |
| 1116 aura::Window* gained_active, |
| 1117 aura::Window* lost_active) { |
| 1116 DCHECK(content_window_ == gained_active || content_window_ == lost_active); | 1118 DCHECK(content_window_ == gained_active || content_window_ == lost_active); |
| 1117 if (gained_active == content_window_ && restore_focus_on_activate_) { | 1119 if (gained_active == content_window_ && restore_focus_on_activate_) { |
| 1118 restore_focus_on_activate_ = false; | 1120 restore_focus_on_activate_ = false; |
| 1119 GetWidget()->GetFocusManager()->RestoreFocusedView(); | 1121 GetWidget()->GetFocusManager()->RestoreFocusedView(); |
| 1120 } else if (lost_active == content_window_ && GetWidget()->HasFocusManager()) { | 1122 } else if (lost_active == content_window_ && GetWidget()->HasFocusManager()) { |
| 1121 DCHECK(!restore_focus_on_activate_); | 1123 DCHECK(!restore_focus_on_activate_); |
| 1122 restore_focus_on_activate_ = true; | 1124 restore_focus_on_activate_ = true; |
| 1123 // Pass in false so that ClearNativeFocus() isn't invoked. | 1125 // Pass in false so that ClearNativeFocus() isn't invoked. |
| 1124 GetWidget()->GetFocusManager()->StoreFocusedView(false); | 1126 GetWidget()->GetFocusManager()->StoreFocusedView(false); |
| 1125 } | 1127 } |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1245 if (cursor_reference_count_ == 0) { | 1247 if (cursor_reference_count_ == 0) { |
| 1246 // We are the last DesktopNativeWidgetAura instance, and we are responsible | 1248 // We are the last DesktopNativeWidgetAura instance, and we are responsible |
| 1247 // for cleaning up |cursor_manager_|. | 1249 // for cleaning up |cursor_manager_|. |
| 1248 delete cursor_manager_; | 1250 delete cursor_manager_; |
| 1249 native_cursor_manager_ = NULL; | 1251 native_cursor_manager_ = NULL; |
| 1250 cursor_manager_ = NULL; | 1252 cursor_manager_ = NULL; |
| 1251 } | 1253 } |
| 1252 } | 1254 } |
| 1253 | 1255 |
| 1254 } // namespace views | 1256 } // namespace views |
| OLD | NEW |