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

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

Issue 23903056: Add a container window to host the desktop window hierarchy in AURA. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 3 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 "ui/aura/client/activation_client.h" 8 #include "ui/aura/client/activation_client.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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 //////////////////////////////////////////////////////////////////////////////// 170 ////////////////////////////////////////////////////////////////////////////////
171 // DesktopNativeWidgetAura, public: 171 // DesktopNativeWidgetAura, public:
172 172
173 DesktopNativeWidgetAura::DesktopNativeWidgetAura( 173 DesktopNativeWidgetAura::DesktopNativeWidgetAura(
174 internal::NativeWidgetDelegate* delegate) 174 internal::NativeWidgetDelegate* delegate)
175 : ownership_(Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET), 175 : ownership_(Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET),
176 close_widget_factory_(this), 176 close_widget_factory_(this),
177 can_activate_(true), 177 can_activate_(true),
178 desktop_root_window_host_(NULL), 178 desktop_root_window_host_(NULL),
179 window_(new aura::Window(this)), 179 window_(new aura::Window(this)),
180 content_window_container_(NULL),
180 native_widget_delegate_(delegate), 181 native_widget_delegate_(delegate),
181 last_drop_operation_(ui::DragDropTypes::DRAG_NONE), 182 last_drop_operation_(ui::DragDropTypes::DRAG_NONE),
182 restore_focus_on_activate_(false), 183 restore_focus_on_activate_(false),
183 cursor_(gfx::kNullCursor) { 184 cursor_(gfx::kNullCursor) {
184 window_->SetProperty(kDesktopNativeWidgetAuraKey, this); 185 window_->SetProperty(kDesktopNativeWidgetAuraKey, this);
185 aura::client::SetFocusChangeObserver(window_, this); 186 aura::client::SetFocusChangeObserver(window_, this);
186 aura::client::SetActivationChangeObserver(window_, this); 187 aura::client::SetActivationChangeObserver(window_, this);
187 } 188 }
188 189
189 DesktopNativeWidgetAura::~DesktopNativeWidgetAura() { 190 DesktopNativeWidgetAura::~DesktopNativeWidgetAura() {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 #if defined(OS_LINUX) // TODO(scottmg): http://crbug.com/180071 289 #if defined(OS_LINUX) // TODO(scottmg): http://crbug.com/180071
289 window_->Show(); 290 window_->Show();
290 #endif 291 #endif
291 292
292 desktop_root_window_host_ = params.desktop_root_window_host ? 293 desktop_root_window_host_ = params.desktop_root_window_host ?
293 params.desktop_root_window_host : 294 params.desktop_root_window_host :
294 DesktopRootWindowHost::Create(native_widget_delegate_, 295 DesktopRootWindowHost::Create(native_widget_delegate_,
295 this, params.bounds); 296 this, params.bounds);
296 root_window_.reset( 297 root_window_.reset(
297 desktop_root_window_host_->Init(window_, params)); 298 desktop_root_window_host_->Init(window_, params));
299
300 content_window_container_ = new aura::Window(NULL);
301 content_window_container_->Init(ui::LAYER_NOT_DRAWN);
302 content_window_container_->Show();
303 content_window_container_->AddChild(window_);
304 content_window_container_->SetBounds(root_window_->bounds());
305 root_window_->AddChild(content_window_container_);
306
298 root_window_->AddRootWindowObserver(this); 307 root_window_->AddRootWindowObserver(this);
299 308
300 stacking_client_.reset( 309 stacking_client_.reset(
301 new DesktopNativeWidgetAuraStackingClient(root_window_.get())); 310 new DesktopNativeWidgetAuraStackingClient(root_window_.get()));
302 drop_helper_.reset(new DropHelper( 311 drop_helper_.reset(new DropHelper(
303 static_cast<internal::RootView*>(GetWidget()->GetRootView()))); 312 static_cast<internal::RootView*>(GetWidget()->GetRootView())));
304 aura::client::SetDragDropDelegate(window_, this); 313 aura::client::SetDragDropDelegate(window_, this);
305 314
306 tooltip_manager_.reset(new views::TooltipManagerAura(window_, GetWidget())); 315 tooltip_manager_.reset(new views::TooltipManagerAura(window_, GetWidget()));
307 316
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 float scale = 1; 497 float scale = 1;
489 aura::RootWindow* root = root_window_.get(); 498 aura::RootWindow* root = root_window_.get();
490 if (root) { 499 if (root) {
491 scale = gfx::Screen::GetScreenFor(root)-> 500 scale = gfx::Screen::GetScreenFor(root)->
492 GetDisplayNearestWindow(root).device_scale_factor(); 501 GetDisplayNearestWindow(root).device_scale_factor();
493 } 502 }
494 gfx::Rect bounds_in_pixels( 503 gfx::Rect bounds_in_pixels(
495 gfx::ToCeiledPoint(gfx::ScalePoint(bounds.origin(), scale)), 504 gfx::ToCeiledPoint(gfx::ScalePoint(bounds.origin(), scale)),
496 gfx::ToFlooredSize(gfx::ScaleSize(bounds.size(), scale))); 505 gfx::ToFlooredSize(gfx::ScaleSize(bounds.size(), scale)));
497 desktop_root_window_host_->AsRootWindowHost()->SetBounds(bounds_in_pixels); 506 desktop_root_window_host_->AsRootWindowHost()->SetBounds(bounds_in_pixels);
507 content_window_container_->SetBounds(
508 content_window_container_->GetRootWindow()->bounds());
498 } 509 }
499 510
500 void DesktopNativeWidgetAura::SetSize(const gfx::Size& size) { 511 void DesktopNativeWidgetAura::SetSize(const gfx::Size& size) {
501 if (window_) 512 if (window_)
502 desktop_root_window_host_->SetSize(size); 513 desktop_root_window_host_->SetSize(size);
503 } 514 }
504 515
505 void DesktopNativeWidgetAura::StackAbove(gfx::NativeView native_view) { 516 void DesktopNativeWidgetAura::StackAbove(gfx::NativeView native_view) {
506 } 517 }
507 518
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 } 961 }
951 962
952 //////////////////////////////////////////////////////////////////////////////// 963 ////////////////////////////////////////////////////////////////////////////////
953 // DesktopNativeWidgetAura, NativeWidget implementation: 964 // DesktopNativeWidgetAura, NativeWidget implementation:
954 965
955 ui::EventHandler* DesktopNativeWidgetAura::GetEventHandler() { 966 ui::EventHandler* DesktopNativeWidgetAura::GetEventHandler() {
956 return this; 967 return this;
957 } 968 }
958 969
959 } // namespace views 970 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698