| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_preview_infobar_delegate.h" | 5 #include "chrome/browser/extensions/theme_preview_infobar_delegate.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" |
| 8 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 9 #include "chrome/browser/profile.h" | 10 #include "chrome/browser/profile.h" |
| 10 #include "chrome/browser/tab_contents/tab_contents.h" | 11 #include "chrome/browser/tab_contents/tab_contents.h" |
| 11 #include "grit/generated_resources.h" | 12 #include "grit/generated_resources.h" |
| 13 #include "grit/theme_resources.h" |
| 12 | 14 |
| 13 ThemePreviewInfobarDelegate::ThemePreviewInfobarDelegate( | 15 ThemePreviewInfobarDelegate::ThemePreviewInfobarDelegate( |
| 14 TabContents* tab_contents, const std::string& name) | 16 TabContents* tab_contents, const std::string& name) |
| 15 : ConfirmInfoBarDelegate(tab_contents), | 17 : ConfirmInfoBarDelegate(tab_contents), |
| 16 profile_(tab_contents->profile()), name_(name) { | 18 profile_(tab_contents->profile()), name_(name) { |
| 17 } | 19 } |
| 18 | 20 |
| 19 void ThemePreviewInfobarDelegate::InfoBarClosed() { | 21 void ThemePreviewInfobarDelegate::InfoBarClosed() { |
| 20 delete this; | 22 delete this; |
| 21 } | 23 } |
| 22 | 24 |
| 23 std::wstring ThemePreviewInfobarDelegate::GetMessageText() const { | 25 std::wstring ThemePreviewInfobarDelegate::GetMessageText() const { |
| 24 return l10n_util::GetStringF(IDS_THEME_INSTALL_INFOBAR_LABEL, | 26 return l10n_util::GetStringF(IDS_THEME_INSTALL_INFOBAR_LABEL, |
| 25 UTF8ToWide(name_)); | 27 UTF8ToWide(name_)); |
| 26 } | 28 } |
| 27 | 29 |
| 28 SkBitmap* ThemePreviewInfobarDelegate::GetIcon() const { | 30 SkBitmap* ThemePreviewInfobarDelegate::GetIcon() const { |
| 29 // TODO(aa): Reply with the theme's icon, but this requires reading it | 31 // TODO(aa): Reply with the theme's icon, but this requires reading it |
| 30 // asynchronously from disk. | 32 // asynchronously from disk. |
| 31 return NULL; | 33 return ResourceBundle::GetSharedInstance().GetBitmapNamed( |
| 34 IDR_INFOBAR_THEME); |
| 32 } | 35 } |
| 33 | 36 |
| 34 ThemePreviewInfobarDelegate* | 37 ThemePreviewInfobarDelegate* |
| 35 ThemePreviewInfobarDelegate::AsThemePreviewInfobarDelegate() { | 38 ThemePreviewInfobarDelegate::AsThemePreviewInfobarDelegate() { |
| 36 return this; | 39 return this; |
| 37 } | 40 } |
| 38 | 41 |
| 39 int ThemePreviewInfobarDelegate::GetButtons() const { | 42 int ThemePreviewInfobarDelegate::GetButtons() const { |
| 40 return BUTTON_CANCEL; | 43 return BUTTON_CANCEL; |
| 41 } | 44 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 54 // Blech, this is a total hack. | 57 // Blech, this is a total hack. |
| 55 // | 58 // |
| 56 // a) We should be uninstalling via ExtensionsService, not | 59 // a) We should be uninstalling via ExtensionsService, not |
| 57 // Profile::ClearTheme(). | 60 // Profile::ClearTheme(). |
| 58 // b) We should be able to view the theme without installing it. This would | 61 // b) We should be able to view the theme without installing it. This would |
| 59 // help in edge cases like the user closing the window or tab before making | 62 // help in edge cases like the user closing the window or tab before making |
| 60 // a decision. | 63 // a decision. |
| 61 profile_->ClearTheme(); | 64 profile_->ClearTheme(); |
| 62 return true; | 65 return true; |
| 63 } | 66 } |
| OLD | NEW |