Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browser.h" | 7 #include "chrome/browser/browser.h" |
| 8 #include "chrome/browser/profile.h" | 8 #include "chrome/browser/profile.h" |
| 9 #include "chrome/browser/extensions/extension_host.h" | 9 #include "chrome/browser/extensions/extension_host.h" |
| 10 #include "chrome/browser/extensions/extension_process_manager.h" | 10 #include "chrome/browser/extensions/extension_process_manager.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 51 | 51 |
| 52 // Only allow one InfoBar at a time per extension. | 52 // Only allow one InfoBar at a time per extension. |
| 53 return extension_delegate->extension_host()->extension() == | 53 return extension_delegate->extension_host()->extension() == |
| 54 extension_host_->extension(); | 54 extension_host_->extension(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void ExtensionInfoBarDelegate::InfoBarClosed() { | 57 void ExtensionInfoBarDelegate::InfoBarClosed() { |
| 58 delete this; | 58 delete this; |
| 59 } | 59 } |
| 60 | 60 |
| 61 ExtensionInfoBarDelegate* ExtensionInfoBarDelegate:: | |
| 62 AsExtensionInfoBarDelegate() { | |
|
Lei Zhang
2010/09/23 22:05:41
style-wise, is this the better way to wrap really
| |
| 63 return this; | |
| 64 } | |
| 65 | |
| 66 InfoBarDelegate::Type ExtensionInfoBarDelegate::GetInfoBarType() { | |
| 67 return PAGE_ACTION_TYPE; | |
| 68 } | |
| 69 | |
| 61 void ExtensionInfoBarDelegate::Observe(NotificationType type, | 70 void ExtensionInfoBarDelegate::Observe(NotificationType type, |
| 62 const NotificationSource& source, | 71 const NotificationSource& source, |
| 63 const NotificationDetails& details) { | 72 const NotificationDetails& details) { |
| 64 switch (type.value) { | 73 switch (type.value) { |
| 65 case NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE: { | 74 case NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE: { |
| 66 const ExtensionHost* result = Details<ExtensionHost>(details).ptr(); | 75 const ExtensionHost* result = Details<ExtensionHost>(details).ptr(); |
| 67 if (extension_host_.get() == result) | 76 if (extension_host_.get() == result) |
| 68 tab_contents_->RemoveInfoBar(this); | 77 tab_contents_->RemoveInfoBar(this); |
| 69 break; | 78 break; |
| 70 } | 79 } |
| 71 case NotificationType::EXTENSION_UNLOADED: { | 80 case NotificationType::EXTENSION_UNLOADED: { |
| 72 Extension* extension = Details<Extension>(details).ptr(); | 81 Extension* extension = Details<Extension>(details).ptr(); |
| 73 if (extension_ == extension) | 82 if (extension_ == extension) |
| 74 tab_contents_->RemoveInfoBar(this); | 83 tab_contents_->RemoveInfoBar(this); |
| 75 break; | 84 break; |
| 76 } | 85 } |
| 77 default: { | 86 default: { |
| 78 NOTREACHED() << "Unknown message"; | 87 NOTREACHED() << "Unknown message"; |
| 79 break; | 88 break; |
| 80 } | 89 } |
| 81 } | 90 } |
| 82 } | 91 } |
| OLD | NEW |