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/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 : window_(NULL), | 29 : window_(NULL), |
30 extension_host_(host), | 30 extension_host_(host), |
31 observer_(observer) { | 31 observer_(observer) { |
32 AddRef(); // Balanced in DeleteDelegate(); | 32 AddRef(); // Balanced in DeleteDelegate(); |
33 | 33 |
34 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, | 34 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, |
35 content::Source<Profile>(host->profile())); | 35 content::Source<Profile>(host->profile())); |
36 // Listen for the containing view calling window.close(); | 36 // Listen for the containing view calling window.close(); |
37 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, | 37 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, |
38 content::Source<Profile>(host->profile())); | 38 content::Source<Profile>(host->profile())); |
| 39 // Listen for a crash or other termination of the extension process. |
| 40 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, |
| 41 content::Source<Profile>(host->profile())); |
39 } | 42 } |
40 | 43 |
41 ExtensionDialog::~ExtensionDialog() { | 44 ExtensionDialog::~ExtensionDialog() { |
42 } | 45 } |
43 | 46 |
44 // static | 47 // static |
45 ExtensionDialog* ExtensionDialog::Show( | 48 ExtensionDialog* ExtensionDialog::Show( |
46 const GURL& url, | 49 const GURL& url, |
47 Browser* browser, | 50 Browser* browser, |
48 WebContents* web_contents, | 51 WebContents* web_contents, |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 // Avoid potential overdraw by removing the temporary background after | 169 // Avoid potential overdraw by removing the temporary background after |
167 // the extension finishes loading. | 170 // the extension finishes loading. |
168 extension_host_->view()->set_background(NULL); | 171 extension_host_->view()->set_background(NULL); |
169 break; | 172 break; |
170 case chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE: | 173 case chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE: |
171 // If we aren't the host of the popup, then disregard the notification. | 174 // If we aren't the host of the popup, then disregard the notification. |
172 if (content::Details<ExtensionHost>(host()) != details) | 175 if (content::Details<ExtensionHost>(host()) != details) |
173 return; | 176 return; |
174 Close(); | 177 Close(); |
175 break; | 178 break; |
| 179 case chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED: |
| 180 if (content::Details<ExtensionHost>(host()) != details) |
| 181 return; |
| 182 if (observer_) |
| 183 observer_->ExtensionTerminated(this); |
| 184 break; |
176 default: | 185 default: |
177 NOTREACHED() << L"Received unexpected notification"; | 186 NOTREACHED() << L"Received unexpected notification"; |
178 break; | 187 break; |
179 } | 188 } |
180 } | 189 } |
OLD | NEW |