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

Side by Side Diff: chrome/browser/notifications/desktop_notification_service.cc

Issue 15067008: [InfoBar] Add InfoBarDelegate::GetIconID() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Renaming back to GetIcon() 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) 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/notifications/desktop_notification_service.h" 5 #include "chrome/browser/notifications/desktop_notification_service.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/threading/thread.h" 8 #include "base/threading/thread.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 InfoBarService* infobar_service, 119 InfoBarService* infobar_service,
120 DesktopNotificationService* notification_service, 120 DesktopNotificationService* notification_service,
121 const GURL& origin, 121 const GURL& origin,
122 const string16& display_name, 122 const string16& display_name,
123 int process_id, 123 int process_id,
124 int route_id, 124 int route_id,
125 int callback_context); 125 int callback_context);
126 virtual ~NotificationPermissionInfoBarDelegate(); 126 virtual ~NotificationPermissionInfoBarDelegate();
127 127
128 // ConfirmInfoBarDelegate: 128 // ConfirmInfoBarDelegate:
129 virtual gfx::Image* GetIcon() const OVERRIDE; 129 virtual int GetIconID() const OVERRIDE;
130 virtual Type GetInfoBarType() const OVERRIDE; 130 virtual Type GetInfoBarType() const OVERRIDE;
131 virtual string16 GetMessageText() const OVERRIDE; 131 virtual string16 GetMessageText() const OVERRIDE;
132 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; 132 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
133 virtual bool Accept() OVERRIDE; 133 virtual bool Accept() OVERRIDE;
134 virtual bool Cancel() OVERRIDE; 134 virtual bool Cancel() OVERRIDE;
135 135
136 // The origin we are asking for permissions on. 136 // The origin we are asking for permissions on.
137 GURL origin_; 137 GURL origin_;
138 138
139 // The display name for the origin to be displayed. Will be different from 139 // The display name for the origin to be displayed. Will be different from
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 NotificationPermissionInfoBarDelegate:: 191 NotificationPermissionInfoBarDelegate::
192 ~NotificationPermissionInfoBarDelegate() { 192 ~NotificationPermissionInfoBarDelegate() {
193 if (!action_taken_) 193 if (!action_taken_)
194 UMA_HISTOGRAM_COUNTS("NotificationPermissionRequest.Ignored", 1); 194 UMA_HISTOGRAM_COUNTS("NotificationPermissionRequest.Ignored", 1);
195 195
196 RenderViewHost* host = RenderViewHost::FromID(process_id_, route_id_); 196 RenderViewHost* host = RenderViewHost::FromID(process_id_, route_id_);
197 if (host) 197 if (host)
198 host->DesktopNotificationPermissionRequestDone(callback_context_); 198 host->DesktopNotificationPermissionRequestDone(callback_context_);
199 } 199 }
200 200
201 gfx::Image* NotificationPermissionInfoBarDelegate::GetIcon() const { 201 int NotificationPermissionInfoBarDelegate::GetIconID() const {
202 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( 202 return IDR_INFOBAR_DESKTOP_NOTIFICATIONS;
203 IDR_INFOBAR_DESKTOP_NOTIFICATIONS);
204 } 203 }
205 204
206 InfoBarDelegate::Type 205 InfoBarDelegate::Type
207 NotificationPermissionInfoBarDelegate::GetInfoBarType() const { 206 NotificationPermissionInfoBarDelegate::GetInfoBarType() const {
208 return PAGE_ACTION_TYPE; 207 return PAGE_ACTION_TYPE;
209 } 208 }
210 209
211 string16 NotificationPermissionInfoBarDelegate::GetMessageText() const { 210 string16 NotificationPermissionInfoBarDelegate::GetMessageText() const {
212 return l10n_util::GetStringFUTF16(IDS_NOTIFICATION_PERMISSIONS, 211 return l10n_util::GetStringFUTF16(IDS_NOTIFICATION_PERMISSIONS,
213 display_name_); 212 display_name_);
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 630
632 if (setting == CONTENT_SETTING_ALLOW) 631 if (setting == CONTENT_SETTING_ALLOW)
633 return WebKit::WebNotificationPresenter::PermissionAllowed; 632 return WebKit::WebNotificationPresenter::PermissionAllowed;
634 if (setting == CONTENT_SETTING_BLOCK) 633 if (setting == CONTENT_SETTING_BLOCK)
635 return WebKit::WebNotificationPresenter::PermissionDenied; 634 return WebKit::WebNotificationPresenter::PermissionDenied;
636 if (setting == CONTENT_SETTING_ASK) 635 if (setting == CONTENT_SETTING_ASK)
637 return WebKit::WebNotificationPresenter::PermissionNotAllowed; 636 return WebKit::WebNotificationPresenter::PermissionNotAllowed;
638 NOTREACHED() << "Invalid notifications settings value: " << setting; 637 NOTREACHED() << "Invalid notifications settings value: " << setting;
639 return WebKit::WebNotificationPresenter::PermissionNotAllowed; 638 return WebKit::WebNotificationPresenter::PermissionNotAllowed;
640 } 639 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698