| 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/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/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/tab_contents/infobar.h" | 10 #include "chrome/browser/tab_contents/infobar.h" |
| 11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
| 12 #include "chrome/common/chrome_notification_types.h" | 12 #include "chrome/common/chrome_notification_types.h" |
| 13 #include "chrome/common/extensions/extension.h" | 13 #include "chrome/common/extensions/extension.h" |
| 14 #include "content/common/notification_details.h" | 14 #include "content/common/notification_details.h" |
| 15 #include "content/common/notification_source.h" | 15 #include "content/common/notification_source.h" |
| 16 | 16 |
| 17 ExtensionInfoBarDelegate::ExtensionInfoBarDelegate(Browser* browser, | 17 ExtensionInfoBarDelegate::ExtensionInfoBarDelegate(Browser* browser, |
| 18 TabContents* tab_contents, | 18 TabContents* tab_contents, |
| 19 const Extension* extension, | 19 const Extension* extension, |
| 20 const GURL& url, | 20 const GURL& url, |
| 21 int height) | 21 int height) |
| 22 : InfoBarDelegate(tab_contents), | 22 : InfoBarDelegate(tab_contents), |
| 23 browser_(browser), |
| 23 observer_(NULL), | 24 observer_(NULL), |
| 24 extension_(extension), | 25 extension_(extension), |
| 25 closing_(false) { | 26 closing_(false) { |
| 26 ExtensionProcessManager* manager = | 27 ExtensionProcessManager* manager = |
| 27 browser->profile()->GetExtensionProcessManager(); | 28 browser->profile()->GetExtensionProcessManager(); |
| 28 extension_host_.reset(manager->CreateInfobarHost(url, browser)); | 29 extension_host_.reset(manager->CreateInfobarHost(url, browser)); |
| 29 extension_host_->set_associated_tab_contents(tab_contents); | 30 extension_host_->set_associated_tab_contents(tab_contents); |
| 30 | 31 |
| 31 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, | 32 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, |
| 32 Source<Profile>(browser->profile())); | 33 Source<Profile>(browser->profile())); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 const NotificationDetails& details) { | 86 const NotificationDetails& details) { |
| 86 if (type == chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE) { | 87 if (type == chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE) { |
| 87 if (extension_host_.get() == Details<ExtensionHost>(details).ptr()) | 88 if (extension_host_.get() == Details<ExtensionHost>(details).ptr()) |
| 88 RemoveSelf(); | 89 RemoveSelf(); |
| 89 } else { | 90 } else { |
| 90 DCHECK(type == chrome::NOTIFICATION_EXTENSION_UNLOADED); | 91 DCHECK(type == chrome::NOTIFICATION_EXTENSION_UNLOADED); |
| 91 if (extension_ == Details<UnloadedExtensionInfo>(details)->extension) | 92 if (extension_ == Details<UnloadedExtensionInfo>(details)->extension) |
| 92 RemoveSelf(); | 93 RemoveSelf(); |
| 93 } | 94 } |
| 94 } | 95 } |
| OLD | NEW |