Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: ui/views/widget/desktop_aura/desktop_native_widget_aura.cc

Issue 2517663002: Fix unable to delete extensions continuously through keyboard (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_native_widget_aura.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 wm::CursorManager* DesktopNativeWidgetAura::cursor_manager_ = NULL; 237 wm::CursorManager* DesktopNativeWidgetAura::cursor_manager_ = NULL;
238 238
239 DesktopNativeWidgetAura::DesktopNativeWidgetAura( 239 DesktopNativeWidgetAura::DesktopNativeWidgetAura(
240 internal::NativeWidgetDelegate* delegate) 240 internal::NativeWidgetDelegate* delegate)
241 : desktop_window_tree_host_(NULL), 241 : desktop_window_tree_host_(NULL),
242 ownership_(Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET), 242 ownership_(Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET),
243 content_window_container_(NULL), 243 content_window_container_(NULL),
244 content_window_(new aura::Window(this)), 244 content_window_(new aura::Window(this)),
245 native_widget_delegate_(delegate), 245 native_widget_delegate_(delegate),
246 last_drop_operation_(ui::DragDropTypes::DRAG_NONE), 246 last_drop_operation_(ui::DragDropTypes::DRAG_NONE),
247 restore_focus_on_activate_(false),
247 cursor_(gfx::kNullCursor), 248 cursor_(gfx::kNullCursor),
248 widget_type_(Widget::InitParams::TYPE_WINDOW), 249 widget_type_(Widget::InitParams::TYPE_WINDOW),
249 close_widget_factory_(this) { 250 close_widget_factory_(this) {
250 aura::client::SetFocusChangeObserver(content_window_, this); 251 aura::client::SetFocusChangeObserver(content_window_, this);
251 aura::client::SetActivationChangeObserver(content_window_, this); 252 aura::client::SetActivationChangeObserver(content_window_, this);
252 } 253 }
253 254
254 DesktopNativeWidgetAura::~DesktopNativeWidgetAura() { 255 DesktopNativeWidgetAura::~DesktopNativeWidgetAura() {
255 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET) 256 if (ownership_ == Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET)
256 delete native_widget_delegate_; 257 delete native_widget_delegate_;
(...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after
1084 1085
1085 //////////////////////////////////////////////////////////////////////////////// 1086 ////////////////////////////////////////////////////////////////////////////////
1086 // DesktopNativeWidgetAura, aura::client::ActivationChangeObserver 1087 // DesktopNativeWidgetAura, aura::client::ActivationChangeObserver
1087 // implementation: 1088 // implementation:
1088 1089
1089 void DesktopNativeWidgetAura::OnWindowActivated( 1090 void DesktopNativeWidgetAura::OnWindowActivated(
1090 aura::client::ActivationChangeObserver::ActivationReason reason, 1091 aura::client::ActivationChangeObserver::ActivationReason reason,
1091 aura::Window* gained_active, 1092 aura::Window* gained_active,
1092 aura::Window* lost_active) { 1093 aura::Window* lost_active) {
1093 DCHECK(content_window_ == gained_active || content_window_ == lost_active); 1094 DCHECK(content_window_ == gained_active || content_window_ == lost_active);
1094 if (lost_active == content_window_ && GetWidget()->HasFocusManager()) { 1095 if (gained_active == content_window_ && restore_focus_on_activate_) {
1096 restore_focus_on_activate_ = false;
1097 // For OS_LINUX, desktop native widget may not be activated when child
1098 // widgets gets aura activation changes. Only when desktop native widget is
1099 // active, we can rely on aura activation to restore focused view.
1100 if (GetWidget()->IsActive())
1101 GetWidget()->GetFocusManager()->RestoreFocusedView();
sky 2016/11/19 15:33:23 For the non-linux case don't we end up in HandleAc
Qiang(Joe) Xu 2016/11/19 23:48:56 Good catch. I think make restore_focus_on_activate
1102 } else if (lost_active == content_window_ && GetWidget()->HasFocusManager()) {
1103 DCHECK(!restore_focus_on_activate_);
1104 restore_focus_on_activate_ = true;
1095 // Pass in false so that ClearNativeFocus() isn't invoked. 1105 // Pass in false so that ClearNativeFocus() isn't invoked.
1096 GetWidget()->GetFocusManager()->StoreFocusedView(false); 1106 GetWidget()->GetFocusManager()->StoreFocusedView(false);
1097 } 1107 }
1098 } 1108 }
1099 1109
1100 //////////////////////////////////////////////////////////////////////////////// 1110 ////////////////////////////////////////////////////////////////////////////////
1101 // DesktopNativeWidgetAura, aura::client::FocusChangeObserver implementation: 1111 // DesktopNativeWidgetAura, aura::client::FocusChangeObserver implementation:
1102 1112
1103 void DesktopNativeWidgetAura::OnWindowFocused(aura::Window* gained_focus, 1113 void DesktopNativeWidgetAura::OnWindowFocused(aura::Window* gained_focus,
1104 aura::Window* lost_focus) { 1114 aura::Window* lost_focus) {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 if (cursor_reference_count_ == 0) { 1201 if (cursor_reference_count_ == 0) {
1192 // We are the last DesktopNativeWidgetAura instance, and we are responsible 1202 // We are the last DesktopNativeWidgetAura instance, and we are responsible
1193 // for cleaning up |cursor_manager_|. 1203 // for cleaning up |cursor_manager_|.
1194 delete cursor_manager_; 1204 delete cursor_manager_;
1195 native_cursor_manager_ = NULL; 1205 native_cursor_manager_ = NULL;
1196 cursor_manager_ = NULL; 1206 cursor_manager_ = NULL;
1197 } 1207 }
1198 } 1208 }
1199 1209
1200 } // namespace views 1210 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_native_widget_aura.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698