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

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: 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) 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 InfoBarService* infobar_service, 111 InfoBarService* infobar_service,
112 DesktopNotificationService* notification_service, 112 DesktopNotificationService* notification_service,
113 const GURL& origin, 113 const GURL& origin,
114 const string16& display_name, 114 const string16& display_name,
115 int process_id, 115 int process_id,
116 int route_id, 116 int route_id,
117 int callback_context); 117 int callback_context);
118 virtual ~NotificationPermissionInfoBarDelegate(); 118 virtual ~NotificationPermissionInfoBarDelegate();
119 119
120 // ConfirmInfoBarDelegate: 120 // ConfirmInfoBarDelegate:
121 virtual gfx::Image* GetIcon() const OVERRIDE; 121 virtual int GetIconID() const OVERRIDE;
122 virtual Type GetInfoBarType() const OVERRIDE; 122 virtual Type GetInfoBarType() const OVERRIDE;
123 virtual string16 GetMessageText() const OVERRIDE; 123 virtual string16 GetMessageText() const OVERRIDE;
124 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; 124 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
125 virtual bool Accept() OVERRIDE; 125 virtual bool Accept() OVERRIDE;
126 virtual bool Cancel() OVERRIDE; 126 virtual bool Cancel() OVERRIDE;
127 127
128 // The origin we are asking for permissions on. 128 // The origin we are asking for permissions on.
129 GURL origin_; 129 GURL origin_;
130 130
131 // The display name for the origin to be displayed. Will be different from 131 // 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
183 NotificationPermissionInfoBarDelegate:: 183 NotificationPermissionInfoBarDelegate::
184 ~NotificationPermissionInfoBarDelegate() { 184 ~NotificationPermissionInfoBarDelegate() {
185 if (!action_taken_) 185 if (!action_taken_)
186 UMA_HISTOGRAM_COUNTS("NotificationPermissionRequest.Ignored", 1); 186 UMA_HISTOGRAM_COUNTS("NotificationPermissionRequest.Ignored", 1);
187 187
188 RenderViewHost* host = RenderViewHost::FromID(process_id_, route_id_); 188 RenderViewHost* host = RenderViewHost::FromID(process_id_, route_id_);
189 if (host) 189 if (host)
190 host->DesktopNotificationPermissionRequestDone(callback_context_); 190 host->DesktopNotificationPermissionRequestDone(callback_context_);
191 } 191 }
192 192
193 gfx::Image* NotificationPermissionInfoBarDelegate::GetIcon() const { 193 int NotificationPermissionInfoBarDelegate::GetIconID() const {
194 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( 194 return IDR_INFOBAR_DESKTOP_NOTIFICATIONS;
195 IDR_INFOBAR_DESKTOP_NOTIFICATIONS);
196 } 195 }
197 196
198 InfoBarDelegate::Type 197 InfoBarDelegate::Type
199 NotificationPermissionInfoBarDelegate::GetInfoBarType() const { 198 NotificationPermissionInfoBarDelegate::GetInfoBarType() const {
200 return PAGE_ACTION_TYPE; 199 return PAGE_ACTION_TYPE;
201 } 200 }
202 201
203 string16 NotificationPermissionInfoBarDelegate::GetMessageText() const { 202 string16 NotificationPermissionInfoBarDelegate::GetMessageText() const {
204 return l10n_util::GetStringFUTF16(IDS_NOTIFICATION_PERMISSIONS, 203 return l10n_util::GetStringFUTF16(IDS_NOTIFICATION_PERMISSIONS,
205 display_name_); 204 display_name_);
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 613
615 if (setting == CONTENT_SETTING_ALLOW) 614 if (setting == CONTENT_SETTING_ALLOW)
616 return WebKit::WebNotificationPresenter::PermissionAllowed; 615 return WebKit::WebNotificationPresenter::PermissionAllowed;
617 if (setting == CONTENT_SETTING_BLOCK) 616 if (setting == CONTENT_SETTING_BLOCK)
618 return WebKit::WebNotificationPresenter::PermissionDenied; 617 return WebKit::WebNotificationPresenter::PermissionDenied;
619 if (setting == CONTENT_SETTING_ASK) 618 if (setting == CONTENT_SETTING_ASK)
620 return WebKit::WebNotificationPresenter::PermissionNotAllowed; 619 return WebKit::WebNotificationPresenter::PermissionNotAllowed;
621 NOTREACHED() << "Invalid notifications settings value: " << setting; 620 NOTREACHED() << "Invalid notifications settings value: " << setting;
622 return WebKit::WebNotificationPresenter::PermissionNotAllowed; 621 return WebKit::WebNotificationPresenter::PermissionNotAllowed;
623 } 622 }
OLDNEW
« no previous file with comments | « chrome/browser/media/media_stream_infobar_delegate.cc ('k') | chrome/browser/omnibox_search_hint.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698