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" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 host->render_view_host()->view()->Focus(); | 47 host->render_view_host()->view()->Focus(); |
48 } | 48 } |
49 | 49 |
50 ExtensionDialog::~ExtensionDialog() { | 50 ExtensionDialog::~ExtensionDialog() { |
51 } | 51 } |
52 | 52 |
53 // static | 53 // static |
54 ExtensionDialog* ExtensionDialog::Show( | 54 ExtensionDialog* ExtensionDialog::Show( |
55 const GURL& url, | 55 const GURL& url, |
56 Browser* browser, | 56 Browser* browser, |
| 57 TabContents* tab_contents, |
57 int width, | 58 int width, |
58 int height, | 59 int height, |
59 ExtensionDialogObserver* observer) { | 60 ExtensionDialogObserver* observer) { |
60 CHECK(browser); | 61 CHECK(browser); |
61 ExtensionProcessManager* manager = | 62 ExtensionProcessManager* manager = |
62 browser->profile()->GetExtensionProcessManager(); | 63 browser->profile()->GetExtensionProcessManager(); |
63 DCHECK(manager); | 64 DCHECK(manager); |
64 if (!manager) | 65 if (!manager) |
65 return NULL; | 66 return NULL; |
66 ExtensionHost* host = manager->CreateDialogHost(url, browser); | 67 ExtensionHost* host = manager->CreateDialogHost(url, browser); |
67 DCHECK(host); | 68 if (!host) |
| 69 return NULL; |
| 70 host->set_associated_tab_contents(tab_contents); |
68 return new ExtensionDialog(browser, host, width, height, observer); | 71 return new ExtensionDialog(browser, host, width, height, observer); |
69 } | 72 } |
70 | 73 |
71 void ExtensionDialog::ObserverDestroyed() { | 74 void ExtensionDialog::ObserverDestroyed() { |
72 observer_ = NULL; | 75 observer_ = NULL; |
73 } | 76 } |
74 | 77 |
75 void ExtensionDialog::Close() { | 78 void ExtensionDialog::Close() { |
76 if (!window_) | 79 if (!window_) |
77 return; | 80 return; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 // If we aren't the host of the popup, then disregard the notification. | 141 // If we aren't the host of the popup, then disregard the notification. |
139 if (Details<ExtensionHost>(host()) != details) | 142 if (Details<ExtensionHost>(host()) != details) |
140 return; | 143 return; |
141 Close(); | 144 Close(); |
142 break; | 145 break; |
143 default: | 146 default: |
144 NOTREACHED() << L"Received unexpected notification"; | 147 NOTREACHED() << L"Received unexpected notification"; |
145 break; | 148 break; |
146 } | 149 } |
147 } | 150 } |
OLD | NEW |