| 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/theme_installed_infobar_delegate.h" | 5 #include "chrome/browser/extensions/theme_installed_infobar_delegate.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 content::Source<ThemeService>(theme_service_)); | 98 content::Source<ThemeService>(theme_service_)); |
| 99 } | 99 } |
| 100 | 100 |
| 101 ThemeInstalledInfoBarDelegate::~ThemeInstalledInfoBarDelegate() { | 101 ThemeInstalledInfoBarDelegate::~ThemeInstalledInfoBarDelegate() { |
| 102 // We don't want any notifications while we're running our destructor. | 102 // We don't want any notifications while we're running our destructor. |
| 103 registrar_.RemoveAll(); | 103 registrar_.RemoveAll(); |
| 104 | 104 |
| 105 theme_service_->OnInfobarDestroyed(); | 105 theme_service_->OnInfobarDestroyed(); |
| 106 } | 106 } |
| 107 | 107 |
| 108 gfx::Image* ThemeInstalledInfoBarDelegate::GetIcon() const { | 108 int ThemeInstalledInfoBarDelegate::GetIconID() const { |
| 109 // TODO(aa): Reply with the theme's icon, but this requires reading it | 109 // TODO(aa): Reply with the theme's icon, but this requires reading it |
| 110 // asynchronously from disk. | 110 // asynchronously from disk. |
| 111 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 111 return IDR_INFOBAR_THEME; |
| 112 IDR_INFOBAR_THEME); | |
| 113 } | 112 } |
| 114 | 113 |
| 115 InfoBarDelegate::Type ThemeInstalledInfoBarDelegate::GetInfoBarType() const { | 114 InfoBarDelegate::Type ThemeInstalledInfoBarDelegate::GetInfoBarType() const { |
| 116 return PAGE_ACTION_TYPE; | 115 return PAGE_ACTION_TYPE; |
| 117 } | 116 } |
| 118 | 117 |
| 119 ThemeInstalledInfoBarDelegate* | 118 ThemeInstalledInfoBarDelegate* |
| 120 ThemeInstalledInfoBarDelegate::AsThemePreviewInfobarDelegate() { | 119 ThemeInstalledInfoBarDelegate::AsThemePreviewInfobarDelegate() { |
| 121 return this; | 120 return this; |
| 122 } | 121 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 void ThemeInstalledInfoBarDelegate::Observe( | 155 void ThemeInstalledInfoBarDelegate::Observe( |
| 157 int type, | 156 int type, |
| 158 const content::NotificationSource& source, | 157 const content::NotificationSource& source, |
| 159 const content::NotificationDetails& details) { | 158 const content::NotificationDetails& details) { |
| 160 DCHECK_EQ(chrome::NOTIFICATION_BROWSER_THEME_CHANGED, type); | 159 DCHECK_EQ(chrome::NOTIFICATION_BROWSER_THEME_CHANGED, type); |
| 161 // If the new theme is different from what this info bar is associated with, | 160 // If the new theme is different from what this info bar is associated with, |
| 162 // close this info bar since it is no longer relevant. | 161 // close this info bar since it is no longer relevant. |
| 163 if (theme_id_ != theme_service_->GetThemeID()) | 162 if (theme_id_ != theme_service_->GetThemeID()) |
| 164 RemoveSelf(); | 163 RemoveSelf(); |
| 165 } | 164 } |
| OLD | NEW |