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

Unified 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: fix some new gfx::Screen additions 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/widget/native_widget_aura.cc
diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc
index 3e2039793c6af3da6ac6a8a163e57ce289301d42..49a69a3402dd0155250f6bfa648477d029f6aed5 100644
--- a/ui/views/widget/native_widget_aura.cc
+++ b/ui/views/widget/native_widget_aura.cc
@@ -82,11 +82,12 @@ void SetRestoreBounds(aura::Window* window, const gfx::Rect& bounds) {
////////////////////////////////////////////////////////////////////////////////
// NativeWidgetAura, public:
-NativeWidgetAura::NativeWidgetAura(internal::NativeWidgetDelegate* delegate)
+NativeWidgetAura::NativeWidgetAura(
+ internal::NativeWidgetDelegate* delegate, gfx::NativeView parent)
: delegate_(delegate),
ALLOW_THIS_IN_INITIALIZER_LIST(desktop_helper_(
ViewsDelegate::views_delegate ?
- ViewsDelegate::views_delegate->CreateNativeWidgetHelper(this) :
+ ViewsDelegate::views_delegate->CreateNativeWidgetHelper(this, parent):
NULL)),
ALLOW_THIS_IN_INITIALIZER_LIST(window_(new aura::Window(this))),
ownership_(Widget::InitParams::NATIVE_WIDGET_OWNS_WIDGET),
@@ -167,7 +168,8 @@ void NativeWidgetAura::InitNativeWidget(const Widget::InitParams& params) {
// If a parent is specified but no bounds are given,
// use the origin of the parent's display so that the widget
// will be added to the same display as the parent.
- gfx::Rect bounds = gfx::Screen::GetDisplayNearestWindow(parent).bounds();
+ gfx::Rect bounds = gfx::Screen::GetScreenFor(parent)->
+ GetDisplayNearestWindow(parent).bounds();
window_bounds.set_origin(bounds.origin());
}
window_->SetParent(parent);
@@ -315,8 +317,8 @@ void NativeWidgetAura::CenterWindow(const gfx::Size& size) {
// When centering window, we take the intersection of the host and
// the parent. We assume the root window represents the visible
// rect of a single screen.
- gfx::Rect work_area =
- gfx::Screen::GetDisplayNearestWindow(window_).work_area();
+ gfx::Rect work_area = gfx::Screen::GetScreenFor(window_)->
+ GetDisplayNearestWindow(window_).work_area();
aura::client::ScreenPositionClient* screen_position_client =
aura::client::GetScreenPositionClient(window_->GetRootWindow());
@@ -423,7 +425,8 @@ void NativeWidgetAura::SetBounds(const gfx::Rect& bounds) {
aura::client::ScreenPositionClient* screen_position_client =
aura::client::GetScreenPositionClient(root);
if (screen_position_client) {
- gfx::Display dst_display = gfx::Screen::GetDisplayMatching(bounds);
+ gfx::Display dst_display =
+ gfx::Screen::GetScreenFor(window_)->GetDisplayMatching(bounds);
screen_position_client->SetBounds(window_, bounds, dst_display);
return;
}
@@ -622,7 +625,8 @@ void NativeWidgetAura::ClearNativeFocus() {
}
gfx::Rect NativeWidgetAura::GetWorkAreaBoundsInScreen() const {
- return gfx::Screen::GetDisplayNearestWindow(GetNativeView()).work_area();
+ return gfx::Screen::GetScreenFor(GetNativeView())->
+ GetDisplayNearestWindow(GetNativeView()).work_area();
}
void NativeWidgetAura::SetInactiveRenderingDisabled(bool value) {
@@ -946,8 +950,9 @@ namespace internal {
// static
NativeWidgetPrivate* NativeWidgetPrivate::CreateNativeWidget(
- internal::NativeWidgetDelegate* delegate) {
- return new NativeWidgetAura(delegate);
+ internal::NativeWidgetDelegate* delegate,
+ gfx::NativeView parent) {
+ return new NativeWidgetAura(delegate, parent);
}
// static

Powered by Google App Engine
This is Rietveld 408576698