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

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

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

Powered by Google App Engine
This is Rietveld 408576698