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