OLD | NEW |
---|---|
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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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::GetDisplayNearestPoint( |
168 gfx::Screen::BadTwoWorldsContext(), center).bounds(); | |
oshima
2012/10/04 20:18:26
base_window?
| |
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 Loading... | |
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 } |
OLD | NEW |