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

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

Issue 297503003: Revert: [Refactor] Consolidate the logic for whether a widget can be activated. This is a first ste (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months 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 | Annotate | Revision Log
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/debug/trace_event.h" 8 #include "base/debug/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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 new DesktopNativeWidgetTopLevelHandler; 88 new DesktopNativeWidgetTopLevelHandler;
89 89
90 child_window->SetBounds(gfx::Rect(bounds.size())); 90 child_window->SetBounds(gfx::Rect(bounds.size()));
91 91
92 Widget::InitParams init_params; 92 Widget::InitParams init_params;
93 init_params.type = full_screen ? Widget::InitParams::TYPE_WINDOW : 93 init_params.type = full_screen ? Widget::InitParams::TYPE_WINDOW :
94 Widget::InitParams::TYPE_POPUP; 94 Widget::InitParams::TYPE_POPUP;
95 init_params.bounds = bounds; 95 init_params.bounds = bounds;
96 init_params.ownership = Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET; 96 init_params.ownership = Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET;
97 init_params.layer_type = aura::WINDOW_LAYER_NOT_DRAWN; 97 init_params.layer_type = aura::WINDOW_LAYER_NOT_DRAWN;
98 init_params.activatable = full_screen ? 98 init_params.can_activate = full_screen;
99 Widget::InitParams::ACTIVATABLE_YES :
100 Widget::InitParams::ACTIVATABLE_NO;
101 init_params.keep_on_top = root_is_always_on_top; 99 init_params.keep_on_top = root_is_always_on_top;
102 100
103 // This widget instance will get deleted when the window is 101 // This widget instance will get deleted when the window is
104 // destroyed. 102 // destroyed.
105 top_level_handler->top_level_widget_ = new Widget(); 103 top_level_handler->top_level_widget_ = new Widget();
106 top_level_handler->top_level_widget_->Init(init_params); 104 top_level_handler->top_level_widget_->Init(init_params);
107 105
108 top_level_handler->top_level_widget_->SetFullscreen(full_screen); 106 top_level_handler->top_level_widget_->SetFullscreen(full_screen);
109 top_level_handler->top_level_widget_->Show(); 107 top_level_handler->top_level_widget_->Show();
110 108
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 int DesktopNativeWidgetAura::cursor_reference_count_ = 0; 244 int DesktopNativeWidgetAura::cursor_reference_count_ = 0;
247 DesktopNativeCursorManager* DesktopNativeWidgetAura::native_cursor_manager_ = 245 DesktopNativeCursorManager* DesktopNativeWidgetAura::native_cursor_manager_ =
248 NULL; 246 NULL;
249 wm::CursorManager* DesktopNativeWidgetAura::cursor_manager_ = NULL; 247 wm::CursorManager* DesktopNativeWidgetAura::cursor_manager_ = NULL;
250 248
251 DesktopNativeWidgetAura::DesktopNativeWidgetAura( 249 DesktopNativeWidgetAura::DesktopNativeWidgetAura(
252 internal::NativeWidgetDelegate* delegate) 250 internal::NativeWidgetDelegate* delegate)
253 : desktop_window_tree_host_(NULL), 251 : desktop_window_tree_host_(NULL),
254 ownership_(Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET), 252 ownership_(Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET),
255 close_widget_factory_(this), 253 close_widget_factory_(this),
254 can_activate_(true),
256 content_window_container_(NULL), 255 content_window_container_(NULL),
257 content_window_(new aura::Window(this)), 256 content_window_(new aura::Window(this)),
258 native_widget_delegate_(delegate), 257 native_widget_delegate_(delegate),
259 last_drop_operation_(ui::DragDropTypes::DRAG_NONE), 258 last_drop_operation_(ui::DragDropTypes::DRAG_NONE),
260 restore_focus_on_activate_(false), 259 restore_focus_on_activate_(false),
261 restore_focus_on_window_focus_(false), 260 restore_focus_on_window_focus_(false),
262 cursor_(gfx::kNullCursor), 261 cursor_(gfx::kNullCursor),
263 widget_type_(Widget::InitParams::TYPE_WINDOW) { 262 widget_type_(Widget::InitParams::TYPE_WINDOW) {
264 aura::client::SetFocusChangeObserver(content_window_, this); 263 aura::client::SetFocusChangeObserver(content_window_, this);
265 aura::client::SetActivationChangeObserver(content_window_, this); 264 aura::client::SetActivationChangeObserver(content_window_, this);
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
1045 } 1044 }
1046 1045
1047 void DesktopNativeWidgetAura::OnGestureEvent(ui::GestureEvent* event) { 1046 void DesktopNativeWidgetAura::OnGestureEvent(ui::GestureEvent* event) {
1048 native_widget_delegate_->OnGestureEvent(event); 1047 native_widget_delegate_->OnGestureEvent(event);
1049 } 1048 }
1050 1049
1051 //////////////////////////////////////////////////////////////////////////////// 1050 ////////////////////////////////////////////////////////////////////////////////
1052 // DesktopNativeWidgetAura, aura::client::ActivationDelegate implementation: 1051 // DesktopNativeWidgetAura, aura::client::ActivationDelegate implementation:
1053 1052
1054 bool DesktopNativeWidgetAura::ShouldActivate() const { 1053 bool DesktopNativeWidgetAura::ShouldActivate() const {
1055 return native_widget_delegate_->CanActivate(); 1054 return can_activate_ && native_widget_delegate_->CanActivate();
1056 } 1055 }
1057 1056
1058 //////////////////////////////////////////////////////////////////////////////// 1057 ////////////////////////////////////////////////////////////////////////////////
1059 // DesktopNativeWidgetAura, aura::client::ActivationChangeObserver 1058 // DesktopNativeWidgetAura, aura::client::ActivationChangeObserver
1060 // implementation: 1059 // implementation:
1061 1060
1062 void DesktopNativeWidgetAura::OnWindowActivated(aura::Window* gained_active, 1061 void DesktopNativeWidgetAura::OnWindowActivated(aura::Window* gained_active,
1063 aura::Window* lost_active) { 1062 aura::Window* lost_active) {
1064 DCHECK(content_window_ == gained_active || content_window_ == lost_active); 1063 DCHECK(content_window_ == gained_active || content_window_ == lost_active);
1065 if (gained_active == content_window_ && restore_focus_on_activate_) { 1064 if (gained_active == content_window_ && restore_focus_on_activate_) {
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1205 if (cursor_reference_count_ == 0) { 1204 if (cursor_reference_count_ == 0) {
1206 // We are the last DesktopNativeWidgetAura instance, and we are responsible 1205 // We are the last DesktopNativeWidgetAura instance, and we are responsible
1207 // for cleaning up |cursor_manager_|. 1206 // for cleaning up |cursor_manager_|.
1208 delete cursor_manager_; 1207 delete cursor_manager_;
1209 native_cursor_manager_ = NULL; 1208 native_cursor_manager_ = NULL;
1210 cursor_manager_ = NULL; 1209 cursor_manager_ = NULL;
1211 } 1210 }
1212 } 1211 }
1213 1212
1214 } // namespace views 1213 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_native_widget_aura.h ('k') | ui/views/widget/native_widget_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698