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

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

Issue 6926001: Replace the virtual InfoBarDelegate::InfoBarClosed() function with a non-virtual one. This is a ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/google/google_url_tracker.cc ('k') | chrome/browser/omnibox_search_hint.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/content_settings/content_settings_provider.h" 10 #include "chrome/browser/content_settings/content_settings_provider.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 const GURL& origin, 95 const GURL& origin,
96 const string16& display_name, 96 const string16& display_name,
97 int process_id, 97 int process_id,
98 int route_id, 98 int route_id,
99 int callback_context); 99 int callback_context);
100 100
101 private: 101 private:
102 virtual ~NotificationPermissionInfoBarDelegate(); 102 virtual ~NotificationPermissionInfoBarDelegate();
103 103
104 // ConfirmInfoBarDelegate: 104 // ConfirmInfoBarDelegate:
105 virtual void InfoBarClosed(); 105 virtual gfx::Image* GetIcon() const OVERRIDE;
106 virtual gfx::Image* GetIcon() const; 106 virtual Type GetInfoBarType() const OVERRIDE;
107 virtual Type GetInfoBarType() const; 107 virtual string16 GetMessageText() const OVERRIDE;
108 virtual string16 GetMessageText() const; 108 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
109 virtual string16 GetButtonLabel(InfoBarButton button) const; 109 virtual bool Accept() OVERRIDE;
110 virtual bool Accept(); 110 virtual bool Cancel() OVERRIDE;
111 virtual bool Cancel();
112 111
113 // The origin we are asking for permissions on. 112 // The origin we are asking for permissions on.
114 GURL origin_; 113 GURL origin_;
115 114
116 // The display name for the origin to be displayed. Will be different from 115 // The display name for the origin to be displayed. Will be different from
117 // origin_ for extensions. 116 // origin_ for extensions.
118 string16 display_name_; 117 string16 display_name_;
119 118
120 // The Profile that we restore sessions from. 119 // The Profile that we restore sessions from.
121 Profile* profile_; 120 Profile* profile_;
(...skipping 22 matching lines...) Expand all
144 display_name_(display_name), 143 display_name_(display_name),
145 profile_(contents->profile()), 144 profile_(contents->profile()),
146 process_id_(process_id), 145 process_id_(process_id),
147 route_id_(route_id), 146 route_id_(route_id),
148 callback_context_(callback_context), 147 callback_context_(callback_context),
149 action_taken_(false) { 148 action_taken_(false) {
150 } 149 }
151 150
152 NotificationPermissionInfoBarDelegate:: 151 NotificationPermissionInfoBarDelegate::
153 ~NotificationPermissionInfoBarDelegate() { 152 ~NotificationPermissionInfoBarDelegate() {
154 }
155
156 void NotificationPermissionInfoBarDelegate::InfoBarClosed() {
157 if (!action_taken_) 153 if (!action_taken_)
158 UMA_HISTOGRAM_COUNTS("NotificationPermissionRequest.Ignored", 1); 154 UMA_HISTOGRAM_COUNTS("NotificationPermissionRequest.Ignored", 1);
159 155
160 RenderViewHost* host = RenderViewHost::FromID(process_id_, route_id_); 156 RenderViewHost* host = RenderViewHost::FromID(process_id_, route_id_);
161 if (host) { 157 if (host) {
162 host->Send(new DesktopNotificationMsg_PermissionRequestDone( 158 host->Send(new DesktopNotificationMsg_PermissionRequestDone(
163 route_id_, callback_context_)); 159 route_id_, callback_context_));
164 } 160 }
165
166 delete this;
167 } 161 }
168 162
169 gfx::Image* NotificationPermissionInfoBarDelegate::GetIcon() const { 163 gfx::Image* NotificationPermissionInfoBarDelegate::GetIcon() const {
170 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( 164 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed(
171 IDR_PRODUCT_ICON_32); 165 IDR_PRODUCT_ICON_32);
172 } 166 }
173 167
174 InfoBarDelegate::Type 168 InfoBarDelegate::Type
175 NotificationPermissionInfoBarDelegate::GetInfoBarType() const { 169 NotificationPermissionInfoBarDelegate::GetInfoBarType() const {
176 return PAGE_ACTION_TYPE; 170 return PAGE_ACTION_TYPE;
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 } 580 }
587 return UTF8ToUTF16(origin.host()); 581 return UTF8ToUTF16(origin.host());
588 } 582 }
589 583
590 void DesktopNotificationService::NotifySettingsChange() { 584 void DesktopNotificationService::NotifySettingsChange() {
591 NotificationService::current()->Notify( 585 NotificationService::current()->Notify(
592 NotificationType::DESKTOP_NOTIFICATION_SETTINGS_CHANGED, 586 NotificationType::DESKTOP_NOTIFICATION_SETTINGS_CHANGED,
593 Source<DesktopNotificationService>(this), 587 Source<DesktopNotificationService>(this),
594 NotificationService::NoDetails()); 588 NotificationService::NoDetails());
595 } 589 }
OLDNEW
« no previous file with comments | « chrome/browser/google/google_url_tracker.cc ('k') | chrome/browser/omnibox_search_hint.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698