| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 // Only allow one InfoBar at a time per extension. | 51 // Only allow one InfoBar at a time per extension. |
| 52 return extension_delegate->extension_host()->extension() == | 52 return extension_delegate->extension_host()->extension() == |
| 53 extension_host_->extension(); | 53 extension_host_->extension(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void ExtensionInfoBarDelegate::InfoBarClosed() { | 56 void ExtensionInfoBarDelegate::InfoBarClosed() { |
| 57 delete this; | 57 delete this; |
| 58 } | 58 } |
| 59 | 59 |
| 60 #if !defined(TOOLKIT_VIEWS) | 60 #if defined(OS_MACOSX) |
| 61 InfoBar* ExtensionInfoBarDelegate::CreateInfoBar() { | 61 InfoBar* ExtensionInfoBarDelegate::CreateInfoBar() { |
| 62 NOTIMPLEMENTED(); | 62 NOTIMPLEMENTED(); |
| 63 return NULL; | 63 return NULL; |
| 64 } | 64 } |
| 65 #endif // !TOOLKIT_VIEWS | 65 #endif // OS_MACOSX |
| 66 | 66 |
| 67 void ExtensionInfoBarDelegate::Observe(NotificationType type, | 67 void ExtensionInfoBarDelegate::Observe(NotificationType type, |
| 68 const NotificationSource& source, | 68 const NotificationSource& source, |
| 69 const NotificationDetails& details) { | 69 const NotificationDetails& details) { |
| 70 switch (type.value) { | 70 switch (type.value) { |
| 71 case NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE: { | 71 case NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE: { |
| 72 const ExtensionHost* result = Details<ExtensionHost>(details).ptr(); | 72 const ExtensionHost* result = Details<ExtensionHost>(details).ptr(); |
| 73 if (extension_host_.get() == result) | 73 if (extension_host_.get() == result) |
| 74 tab_contents_->RemoveInfoBar(this); | 74 tab_contents_->RemoveInfoBar(this); |
| 75 break; | 75 break; |
| 76 } | 76 } |
| 77 case NotificationType::EXTENSION_UNLOADED: { | 77 case NotificationType::EXTENSION_UNLOADED: { |
| 78 Extension* extension = Details<Extension>(details).ptr(); | 78 Extension* extension = Details<Extension>(details).ptr(); |
| 79 if (extension_ == extension) | 79 if (extension_ == extension) |
| 80 tab_contents_->RemoveInfoBar(this); | 80 tab_contents_->RemoveInfoBar(this); |
| 81 break; | 81 break; |
| 82 } | 82 } |
| 83 default: { | 83 default: { |
| 84 NOTREACHED() << "Unknown message"; | 84 NOTREACHED() << "Unknown message"; |
| 85 break; | 85 break; |
| 86 } | 86 } |
| 87 } | 87 } |
| 88 } | 88 } |
| OLD | NEW |