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

Side by Side Diff: chrome/browser/ui/content_settings/content_setting_changed_infobar_delegate.cc

Issue 15067008: [InfoBar] Add InfoBarDelegate::GetIconID() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit fixes redux Created 7 years, 7 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/ui/content_settings/content_setting_changed_infobar_del egate.h" 5 #include "chrome/browser/ui/content_settings/content_setting_changed_infobar_del egate.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/infobars/infobar_service.h" 8 #include "chrome/browser/infobars/infobar_service.h"
9 #include "content/public/browser/web_contents.h" 9 #include "content/public/browser/web_contents.h"
10 #include "grit/generated_resources.h" 10 #include "grit/generated_resources.h"
11 #include "grit/theme_resources.h" 11 #include "grit/theme_resources.h"
12 #include "ui/base/l10n/l10n_util.h" 12 #include "ui/base/l10n/l10n_util.h"
13 #include "ui/base/resource/resource_bundle.h"
14 13
15 // static 14 // static
16 void ContentSettingChangedInfoBarDelegate::Create( 15 void ContentSettingChangedInfoBarDelegate::Create(
17 InfoBarService* infobar_service, 16 InfoBarService* infobar_service,
18 int icon, 17 int icon,
19 int message_text) { 18 int message_text) {
20 infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>( 19 infobar_service->AddInfoBar(scoped_ptr<InfoBarDelegate>(
21 new ContentSettingChangedInfoBarDelegate(infobar_service, 20 new ContentSettingChangedInfoBarDelegate(infobar_service,
22 icon, 21 icon,
23 message_text))); 22 message_text)));
24 } 23 }
25 24
26 ContentSettingChangedInfoBarDelegate::ContentSettingChangedInfoBarDelegate( 25 ContentSettingChangedInfoBarDelegate::ContentSettingChangedInfoBarDelegate(
27 InfoBarService* infobar_service, 26 InfoBarService* infobar_service,
28 int icon, 27 int icon,
29 int message_text) 28 int message_text)
30 : ConfirmInfoBarDelegate(infobar_service), 29 : ConfirmInfoBarDelegate(infobar_service),
31 icon_(icon), 30 icon_(icon),
32 message_text_(message_text) { 31 message_text_(message_text) {
33 } 32 }
34 33
35 ContentSettingChangedInfoBarDelegate::~ContentSettingChangedInfoBarDelegate() { 34 ContentSettingChangedInfoBarDelegate::~ContentSettingChangedInfoBarDelegate() {
36 } 35 }
37 36
38 gfx::Image* ContentSettingChangedInfoBarDelegate::GetIcon() const { 37 int ContentSettingChangedInfoBarDelegate::GetIconID() const {
39 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed(icon_); 38 return icon_;
40 } 39 }
41 40
42 InfoBarDelegate::Type ContentSettingChangedInfoBarDelegate::GetInfoBarType() 41 InfoBarDelegate::Type ContentSettingChangedInfoBarDelegate::GetInfoBarType()
43 const { 42 const {
44 return PAGE_ACTION_TYPE; 43 return PAGE_ACTION_TYPE;
45 } 44 }
46 45
47 string16 ContentSettingChangedInfoBarDelegate::GetMessageText() const { 46 string16 ContentSettingChangedInfoBarDelegate::GetMessageText() const {
48 return l10n_util::GetStringUTF16(message_text_); 47 return l10n_util::GetStringUTF16(message_text_);
49 } 48 }
50 49
51 int ContentSettingChangedInfoBarDelegate::GetButtons() const { 50 int ContentSettingChangedInfoBarDelegate::GetButtons() const {
52 return BUTTON_OK; 51 return BUTTON_OK;
53 } 52 }
54 53
55 string16 ContentSettingChangedInfoBarDelegate::GetButtonLabel( 54 string16 ContentSettingChangedInfoBarDelegate::GetButtonLabel(
56 InfoBarButton button) const { 55 InfoBarButton button) const {
57 DCHECK_EQ(BUTTON_OK, button); 56 DCHECK_EQ(BUTTON_OK, button);
58 return l10n_util::GetStringUTF16(IDS_CONTENT_SETTING_CHANGED_INFOBAR_BUTTON); 57 return l10n_util::GetStringUTF16(IDS_CONTENT_SETTING_CHANGED_INFOBAR_BUTTON);
59 } 58 }
60 59
61 bool ContentSettingChangedInfoBarDelegate::Accept() { 60 bool ContentSettingChangedInfoBarDelegate::Accept() {
62 web_contents()->GetController().Reload(true); 61 web_contents()->GetController().Reload(true);
63 return true; 62 return true;
64 } 63 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698