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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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::GetScreenFor(parent)-> | 167 gfx::Rect screen_rect = gfx::Screen::GetScreenFor(parent)-> |
168 GetDisplayNearestPoint(center).bounds(); | 168 GetDisplayNearestPoint(center).bounds(); |
169 gfx::Rect bounds_rect = gfx::Rect(x, y, width, height); | 169 gfx::Rect bounds_rect = gfx::Rect(x, y, width, height); |
170 bounds_rect = bounds_rect.AdjustToFit(screen_rect); | 170 bounds_rect.AdjustToFit(screen_rect); |
171 window_->SetBounds(bounds_rect); | 171 window_->SetBounds(bounds_rect); |
172 | 172 |
173 window_->Show(); | 173 window_->Show(); |
174 // TODO(jamescook): Remove redundant call to Activate()? | 174 // TODO(jamescook): Remove redundant call to Activate()? |
175 window_->Activate(); | 175 window_->Activate(); |
176 } | 176 } |
177 | 177 |
178 void ExtensionDialog::ObserverDestroyed() { | 178 void ExtensionDialog::ObserverDestroyed() { |
179 observer_ = NULL; | 179 observer_ = NULL; |
180 } | 180 } |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 if (content::Details<extensions::ExtensionHost>(host()) != details) | 279 if (content::Details<extensions::ExtensionHost>(host()) != details) |
280 return; | 280 return; |
281 if (observer_) | 281 if (observer_) |
282 observer_->ExtensionTerminated(this); | 282 observer_->ExtensionTerminated(this); |
283 break; | 283 break; |
284 default: | 284 default: |
285 NOTREACHED() << L"Received unexpected notification"; | 285 NOTREACHED() << L"Received unexpected notification"; |
286 break; | 286 break; |
287 } | 287 } |
288 } | 288 } |
OLD | NEW |