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

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

Issue 661643002: Adds a context message of the security origin for web notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adds a bug reference. 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/notifications/desktop_notification_service.h" 5 #include "chrome/browser/notifications/desktop_notification_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/prefs/scoped_user_pref_update.h" 9 #include "base/prefs/scoped_user_pref_update.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 #endif 128 #endif
129 129
130 RequestPermission(web_contents, 130 RequestPermission(web_contents,
131 request_id, 131 request_id,
132 requesting_origin, 132 requesting_origin,
133 user_gesture, 133 user_gesture,
134 result_callback); 134 result_callback);
135 } 135 }
136 136
137 bool DesktopNotificationService::IsNotifierEnabled( 137 bool DesktopNotificationService::IsNotifierEnabled(
138 const NotifierId& notifier_id) { 138 const NotifierId& notifier_id) const {
139 switch (notifier_id.type) { 139 switch (notifier_id.type) {
140 case NotifierId::APPLICATION: 140 case NotifierId::APPLICATION:
141 return disabled_extension_ids_.find(notifier_id.id) == 141 return disabled_extension_ids_.find(notifier_id.id) ==
142 disabled_extension_ids_.end(); 142 disabled_extension_ids_.end();
143 case NotifierId::WEB_PAGE: 143 case NotifierId::WEB_PAGE:
144 return DesktopNotificationProfileUtil::GetContentSetting( 144 return DesktopNotificationProfileUtil::GetContentSetting(
145 profile_, notifier_id.url) == CONTENT_SETTING_ALLOW; 145 profile_, notifier_id.url) == CONTENT_SETTING_ALLOW;
146 case NotifierId::SYSTEM_COMPONENT: 146 case NotifierId::SYSTEM_COMPONENT:
147 #if defined(OS_CHROMEOS) 147 #if defined(OS_CHROMEOS)
148 return disabled_system_component_ids_.find(notifier_id.id) == 148 return disabled_system_component_ids_.find(notifier_id.id) ==
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 // Tell the IO thread that this extension's permission for notifications 266 // Tell the IO thread that this extension's permission for notifications
267 // has changed. 267 // has changed.
268 extensions::InfoMap* extension_info_map = 268 extensions::InfoMap* extension_info_map =
269 extensions::ExtensionSystem::Get(profile_)->info_map(); 269 extensions::ExtensionSystem::Get(profile_)->info_map();
270 BrowserThread::PostTask( 270 BrowserThread::PostTask(
271 BrowserThread::IO, FROM_HERE, 271 BrowserThread::IO, FROM_HERE,
272 base::Bind(&extensions::InfoMap::SetNotificationsDisabled, 272 base::Bind(&extensions::InfoMap::SetNotificationsDisabled,
273 extension_info_map, notifier_id.id, !enabled)); 273 extension_info_map, notifier_id.id, !enabled));
274 #endif 274 #endif
275 } 275 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698