OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
11 #include "chrome/browser/ui/browser_window.h" | 11 #include "chrome/browser/ui/browser_window.h" |
12 #include "chrome/browser/ui/views/extensions/extension_dialog_observer.h" | 12 #include "chrome/browser/ui/views/extensions/extension_dialog_observer.h" |
13 #include "chrome/browser/ui/views/window.h" // CreateViewsWindow | 13 #include "chrome/browser/ui/views/window.h" // CreateViewsWindow |
14 #include "chrome/common/chrome_notification_types.h" | 14 #include "chrome/common/chrome_notification_types.h" |
15 #include "content/browser/renderer_host/render_view_host.h" | 15 #include "content/browser/renderer_host/render_view_host.h" |
16 #include "content/browser/renderer_host/render_widget_host_view.h" | 16 #include "content/browser/renderer_host/render_widget_host_view.h" |
| 17 #include "content/browser/tab_contents/tab_contents.h" |
17 #include "content/public/browser/notification_details.h" | 18 #include "content/public/browser/notification_details.h" |
18 #include "content/public/browser/notification_source.h" | 19 #include "content/public/browser/notification_source.h" |
19 #include "googleurl/src/gurl.h" | 20 #include "googleurl/src/gurl.h" |
20 #include "views/widget/widget.h" | 21 #include "views/widget/widget.h" |
21 | 22 |
22 #if defined(OS_CHROMEOS) | 23 #if defined(OS_CHROMEOS) |
23 #include "chrome/browser/chromeos/frame/bubble_window.h" | 24 #include "chrome/browser/chromeos/frame/bubble_window.h" |
24 #endif | 25 #endif |
25 | 26 |
26 namespace { | 27 namespace { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 ExtensionDialogObserver* observer) { | 67 ExtensionDialogObserver* observer) { |
67 CHECK(browser); | 68 CHECK(browser); |
68 ExtensionHost* host = CreateExtensionHost(url, browser); | 69 ExtensionHost* host = CreateExtensionHost(url, browser); |
69 if (!host) | 70 if (!host) |
70 return NULL; | 71 return NULL; |
71 host->set_associated_tab_contents(tab_contents); | 72 host->set_associated_tab_contents(tab_contents); |
72 | 73 |
73 ExtensionDialog* dialog = new ExtensionDialog(host, observer); | 74 ExtensionDialog* dialog = new ExtensionDialog(host, observer); |
74 dialog->InitWindow(browser, width, height); | 75 dialog->InitWindow(browser, width, height); |
75 // Ensure the DOM JavaScript can respond immediately to keyboard shortcuts. | 76 // Ensure the DOM JavaScript can respond immediately to keyboard shortcuts. |
76 host->render_view_host()->view()->Focus(); | 77 host->host_contents()->Focus(); |
77 return dialog; | 78 return dialog; |
78 } | 79 } |
79 | 80 |
80 // static | 81 // static |
81 ExtensionHost* ExtensionDialog::CreateExtensionHost(const GURL& url, | 82 ExtensionHost* ExtensionDialog::CreateExtensionHost(const GURL& url, |
82 Browser* browser) { | 83 Browser* browser) { |
83 ExtensionProcessManager* manager = | 84 ExtensionProcessManager* manager = |
84 browser->profile()->GetExtensionProcessManager(); | 85 browser->profile()->GetExtensionProcessManager(); |
85 DCHECK(manager); | 86 DCHECK(manager); |
86 if (!manager) | 87 if (!manager) |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 // If we aren't the host of the popup, then disregard the notification. | 161 // If we aren't the host of the popup, then disregard the notification. |
161 if (content::Details<ExtensionHost>(host()) != details) | 162 if (content::Details<ExtensionHost>(host()) != details) |
162 return; | 163 return; |
163 Close(); | 164 Close(); |
164 break; | 165 break; |
165 default: | 166 default: |
166 NOTREACHED() << L"Received unexpected notification"; | 167 NOTREACHED() << L"Received unexpected notification"; |
167 break; | 168 break; |
168 } | 169 } |
169 } | 170 } |
OLD | NEW |