Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/platform_notification_service_impl.h" | 5 #include "chrome/browser/notifications/platform_notification_service_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 220 NotifierStateTrackerFactory::GetForProfile(profile); | 220 NotifierStateTrackerFactory::GetForProfile(profile); |
| 221 DCHECK(notifier_state_tracker); | 221 DCHECK(notifier_state_tracker); |
| 222 | 222 |
| 223 NotifierId notifier_id(NotifierId::APPLICATION, extension->id()); | 223 NotifierId notifier_id(NotifierId::APPLICATION, extension->id()); |
| 224 if (notifier_state_tracker->IsNotifierEnabled(notifier_id)) | 224 if (notifier_state_tracker->IsNotifierEnabled(notifier_id)) |
| 225 return blink::mojom::PermissionStatus::GRANTED; | 225 return blink::mojom::PermissionStatus::GRANTED; |
| 226 } | 226 } |
| 227 } | 227 } |
| 228 #endif | 228 #endif |
| 229 | 229 |
| 230 return PermissionManager::Get(profile)->GetPermissionStatus( | 230 ContentSetting setting = PermissionManager::Get(profile)->GetPermissionStatus( |
| 231 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, origin, origin); | 231 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, origin, origin); |
| 232 if (setting == CONTENT_SETTING_ALLOW) | |
| 233 return blink::mojom::PermissionStatus::GRANTED; | |
| 234 if (setting == CONTENT_SETTING_ASK) | |
| 235 return blink::mojom::PermissionStatus::ASK; | |
| 236 DCHECK_EQ(setting, CONTENT_SETTING_BLOCK); | |
|
raymes
2017/02/28 01:37:34
nit: swap the param order
Timothy Loh
2017/02/28 04:02:46
Done.
| |
| 237 return blink::mojom::PermissionStatus::DENIED; | |
| 232 } | 238 } |
| 233 | 239 |
| 234 blink::mojom::PermissionStatus | 240 blink::mojom::PermissionStatus |
| 235 PlatformNotificationServiceImpl::CheckPermissionOnIOThread( | 241 PlatformNotificationServiceImpl::CheckPermissionOnIOThread( |
| 236 content::ResourceContext* resource_context, | 242 content::ResourceContext* resource_context, |
| 237 const GURL& origin, | 243 const GURL& origin, |
| 238 int render_process_id) { | 244 int render_process_id) { |
| 239 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 245 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 240 | 246 |
| 241 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); | 247 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 512 } | 518 } |
| 513 #endif | 519 #endif |
| 514 | 520 |
| 515 return base::string16(); | 521 return base::string16(); |
| 516 } | 522 } |
| 517 | 523 |
| 518 void PlatformNotificationServiceImpl::SetNotificationDisplayServiceForTesting( | 524 void PlatformNotificationServiceImpl::SetNotificationDisplayServiceForTesting( |
| 519 NotificationDisplayService* display_service) { | 525 NotificationDisplayService* display_service) { |
| 520 test_display_service_ = display_service; | 526 test_display_service_ = display_service; |
| 521 } | 527 } |
| OLD | NEW |