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/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 "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
12 #include "chrome/browser/extensions/extensions_service.h" | 12 #include "chrome/browser/extensions/extension_service.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/tab_contents/tab_contents.h" | 14 #include "chrome/browser/tab_contents/tab_contents.h" |
15 #include "chrome/browser/themes/browser_theme_provider.h" | 15 #include "chrome/browser/themes/browser_theme_provider.h" |
16 #include "chrome/common/extensions/extension.h" | 16 #include "chrome/common/extensions/extension.h" |
17 #include "chrome/common/notification_service.h" | 17 #include "chrome/common/notification_service.h" |
18 #include "grit/generated_resources.h" | 18 #include "grit/generated_resources.h" |
19 #include "grit/theme_resources.h" | 19 #include "grit/theme_resources.h" |
20 | 20 |
21 ThemeInstalledInfoBarDelegate::ThemeInstalledInfoBarDelegate( | 21 ThemeInstalledInfoBarDelegate::ThemeInstalledInfoBarDelegate( |
22 TabContents* tab_contents, | 22 TabContents* tab_contents, |
(...skipping 45 matching lines...) Loading... |
68 ConfirmInfoBarDelegate::InfoBarButton button) const { | 68 ConfirmInfoBarDelegate::InfoBarButton button) const { |
69 // The InfoBar will create a default OK button and make it invisible. | 69 // The InfoBar will create a default OK button and make it invisible. |
70 // TODO(mirandac): remove the default OK button from ConfirmInfoBar. | 70 // TODO(mirandac): remove the default OK button from ConfirmInfoBar. |
71 return (button == BUTTON_CANCEL) ? | 71 return (button == BUTTON_CANCEL) ? |
72 l10n_util::GetStringUTF16(IDS_THEME_INSTALL_INFOBAR_UNDO_BUTTON) : | 72 l10n_util::GetStringUTF16(IDS_THEME_INSTALL_INFOBAR_UNDO_BUTTON) : |
73 string16(); | 73 string16(); |
74 } | 74 } |
75 | 75 |
76 bool ThemeInstalledInfoBarDelegate::Cancel() { | 76 bool ThemeInstalledInfoBarDelegate::Cancel() { |
77 if (!previous_theme_id_.empty()) { | 77 if (!previous_theme_id_.empty()) { |
78 ExtensionsService* service = profile_->GetExtensionsService(); | 78 ExtensionService* service = profile_->GetExtensionService(); |
79 if (service) { | 79 if (service) { |
80 const Extension* previous_theme = | 80 const Extension* previous_theme = |
81 service->GetExtensionById(previous_theme_id_, true); | 81 service->GetExtensionById(previous_theme_id_, true); |
82 if (previous_theme) { | 82 if (previous_theme) { |
83 profile_->SetTheme(previous_theme); | 83 profile_->SetTheme(previous_theme); |
84 return true; | 84 return true; |
85 } | 85 } |
86 } | 86 } |
87 } | 87 } |
88 | 88 |
(...skipping 23 matching lines...) Loading... |
112 // (when InfoBar::OnBackgroundExpose() is called). This will likely | 112 // (when InfoBar::OnBackgroundExpose() is called). This will likely |
113 // be fixed when infobar delegate deletion is cleaned up for | 113 // be fixed when infobar delegate deletion is cleaned up for |
114 // http://crbug.com/62154. | 114 // http://crbug.com/62154. |
115 } | 115 } |
116 } | 116 } |
117 } | 117 } |
118 | 118 |
119 bool ThemeInstalledInfoBarDelegate::MatchesTheme(const Extension* theme) { | 119 bool ThemeInstalledInfoBarDelegate::MatchesTheme(const Extension* theme) { |
120 return (theme && theme->id() == theme_id_); | 120 return (theme && theme->id() == theme_id_); |
121 } | 121 } |
OLD | NEW |