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

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

Issue 12342028: make menus, bubbles, etc. top level windows on aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 9 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_root_window_host_win.h" 5 #include "ui/views/widget/desktop_aura/desktop_root_window_host_win.h"
6 6
7 #include "third_party/skia/include/core/SkPath.h" 7 #include "third_party/skia/include/core/SkPath.h"
8 #include "third_party/skia/include/core/SkRegion.h" 8 #include "third_party/skia/include/core/SkRegion.h"
9 #include "ui/aura/client/aura_constants.h" 9 #include "ui/aura/client/aura_constants.h"
10 #include "ui/aura/client/default_capture_client.h" 10 #include "ui/aura/client/default_capture_client.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 48
49 DesktopRootWindowHostWin::DesktopRootWindowHostWin( 49 DesktopRootWindowHostWin::DesktopRootWindowHostWin(
50 internal::NativeWidgetDelegate* native_widget_delegate, 50 internal::NativeWidgetDelegate* native_widget_delegate,
51 DesktopNativeWidgetAura* desktop_native_widget_aura, 51 DesktopNativeWidgetAura* desktop_native_widget_aura,
52 const gfx::Rect& initial_bounds) 52 const gfx::Rect& initial_bounds)
53 : ALLOW_THIS_IN_INITIALIZER_LIST( 53 : ALLOW_THIS_IN_INITIALIZER_LIST(
54 message_handler_(new HWNDMessageHandler(this))), 54 message_handler_(new HWNDMessageHandler(this))),
55 native_widget_delegate_(native_widget_delegate), 55 native_widget_delegate_(native_widget_delegate),
56 desktop_native_widget_aura_(desktop_native_widget_aura), 56 desktop_native_widget_aura_(desktop_native_widget_aura),
57 root_window_host_delegate_(NULL), 57 root_window_host_delegate_(NULL),
58 content_window_(NULL) { 58 content_window_(NULL),
59 window_expansion_(0, 0, 0, 0) {
sky 2013/03/14 20:06:37 nit: this is the default.
scottmg 2013/03/14 22:51:53 Done.
59 } 60 }
60 61
61 DesktopRootWindowHostWin::~DesktopRootWindowHostWin() { 62 DesktopRootWindowHostWin::~DesktopRootWindowHostWin() {
62 if (corewm::UseFocusControllerOnDesktop()) { 63 if (corewm::UseFocusControllerOnDesktop()) {
63 aura::client::SetFocusClient(root_window_, NULL); 64 aura::client::SetFocusClient(root_window_, NULL);
64 aura::client::SetActivationClient(root_window_, NULL); 65 aura::client::SetActivationClient(root_window_, NULL);
65 } 66 }
66 } 67 }
67 68
68 // static 69 // static
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 drag_drop_client_.reset(new DesktopDragDropClientWin(root_window_, 161 drag_drop_client_.reset(new DesktopDragDropClientWin(root_window_,
161 GetHWND())); 162 GetHWND()));
162 aura::client::SetDragDropClient(root_window_, drag_drop_client_.get()); 163 aura::client::SetDragDropClient(root_window_, drag_drop_client_.get());
163 164
164 focus_client_->FocusWindow(content_window_); 165 focus_client_->FocusWindow(content_window_);
165 root_window_->SetProperty(kContentWindowForRootWindow, content_window_); 166 root_window_->SetProperty(kContentWindowForRootWindow, content_window_);
166 167
167 return root_window_; 168 return root_window_;
168 } 169 }
169 170
171 void DesktopRootWindowHostWin::InitFocus(aura::Window* window) {
172 focus_client_->FocusWindow(window);
173 }
174
170 void DesktopRootWindowHostWin::Close() { 175 void DesktopRootWindowHostWin::Close() {
171 message_handler_->Close(); 176 message_handler_->Close();
172 } 177 }
173 178
174 void DesktopRootWindowHostWin::CloseNow() { 179 void DesktopRootWindowHostWin::CloseNow() {
175 message_handler_->CloseNow(); 180 message_handler_->CloseNow();
176 } 181 }
177 182
178 aura::RootWindowHost* DesktopRootWindowHostWin::AsRootWindowHost() { 183 aura::RootWindowHost* DesktopRootWindowHostWin::AsRootWindowHost() {
179 return this; 184 return this;
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 372
368 void DesktopRootWindowHostWin::Hide() { 373 void DesktopRootWindowHostWin::Hide() {
369 message_handler_->Hide(); 374 message_handler_->Hide();
370 } 375 }
371 376
372 void DesktopRootWindowHostWin::ToggleFullScreen() { 377 void DesktopRootWindowHostWin::ToggleFullScreen() {
373 } 378 }
374 379
375 gfx::Rect DesktopRootWindowHostWin::GetBounds() const { 380 gfx::Rect DesktopRootWindowHostWin::GetBounds() const {
376 // Match the logic in HWNDMessageHandler::ClientAreaSizeChanged(). 381 // Match the logic in HWNDMessageHandler::ClientAreaSizeChanged().
377 return WidgetSizeIsClientSize() ? 382 return WidgetSizeIsClientSize() ?
sky 2013/03/14 20:06:37 What about this? Doesn't it need to change too?
scottmg 2013/03/14 22:51:53 Done. (I'm a bit unclear on why it didn't matter -
378 GetClientAreaBoundsInScreen() : GetWindowBoundsInScreen(); 383 GetClientAreaBoundsInScreen() : GetWindowBoundsInScreen();
379 } 384 }
380 385
381 void DesktopRootWindowHostWin::SetBounds(const gfx::Rect& bounds) { 386 void DesktopRootWindowHostWin::SetBounds(const gfx::Rect& bounds) {
382 message_handler_->SetBounds(bounds); 387 gfx::Rect expanded(bounds.x() + window_expansion_.x(),
388 bounds.y() + window_expansion_.y(),
389 bounds.width() + window_expansion_.width(),
390 bounds.height() + window_expansion_.height());
391 message_handler_->SetBounds(expanded);
383 } 392 }
384 393
385 gfx::Insets DesktopRootWindowHostWin::GetInsets() const { 394 gfx::Insets DesktopRootWindowHostWin::GetInsets() const {
386 return gfx::Insets(); 395 return gfx::Insets();
387 } 396 }
388 397
389 void DesktopRootWindowHostWin::SetInsets(const gfx::Insets& insets) { 398 void DesktopRootWindowHostWin::SetInsets(const gfx::Insets& insets) {
390 } 399 }
391 400
392 gfx::Point DesktopRootWindowHostWin::GetLocationOnNativeScreen() const { 401 gfx::Point DesktopRootWindowHostWin::GetLocationOnNativeScreen() const {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 const base::NativeEvent& native_event) { 456 const base::NativeEvent& native_event) {
448 } 457 }
449 458
450 void DesktopRootWindowHostWin::OnDeviceScaleFactorChanged( 459 void DesktopRootWindowHostWin::OnDeviceScaleFactorChanged(
451 float device_scale_factor) { 460 float device_scale_factor) {
452 } 461 }
453 462
454 void DesktopRootWindowHostWin::PrepareForShutdown() { 463 void DesktopRootWindowHostWin::PrepareForShutdown() {
455 } 464 }
456 465
466 void DesktopRootWindowHostWin::SetHostWindowExpansion(const gfx::Rect& extra) {
467 window_expansion_ = extra;
468 SetBounds(GetBounds());
469 }
470
471
sky 2013/03/14 20:06:37 nit: remove one of these newlines.
scottmg 2013/03/14 22:51:53 Done.
457 //////////////////////////////////////////////////////////////////////////////// 472 ////////////////////////////////////////////////////////////////////////////////
458 // DesktopRootWindowHostWin, HWNDMessageHandlerDelegate implementation: 473 // DesktopRootWindowHostWin, HWNDMessageHandlerDelegate implementation:
459 474
460 bool DesktopRootWindowHostWin::IsWidgetWindow() const { 475 bool DesktopRootWindowHostWin::IsWidgetWindow() const {
461 return true; 476 return true;
462 } 477 }
463 478
464 bool DesktopRootWindowHostWin::IsUsingCustomFrame() const { 479 bool DesktopRootWindowHostWin::IsUsingCustomFrame() const {
465 return !GetWidget()->ShouldUseNativeFrame(); 480 return !GetWidget()->ShouldUseNativeFrame();
466 } 481 }
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 void DesktopRootWindowHostWin::HandleWorkAreaChanged() { 660 void DesktopRootWindowHostWin::HandleWorkAreaChanged() {
646 GetWidget()->widget_delegate()->OnWorkAreaChanged(); 661 GetWidget()->widget_delegate()->OnWorkAreaChanged();
647 } 662 }
648 663
649 void DesktopRootWindowHostWin::HandleVisibilityChanged(bool visible) { 664 void DesktopRootWindowHostWin::HandleVisibilityChanged(bool visible) {
650 native_widget_delegate_->OnNativeWidgetVisibilityChanged(visible); 665 native_widget_delegate_->OnNativeWidgetVisibilityChanged(visible);
651 } 666 }
652 667
653 void DesktopRootWindowHostWin::HandleClientSizeChanged( 668 void DesktopRootWindowHostWin::HandleClientSizeChanged(
654 const gfx::Size& new_size) { 669 const gfx::Size& new_size) {
670 gfx::Size without_expansion(new_size.width() - window_expansion_.width(),
671 new_size.height() - window_expansion_.height());
655 if (root_window_host_delegate_) 672 if (root_window_host_delegate_)
656 root_window_host_delegate_->OnHostResized(new_size); 673 root_window_host_delegate_->OnHostResized(new_size);
657 // TODO(beng): replace with a layout manager?? 674 // TODO(beng): replace with a layout manager??
658 content_window_->SetBounds(gfx::Rect(new_size)); 675 content_window_->SetBounds(gfx::Rect(without_expansion));
659 } 676 }
660 677
661 void DesktopRootWindowHostWin::HandleFrameChanged() { 678 void DesktopRootWindowHostWin::HandleFrameChanged() {
662 // Replace the frame and layout the contents. 679 // Replace the frame and layout the contents.
663 GetWidget()->non_client_view()->UpdateFrame(true); 680 GetWidget()->non_client_view()->UpdateFrame(true);
664 } 681 }
665 682
666 void DesktopRootWindowHostWin::HandleNativeFocus(HWND last_focused_window) { 683 void DesktopRootWindowHostWin::HandleNativeFocus(HWND last_focused_window) {
667 // TODO(beng): inform the native_widget_delegate_. 684 // TODO(beng): inform the native_widget_delegate_.
668 InputMethod* input_method = GetInputMethod(); 685 InputMethod* input_method = GetInputMethod();
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 DesktopRootWindowHost* DesktopRootWindowHost::Create( 797 DesktopRootWindowHost* DesktopRootWindowHost::Create(
781 internal::NativeWidgetDelegate* native_widget_delegate, 798 internal::NativeWidgetDelegate* native_widget_delegate,
782 DesktopNativeWidgetAura* desktop_native_widget_aura, 799 DesktopNativeWidgetAura* desktop_native_widget_aura,
783 const gfx::Rect& initial_bounds) { 800 const gfx::Rect& initial_bounds) {
784 return new DesktopRootWindowHostWin(native_widget_delegate, 801 return new DesktopRootWindowHostWin(native_widget_delegate,
785 desktop_native_widget_aura, 802 desktop_native_widget_aura,
786 initial_bounds); 803 initial_bounds);
787 } 804 }
788 805
789 } // namespace views 806 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698