| 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/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
| 8 #include "chrome/browser/extensions/extension_view_host.h" | 8 #include "chrome/browser/extensions/extension_view_host.h" |
| 9 #include "chrome/browser/extensions/extension_view_host_factory.h" | 9 #include "chrome/browser/extensions/extension_view_host_factory.h" |
| 10 #include "chrome/browser/infobars/infobar_service.h" | 10 #include "chrome/browser/infobars/infobar_service.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 infobars::InfoBarDelegate::Type ExtensionInfoBarDelegate::GetInfoBarType() | 90 infobars::InfoBarDelegate::Type ExtensionInfoBarDelegate::GetInfoBarType() |
| 91 const { | 91 const { |
| 92 return PAGE_ACTION_TYPE; | 92 return PAGE_ACTION_TYPE; |
| 93 } | 93 } |
| 94 | 94 |
| 95 ExtensionInfoBarDelegate* | 95 ExtensionInfoBarDelegate* |
| 96 ExtensionInfoBarDelegate::AsExtensionInfoBarDelegate() { | 96 ExtensionInfoBarDelegate::AsExtensionInfoBarDelegate() { |
| 97 return this; | 97 return this; |
| 98 } | 98 } |
| 99 | 99 |
| 100 const ExtensionInfoBarDelegate* |
| 101 ExtensionInfoBarDelegate::AsExtensionInfoBarDelegate() const { |
| 102 return this; |
| 103 } |
| 104 |
| 100 void ExtensionInfoBarDelegate::OnExtensionUnloaded( | 105 void ExtensionInfoBarDelegate::OnExtensionUnloaded( |
| 101 content::BrowserContext* browser_context, | 106 content::BrowserContext* browser_context, |
| 102 const extensions::Extension* extension, | 107 const extensions::Extension* extension, |
| 103 extensions::UnloadedExtensionInfo::Reason reason) { | 108 extensions::UnloadedExtensionInfo::Reason reason) { |
| 104 if (extension_ == extension) | 109 if (extension_ == extension) |
| 105 infobar()->RemoveSelf(); | 110 infobar()->RemoveSelf(); |
| 106 } | 111 } |
| 107 | 112 |
| 108 void ExtensionInfoBarDelegate::Observe( | 113 void ExtensionInfoBarDelegate::Observe( |
| 109 int type, | 114 int type, |
| 110 const content::NotificationSource& source, | 115 const content::NotificationSource& source, |
| 111 const content::NotificationDetails& details) { | 116 const content::NotificationDetails& details) { |
| 112 DCHECK_EQ(type, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE); | 117 DCHECK_EQ(type, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE); |
| 113 if (extension_view_host_.get() == | 118 if (extension_view_host_.get() == |
| 114 content::Details<extensions::ExtensionHost>(details).ptr()) | 119 content::Details<extensions::ExtensionHost>(details).ptr()) |
| 115 infobar()->RemoveSelf(); | 120 infobar()->RemoveSelf(); |
| 116 } | 121 } |
| OLD | NEW |