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/api/infobars/infobar_service.h" | 7 #include "chrome/browser/api/infobars/infobar_service.h" |
8 #include "chrome/browser/extensions/extension_host.h" | 8 #include "chrome/browser/extensions/extension_host.h" |
9 #include "chrome/browser/extensions/extension_process_manager.h" | 9 #include "chrome/browser/extensions/extension_process_manager.h" |
| 10 #include "chrome/browser/extensions/extension_system.h" |
10 #include "chrome/browser/infobars/infobar.h" | 11 #include "chrome/browser/infobars/infobar.h" |
11 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/common/chrome_notification_types.h" | 14 #include "chrome/common/chrome_notification_types.h" |
14 #include "chrome/common/extensions/extension.h" | 15 #include "chrome/common/extensions/extension.h" |
15 #include "content/public/browser/notification_details.h" | 16 #include "content/public/browser/notification_details.h" |
16 #include "content/public/browser/notification_source.h" | 17 #include "content/public/browser/notification_source.h" |
17 | 18 |
18 ExtensionInfoBarDelegate::ExtensionInfoBarDelegate( | 19 ExtensionInfoBarDelegate::ExtensionInfoBarDelegate( |
19 Browser* browser, | 20 Browser* browser, |
20 InfoBarService* infobar_service, | 21 InfoBarService* infobar_service, |
21 const extensions::Extension* extension, | 22 const extensions::Extension* extension, |
22 const GURL& url, | 23 const GURL& url, |
23 int height) | 24 int height) |
24 : InfoBarDelegate(infobar_service), | 25 : InfoBarDelegate(infobar_service), |
25 browser_(browser), | 26 browser_(browser), |
26 observer_(NULL), | 27 observer_(NULL), |
27 extension_(extension), | 28 extension_(extension), |
28 closing_(false) { | 29 closing_(false) { |
29 ExtensionProcessManager* manager = | 30 ExtensionProcessManager* manager = |
30 browser->profile()->GetExtensionProcessManager(); | 31 extensions::ExtensionSystem::Get(browser->profile())->process_manager(); |
31 extension_host_.reset(manager->CreateInfobarHost(url, browser)); | 32 extension_host_.reset(manager->CreateInfobarHost(url, browser)); |
32 extension_host_->SetAssociatedWebContents(infobar_service->GetWebContents()); | 33 extension_host_->SetAssociatedWebContents(infobar_service->GetWebContents()); |
33 | 34 |
34 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, | 35 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, |
35 content::Source<Profile>(browser->profile())); | 36 content::Source<Profile>(browser->profile())); |
36 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 37 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, |
37 content::Source<Profile>(browser->profile())); | 38 content::Source<Profile>(browser->profile())); |
38 | 39 |
39 #if defined(TOOLKIT_VIEWS) || defined(TOOLKIT_GTK) | 40 #if defined(TOOLKIT_VIEWS) || defined(TOOLKIT_GTK) |
40 int default_height = InfoBar::kDefaultBarTargetHeight; | 41 int default_height = InfoBar::kDefaultBarTargetHeight; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 RemoveSelf(); | 98 RemoveSelf(); |
98 } else { | 99 } else { |
99 DCHECK(type == chrome::NOTIFICATION_EXTENSION_UNLOADED); | 100 DCHECK(type == chrome::NOTIFICATION_EXTENSION_UNLOADED); |
100 if (extension_ == | 101 if (extension_ == |
101 content::Details<extensions::UnloadedExtensionInfo>( | 102 content::Details<extensions::UnloadedExtensionInfo>( |
102 details)->extension) { | 103 details)->extension) { |
103 RemoveSelf(); | 104 RemoveSelf(); |
104 } | 105 } |
105 } | 106 } |
106 } | 107 } |
OLD | NEW |