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

Side by Side Diff: chrome/browser/ui/views/extensions/extension_dialog.cc

Issue 1608733002: Remove ui/gfx/screen_type_delegate.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@metro-mode-4
Patch Set: and another rebase Created 4 years, 10 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
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/chrome_notification_types.h" 7 #include "chrome/browser/chrome_notification_types.h"
8 #include "chrome/browser/extensions/extension_view_host.h" 8 #include "chrome/browser/extensions/extension_view_host.h"
9 #include "chrome/browser/extensions/extension_view_host_factory.h" 9 #include "chrome/browser/extensions/extension_view_host_factory.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 // Center the window over the browser. 104 // Center the window over the browser.
105 views::Widget* parent_widget = 105 views::Widget* parent_widget =
106 views::Widget::GetWidgetForNativeWindow(parent); 106 views::Widget::GetWidgetForNativeWindow(parent);
107 gfx::Point center = parent_widget->GetWindowBoundsInScreen().CenterPoint(); 107 gfx::Point center = parent_widget->GetWindowBoundsInScreen().CenterPoint();
108 int x = center.x() - width / 2; 108 int x = center.x() - width / 2;
109 int y = center.y() - height / 2; 109 int y = center.y() - height / 2;
110 // Ensure the top left and top right of the window are on screen, with 110 // Ensure the top left and top right of the window are on screen, with
111 // priority given to the top left. 111 // priority given to the top left.
112 gfx::Rect screen_rect = 112 gfx::Rect screen_rect =
113 gfx::Screen::GetScreenFor(parent_widget->GetNativeView()) 113 gfx::Screen::GetScreen()->GetDisplayNearestPoint(center).bounds();
114 ->GetDisplayNearestPoint(center).bounds();
115 gfx::Rect bounds_rect = gfx::Rect(x, y, width, height); 114 gfx::Rect bounds_rect = gfx::Rect(x, y, width, height);
116 bounds_rect.AdjustToFit(screen_rect); 115 bounds_rect.AdjustToFit(screen_rect);
117 window->SetBounds(bounds_rect); 116 window->SetBounds(bounds_rect);
118 117
119 window->Show(); 118 window->Show();
120 // TODO(jamescook): Remove redundant call to Activate()? 119 // TODO(jamescook): Remove redundant call to Activate()?
121 window->Activate(); 120 window->Activate();
122 } 121 }
123 122
124 void ExtensionDialog::ObserverDestroyed() { 123 void ExtensionDialog::ObserverDestroyed() {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 if (content::Details<extensions::ExtensionHost>(host()) != details) 222 if (content::Details<extensions::ExtensionHost>(host()) != details)
224 return; 223 return;
225 if (observer_) 224 if (observer_)
226 observer_->ExtensionTerminated(this); 225 observer_->ExtensionTerminated(this);
227 break; 226 break;
228 default: 227 default:
229 NOTREACHED() << L"Received unexpected notification"; 228 NOTREACHED() << L"Received unexpected notification";
230 break; 229 break;
231 } 230 }
232 } 231 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698