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

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

Issue 2713083003: Use ContentSetting in chrome/ instead of PermissionStatus (Closed)
Patch Set: really fix build? Created 3 years, 9 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/notifier_state_tracker.h" 5 #include "chrome/browser/notifications/notifier_state_tracker.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 bool NotifierStateTracker::IsNotifierEnabled( 82 bool NotifierStateTracker::IsNotifierEnabled(
83 const NotifierId& notifier_id) const { 83 const NotifierId& notifier_id) const {
84 switch (notifier_id.type) { 84 switch (notifier_id.type) {
85 case NotifierId::APPLICATION: 85 case NotifierId::APPLICATION:
86 return disabled_extension_ids_.find(notifier_id.id) == 86 return disabled_extension_ids_.find(notifier_id.id) ==
87 disabled_extension_ids_.end(); 87 disabled_extension_ids_.end();
88 case NotifierId::WEB_PAGE: 88 case NotifierId::WEB_PAGE:
89 return PermissionManager::Get(profile_)->GetPermissionStatus( 89 return PermissionManager::Get(profile_)->GetPermissionStatus(
90 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, notifier_id.url, 90 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, notifier_id.url,
91 notifier_id.url) == blink::mojom::PermissionStatus::GRANTED; 91 notifier_id.url) == CONTENT_SETTING_ALLOW;
92 case NotifierId::SYSTEM_COMPONENT: 92 case NotifierId::SYSTEM_COMPONENT:
93 #if defined(OS_CHROMEOS) 93 #if defined(OS_CHROMEOS)
94 return disabled_system_component_ids_.find(notifier_id.id) == 94 return disabled_system_component_ids_.find(notifier_id.id) ==
95 disabled_system_component_ids_.end(); 95 disabled_system_component_ids_.end();
96 #else 96 #else
97 // We do not disable system component notifications. 97 // We do not disable system component notifications.
98 return true; 98 return true;
99 #endif 99 #endif
100 case NotifierId::ARC_APPLICATION: 100 case NotifierId::ARC_APPLICATION:
101 #if defined(OS_CHROMEOS) 101 #if defined(OS_CHROMEOS)
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 // Tell the IO thread that this extension's permission for notifications 200 // Tell the IO thread that this extension's permission for notifications
201 // has changed. 201 // has changed.
202 extensions::InfoMap* extension_info_map = 202 extensions::InfoMap* extension_info_map =
203 extensions::ExtensionSystem::Get(profile_)->info_map(); 203 extensions::ExtensionSystem::Get(profile_)->info_map();
204 content::BrowserThread::PostTask( 204 content::BrowserThread::PostTask(
205 content::BrowserThread::IO, FROM_HERE, 205 content::BrowserThread::IO, FROM_HERE,
206 base::Bind(&extensions::InfoMap::SetNotificationsDisabled, 206 base::Bind(&extensions::InfoMap::SetNotificationsDisabled,
207 extension_info_map, notifier_id.id, !enabled)); 207 extension_info_map, notifier_id.id, !enabled));
208 } 208 }
209 #endif 209 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698