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

Side by Side Diff: chrome/browser/ui/views/extensions/extension_dialog.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: new android code 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 "chrome/browser/ui/views/extensions/extension_dialog.h" 5 #include "chrome/browser/ui/views/extensions/extension_dialog.h"
6 6
7 #include "chrome/browser/extensions/extension_host.h" 7 #include "chrome/browser/extensions/extension_host.h"
8 #include "chrome/browser/extensions/extension_process_manager.h" 8 #include "chrome/browser/extensions/extension_process_manager.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/base_window.h" 10 #include "chrome/browser/ui/base_window.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 DCHECK(manager); 122 DCHECK(manager);
123 if (!manager) 123 if (!manager)
124 return NULL; 124 return NULL;
125 return manager->CreateDialogHost(url); 125 return manager->CreateDialogHost(url);
126 } 126 }
127 127
128 #if defined(USE_ASH) 128 #if defined(USE_ASH)
129 void ExtensionDialog::InitWindowFullscreen() { 129 void ExtensionDialog::InitWindowFullscreen() {
130 aura::RootWindow* root_window = ash::Shell::GetPrimaryRootWindow(); 130 aura::RootWindow* root_window = ash::Shell::GetPrimaryRootWindow();
131 gfx::Rect screen_rect = 131 gfx::Rect screen_rect =
132 gfx::Screen::GetDisplayNearestWindow(root_window).bounds(); 132 ash::Shell::GetAshScreen()->GetDisplayNearestWindow(root_window).bounds();
133 133
134 // We want to be the fullscreen topmost child of the root window. 134 // We want to be the fullscreen topmost child of the root window.
135 window_ = new views::Widget; 135 window_ = new views::Widget;
136 views::Widget::InitParams params( 136 views::Widget::InitParams params(
137 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); 137 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
138 params.delegate = this; 138 params.delegate = this;
139 params.parent = root_window; 139 params.parent = root_window;
140 window_->Init(params); 140 window_->Init(params);
141 window_->StackAtTop(); 141 window_->StackAtTop();
142 window_->SetBounds(screen_rect); 142 window_->SetBounds(screen_rect);
(...skipping 14 matching lines...) Expand all
157 int height) { 157 int height) {
158 gfx::NativeWindow parent = base_window->GetNativeWindow(); 158 gfx::NativeWindow parent = base_window->GetNativeWindow();
159 window_ = views::Widget::CreateWindowWithParent(this, parent); 159 window_ = views::Widget::CreateWindowWithParent(this, parent);
160 160
161 // Center the window over the browser. 161 // Center the window over the browser.
162 gfx::Point center = base_window->GetBounds().CenterPoint(); 162 gfx::Point center = base_window->GetBounds().CenterPoint();
163 int x = center.x() - width / 2; 163 int x = center.x() - width / 2;
164 int y = center.y() - height / 2; 164 int y = center.y() - height / 2;
165 // Ensure the top left and top right of the window are on screen, with 165 // Ensure the top left and top right of the window are on screen, with
166 // priority given to the top left. 166 // priority given to the top left.
167 gfx::Rect screen_rect = gfx::Screen::GetDisplayNearestPoint(center).bounds(); 167 gfx::Rect screen_rect = gfx::Screen::GetScreenFor(parent)->
168 GetDisplayNearestPoint(center).bounds();
168 gfx::Rect bounds_rect = gfx::Rect(x, y, width, height); 169 gfx::Rect bounds_rect = gfx::Rect(x, y, width, height);
169 bounds_rect = bounds_rect.AdjustToFit(screen_rect); 170 bounds_rect = bounds_rect.AdjustToFit(screen_rect);
170 window_->SetBounds(bounds_rect); 171 window_->SetBounds(bounds_rect);
171 172
172 window_->Show(); 173 window_->Show();
173 // TODO(jamescook): Remove redundant call to Activate()? 174 // TODO(jamescook): Remove redundant call to Activate()?
174 window_->Activate(); 175 window_->Activate();
175 } 176 }
176 177
177 void ExtensionDialog::ObserverDestroyed() { 178 void ExtensionDialog::ObserverDestroyed() {
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 if (content::Details<extensions::ExtensionHost>(host()) != details) 279 if (content::Details<extensions::ExtensionHost>(host()) != details)
279 return; 280 return;
280 if (observer_) 281 if (observer_)
281 observer_->ExtensionTerminated(this); 282 observer_->ExtensionTerminated(this);
282 break; 283 break;
283 default: 284 default:
284 NOTREACHED() << L"Received unexpected notification"; 285 NOTREACHED() << L"Received unexpected notification";
285 break; 286 break;
286 } 287 }
287 } 288 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698