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

Side by Side Diff: ui/views/widget/native_widget_aura.cc

Issue 11030017: Add context to gfx::Screen calls in support of simultaneous desktop+ash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tidy Created 8 years, 2 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/native_widget_aura.h" 5 #include "ui/views/widget/native_widget_aura.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "third_party/skia/include/core/SkRegion.h" 9 #include "third_party/skia/include/core/SkRegion.h"
10 #include "ui/aura/client/activation_change_observer.h" 10 #include "ui/aura/client/activation_change_observer.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 } 121 }
122 122
123 NativeWidgetAura* host_; 123 NativeWidgetAura* host_;
124 124
125 DISALLOW_COPY_AND_ASSIGN(ActiveWindowObserver); 125 DISALLOW_COPY_AND_ASSIGN(ActiveWindowObserver);
126 }; 126 };
127 127
128 //////////////////////////////////////////////////////////////////////////////// 128 ////////////////////////////////////////////////////////////////////////////////
129 // NativeWidgetAura, public: 129 // NativeWidgetAura, public:
130 130
131 NativeWidgetAura::NativeWidgetAura(internal::NativeWidgetDelegate* delegate) 131 NativeWidgetAura::NativeWidgetAura(
132 internal::NativeWidgetDelegate* delegate, gfx::NativeView parent)
132 : delegate_(delegate), 133 : delegate_(delegate),
133 ALLOW_THIS_IN_INITIALIZER_LIST(desktop_helper_( 134 ALLOW_THIS_IN_INITIALIZER_LIST(desktop_helper_(
134 ViewsDelegate::views_delegate ? 135 ViewsDelegate::views_delegate ?
135 ViewsDelegate::views_delegate->CreateNativeWidgetHelper(this) : 136 ViewsDelegate::views_delegate->CreateNativeWidgetHelper(this, parent):
136 NULL)), 137 NULL)),
137 ALLOW_THIS_IN_INITIALIZER_LIST(window_(new aura::Window(this))), 138 ALLOW_THIS_IN_INITIALIZER_LIST(window_(new aura::Window(this))),
138 ownership_(Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET), 139 ownership_(Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET),
139 ALLOW_THIS_IN_INITIALIZER_LIST(close_widget_factory_(this)), 140 ALLOW_THIS_IN_INITIALIZER_LIST(close_widget_factory_(this)),
140 can_activate_(true), 141 can_activate_(true),
141 destroying_(false), 142 destroying_(false),
142 cursor_(gfx::kNullCursor), 143 cursor_(gfx::kNullCursor),
143 saved_window_state_(ui::SHOW_STATE_DEFAULT) { 144 saved_window_state_(ui::SHOW_STATE_DEFAULT) {
144 } 145 }
145 146
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 } 455 }
455 return window_->GetBoundsInScreen(); 456 return window_->GetBoundsInScreen();
456 } 457 }
457 458
458 void NativeWidgetAura::SetBounds(const gfx::Rect& bounds) { 459 void NativeWidgetAura::SetBounds(const gfx::Rect& bounds) {
459 aura::RootWindow* root = window_->GetRootWindow(); 460 aura::RootWindow* root = window_->GetRootWindow();
460 if (root) { 461 if (root) {
461 aura::client::ScreenPositionClient* screen_position_client = 462 aura::client::ScreenPositionClient* screen_position_client =
462 aura::client::GetScreenPositionClient(root); 463 aura::client::GetScreenPositionClient(root);
463 if (screen_position_client) { 464 if (screen_position_client) {
464 gfx::Display dst_display = gfx::Screen::GetDisplayMatching(bounds); 465 gfx::Display dst_display = gfx::Screen::GetDisplayMatching(
466 window_, bounds);
465 screen_position_client->SetBounds(window_, bounds, dst_display); 467 screen_position_client->SetBounds(window_, bounds, dst_display);
466 return; 468 return;
467 } 469 }
468 } 470 }
469 window_->SetBounds(bounds); 471 window_->SetBounds(bounds);
470 } 472 }
471 473
472 void NativeWidgetAura::SetSize(const gfx::Size& size) { 474 void NativeWidgetAura::SetSize(const gfx::Size& size) {
473 window_->SetBounds(gfx::Rect(window_->bounds().origin(), size)); 475 window_->SetBounds(gfx::Rect(window_->bounds().origin(), size));
474 } 476 }
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 return false; 977 return false;
976 } 978 }
977 979
978 namespace internal { 980 namespace internal {
979 981
980 //////////////////////////////////////////////////////////////////////////////// 982 ////////////////////////////////////////////////////////////////////////////////
981 // internal::NativeWidgetPrivate, public: 983 // internal::NativeWidgetPrivate, public:
982 984
983 // static 985 // static
984 NativeWidgetPrivate* NativeWidgetPrivate::CreateNativeWidget( 986 NativeWidgetPrivate* NativeWidgetPrivate::CreateNativeWidget(
985 internal::NativeWidgetDelegate* delegate) { 987 internal::NativeWidgetDelegate* delegate,
986 return new NativeWidgetAura(delegate); 988 gfx::NativeView parent) {
989 return new NativeWidgetAura(delegate, parent);
987 } 990 }
988 991
989 // static 992 // static
990 NativeWidgetPrivate* NativeWidgetPrivate::GetNativeWidgetForNativeView( 993 NativeWidgetPrivate* NativeWidgetPrivate::GetNativeWidgetForNativeView(
991 gfx::NativeView native_view) { 994 gfx::NativeView native_view) {
992 return reinterpret_cast<NativeWidgetAura*>(native_view->user_data()); 995 return reinterpret_cast<NativeWidgetAura*>(native_view->user_data());
993 } 996 }
994 997
995 // static 998 // static
996 NativeWidgetPrivate* NativeWidgetPrivate::GetNativeWidgetForNativeWindow( 999 NativeWidgetPrivate* NativeWidgetPrivate::GetNativeWidgetForNativeWindow(
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 return aura::Env::GetInstance()->is_mouse_button_down(); 1074 return aura::Env::GetInstance()->is_mouse_button_down();
1072 } 1075 }
1073 1076
1074 // static 1077 // static
1075 bool NativeWidgetPrivate::IsTouchDown() { 1078 bool NativeWidgetPrivate::IsTouchDown() {
1076 return aura::Env::GetInstance()->is_touch_down(); 1079 return aura::Env::GetInstance()->is_touch_down();
1077 } 1080 }
1078 1081
1079 } // namespace internal 1082 } // namespace internal
1080 } // namespace views 1083 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698