Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(242)

Side by Side Diff: chrome/browser/extensions/theme_installed_infobar_delegate.cc

Issue 922953002: Minor infobar cleanup. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resync Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 content::Source<ThemeService>(theme_service_)); 96 content::Source<ThemeService>(theme_service_));
97 } 97 }
98 98
99 ThemeInstalledInfoBarDelegate::~ThemeInstalledInfoBarDelegate() { 99 ThemeInstalledInfoBarDelegate::~ThemeInstalledInfoBarDelegate() {
100 // We don't want any notifications while we're running our destructor. 100 // We don't want any notifications while we're running our destructor.
101 registrar_.RemoveAll(); 101 registrar_.RemoveAll();
102 102
103 theme_service_->OnInfobarDestroyed(); 103 theme_service_->OnInfobarDestroyed();
104 } 104 }
105 105
106 int ThemeInstalledInfoBarDelegate::GetIconID() const { 106 infobars::InfoBarDelegate::Type
107 // TODO(aa): Reply with the theme's icon, but this requires reading it 107 ThemeInstalledInfoBarDelegate::GetInfoBarType() const {
108 // asynchronously from disk.
109 return IDR_INFOBAR_THEME;
110 }
111
112 infobars::InfoBarDelegate::Type ThemeInstalledInfoBarDelegate::GetInfoBarType()
113 const {
114 return PAGE_ACTION_TYPE; 108 return PAGE_ACTION_TYPE;
115 } 109 }
116 110
117 ThemeInstalledInfoBarDelegate* 111 ThemeInstalledInfoBarDelegate*
118 ThemeInstalledInfoBarDelegate::AsThemePreviewInfobarDelegate() { 112 ThemeInstalledInfoBarDelegate::AsThemePreviewInfobarDelegate() {
119 return this; 113 return this;
120 } 114 }
121 115
116 int ThemeInstalledInfoBarDelegate::GetIconID() const {
117 // TODO(aa): Reply with the theme's icon, but this requires reading it
118 // asynchronously from disk.
119 return IDR_INFOBAR_THEME;
120 }
121
122 base::string16 ThemeInstalledInfoBarDelegate::GetMessageText() const { 122 base::string16 ThemeInstalledInfoBarDelegate::GetMessageText() const {
123 return l10n_util::GetStringFUTF16(IDS_THEME_INSTALL_INFOBAR_LABEL, 123 return l10n_util::GetStringFUTF16(IDS_THEME_INSTALL_INFOBAR_LABEL,
124 base::UTF8ToUTF16(name_)); 124 base::UTF8ToUTF16(name_));
125 } 125 }
126 126
127 int ThemeInstalledInfoBarDelegate::GetButtons() const { 127 int ThemeInstalledInfoBarDelegate::GetButtons() const {
128 return BUTTON_CANCEL; 128 return BUTTON_CANCEL;
129 } 129 }
130 130
131 base::string16 ThemeInstalledInfoBarDelegate::GetButtonLabel( 131 base::string16 ThemeInstalledInfoBarDelegate::GetButtonLabel(
(...skipping 22 matching lines...) Expand all
154 void ThemeInstalledInfoBarDelegate::Observe( 154 void ThemeInstalledInfoBarDelegate::Observe(
155 int type, 155 int type,
156 const content::NotificationSource& source, 156 const content::NotificationSource& source,
157 const content::NotificationDetails& details) { 157 const content::NotificationDetails& details) {
158 DCHECK_EQ(chrome::NOTIFICATION_BROWSER_THEME_CHANGED, type); 158 DCHECK_EQ(chrome::NOTIFICATION_BROWSER_THEME_CHANGED, type);
159 // If the new theme is different from what this info bar is associated with, 159 // If the new theme is different from what this info bar is associated with,
160 // close this info bar since it is no longer relevant. 160 // close this info bar since it is no longer relevant.
161 if (theme_id_ != theme_service_->GetThemeID()) 161 if (theme_id_ != theme_service_->GetThemeID())
162 infobar()->RemoveSelf(); 162 infobar()->RemoveSelf();
163 } 163 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698