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/extensions/extension_infobar_delegate.h" | 5 #include "chrome/browser/extensions/extension_infobar_delegate.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/infobars/infobar.h" | 9 #include "chrome/browser/infobars/infobar.h" |
10 #include "chrome/browser/infobars/infobar_tab_helper.h" | 10 #include "chrome/browser/infobars/infobar_tab_helper.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/common/chrome_notification_types.h" | 13 #include "chrome/common/chrome_notification_types.h" |
14 #include "chrome/common/extensions/extension.h" | 14 #include "chrome/common/extensions/extension.h" |
15 #include "content/public/browser/notification_details.h" | 15 #include "content/public/browser/notification_details.h" |
16 #include "content/public/browser/notification_source.h" | 16 #include "content/public/browser/notification_source.h" |
17 | 17 |
18 ExtensionInfoBarDelegate::ExtensionInfoBarDelegate( | 18 ExtensionInfoBarDelegate::ExtensionInfoBarDelegate( |
19 Browser* browser, | 19 Browser* browser, |
20 InfoBarTabHelper* infobar_helper, | 20 InfoBarTabHelper* infobar_helper, |
21 const Extension* extension, | 21 const extensions::Extension* extension, |
22 const GURL& url, | 22 const GURL& url, |
23 int height) | 23 int height) |
24 : InfoBarDelegate(infobar_helper), | 24 : InfoBarDelegate(infobar_helper), |
25 browser_(browser), | 25 browser_(browser), |
26 observer_(NULL), | 26 observer_(NULL), |
27 extension_(extension), | 27 extension_(extension), |
28 closing_(false) { | 28 closing_(false) { |
29 ExtensionProcessManager* manager = | 29 ExtensionProcessManager* manager = |
30 browser->profile()->GetExtensionProcessManager(); | 30 browser->profile()->GetExtensionProcessManager(); |
31 extension_host_.reset(manager->CreateInfobarHost(url, browser)); | 31 extension_host_.reset(manager->CreateInfobarHost(url, browser)); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 void ExtensionInfoBarDelegate::Observe( | 90 void ExtensionInfoBarDelegate::Observe( |
91 int type, | 91 int type, |
92 const content::NotificationSource& source, | 92 const content::NotificationSource& source, |
93 const content::NotificationDetails& details) { | 93 const content::NotificationDetails& details) { |
94 if (type == chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE) { | 94 if (type == chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE) { |
95 if (extension_host_.get() == content::Details<ExtensionHost>(details).ptr()) | 95 if (extension_host_.get() == content::Details<ExtensionHost>(details).ptr()) |
96 RemoveSelf(); | 96 RemoveSelf(); |
97 } else { | 97 } else { |
98 DCHECK(type == chrome::NOTIFICATION_EXTENSION_UNLOADED); | 98 DCHECK(type == chrome::NOTIFICATION_EXTENSION_UNLOADED); |
99 if (extension_ == | 99 if (extension_ == |
100 content::Details<UnloadedExtensionInfo>(details)->extension) { | 100 content::Details<extensions::UnloadedExtensionInfo>( |
| 101 details)->extension) { |
101 RemoveSelf(); | 102 RemoveSelf(); |
102 } | 103 } |
103 } | 104 } |
104 } | 105 } |
OLD | NEW |