| 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/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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 view->SetVisible(true); | 90 view->SetVisible(true); |
| 91 | 91 |
| 92 // Ensure the DOM JavaScript can respond immediately to keyboard shortcuts. | 92 // Ensure the DOM JavaScript can respond immediately to keyboard shortcuts. |
| 93 host->host_contents()->Focus(); | 93 host->host_contents()->Focus(); |
| 94 return dialog; | 94 return dialog; |
| 95 } | 95 } |
| 96 | 96 |
| 97 void ExtensionDialog::InitWindow(aura::Window* parent, | 97 void ExtensionDialog::InitWindow(aura::Window* parent, |
| 98 int width, | 98 int width, |
| 99 int height) { | 99 int height) { |
| 100 views::Widget* window = CreateBrowserModalDialogViews(this, parent); | 100 views::Widget* window = CreateWindowModalDialogViews(this, parent); |
| 101 | 101 |
| 102 // Center the window over the browser. | 102 // Center the window over the browser. |
| 103 gfx::Point center = parent->GetBoundsInScreen().CenterPoint(); | 103 gfx::Point center = parent->GetBoundsInScreen().CenterPoint(); |
| 104 int x = center.x() - width / 2; | 104 int x = center.x() - width / 2; |
| 105 int y = center.y() - height / 2; | 105 int y = center.y() - height / 2; |
| 106 // Ensure the top left and top right of the window are on screen, with | 106 // Ensure the top left and top right of the window are on screen, with |
| 107 // priority given to the top left. | 107 // priority given to the top left. |
| 108 gfx::Rect screen_rect = gfx::Screen::GetScreenFor(parent)-> | 108 gfx::Rect screen_rect = gfx::Screen::GetScreenFor(parent)-> |
| 109 GetDisplayNearestPoint(center).bounds(); | 109 GetDisplayNearestPoint(center).bounds(); |
| 110 gfx::Rect bounds_rect = gfx::Rect(x, y, width, height); | 110 gfx::Rect bounds_rect = gfx::Rect(x, y, width, height); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 if (content::Details<extensions::ExtensionHost>(host()) != details) | 216 if (content::Details<extensions::ExtensionHost>(host()) != details) |
| 217 return; | 217 return; |
| 218 if (observer_) | 218 if (observer_) |
| 219 observer_->ExtensionTerminated(this); | 219 observer_->ExtensionTerminated(this); |
| 220 break; | 220 break; |
| 221 default: | 221 default: |
| 222 NOTREACHED() << L"Received unexpected notification"; | 222 NOTREACHED() << L"Received unexpected notification"; |
| 223 break; | 223 break; |
| 224 } | 224 } |
| 225 } | 225 } |
| OLD | NEW |