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 15 matching lines...) Expand all Loading... |
26 #include "chrome/browser/ui/browser.h" | 26 #include "chrome/browser/ui/browser.h" |
27 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
28 #include "chrome/grit/generated_resources.h" | 28 #include "chrome/grit/generated_resources.h" |
29 #include "components/content_settings/core/browser/host_content_settings_map.h" | 29 #include "components/content_settings/core/browser/host_content_settings_map.h" |
30 #include "components/content_settings/core/common/content_settings.h" | 30 #include "components/content_settings/core/common/content_settings.h" |
31 #include "components/content_settings/core/common/content_settings_types.h" | 31 #include "components/content_settings/core/common/content_settings_types.h" |
32 #include "components/prefs/pref_service.h" | 32 #include "components/prefs/pref_service.h" |
33 #include "content/public/browser/browser_thread.h" | 33 #include "content/public/browser/browser_thread.h" |
34 #include "content/public/browser/desktop_notification_delegate.h" | 34 #include "content/public/browser/desktop_notification_delegate.h" |
35 #include "content/public/browser/notification_event_dispatcher.h" | 35 #include "content/public/browser/notification_event_dispatcher.h" |
36 #include "content/public/browser/permission_type.h" | |
37 #include "content/public/browser/user_metrics.h" | 36 #include "content/public/browser/user_metrics.h" |
38 #include "content/public/common/notification_resources.h" | 37 #include "content/public/common/notification_resources.h" |
39 #include "content/public/common/platform_notification_data.h" | 38 #include "content/public/common/platform_notification_data.h" |
40 #include "extensions/features/features.h" | 39 #include "extensions/features/features.h" |
41 #include "third_party/skia/include/core/SkBitmap.h" | 40 #include "third_party/skia/include/core/SkBitmap.h" |
42 #include "ui/base/l10n/l10n_util.h" | 41 #include "ui/base/l10n/l10n_util.h" |
43 #include "ui/base/resource/resource_bundle.h" | 42 #include "ui/base/resource/resource_bundle.h" |
44 #include "ui/message_center/notification.h" | 43 #include "ui/message_center/notification.h" |
45 #include "ui/message_center/notification_types.h" | 44 #include "ui/message_center/notification_types.h" |
46 #include "ui/message_center/notifier_settings.h" | 45 #include "ui/message_center/notifier_settings.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 DCHECK(notifier_state_tracker); | 221 DCHECK(notifier_state_tracker); |
223 | 222 |
224 NotifierId notifier_id(NotifierId::APPLICATION, extension->id()); | 223 NotifierId notifier_id(NotifierId::APPLICATION, extension->id()); |
225 if (notifier_state_tracker->IsNotifierEnabled(notifier_id)) | 224 if (notifier_state_tracker->IsNotifierEnabled(notifier_id)) |
226 return blink::mojom::PermissionStatus::GRANTED; | 225 return blink::mojom::PermissionStatus::GRANTED; |
227 } | 226 } |
228 } | 227 } |
229 #endif | 228 #endif |
230 | 229 |
231 return PermissionManager::Get(profile)->GetPermissionStatus( | 230 return PermissionManager::Get(profile)->GetPermissionStatus( |
232 content::PermissionType::NOTIFICATIONS, origin, origin); | 231 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, origin, origin); |
233 } | 232 } |
234 | 233 |
235 blink::mojom::PermissionStatus | 234 blink::mojom::PermissionStatus |
236 PlatformNotificationServiceImpl::CheckPermissionOnIOThread( | 235 PlatformNotificationServiceImpl::CheckPermissionOnIOThread( |
237 content::ResourceContext* resource_context, | 236 content::ResourceContext* resource_context, |
238 const GURL& origin, | 237 const GURL& origin, |
239 int render_process_id) { | 238 int render_process_id) { |
240 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 239 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
241 | 240 |
242 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); | 241 ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 } | 518 } |
520 #endif | 519 #endif |
521 | 520 |
522 return base::string16(); | 521 return base::string16(); |
523 } | 522 } |
524 | 523 |
525 void PlatformNotificationServiceImpl::SetNotificationDisplayServiceForTesting( | 524 void PlatformNotificationServiceImpl::SetNotificationDisplayServiceForTesting( |
526 NotificationDisplayService* display_service) { | 525 NotificationDisplayService* display_service) { |
527 test_display_service_ = display_service; | 526 test_display_service_ = display_service; |
528 } | 527 } |
OLD | NEW |