| OLD | NEW |
| 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 #ifndef CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ |
| 6 #define CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ | 6 #define CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 #include "url/gurl.h" | 29 #include "url/gurl.h" |
| 30 | 30 |
| 31 class ContentSettingsPattern; | 31 class ContentSettingsPattern; |
| 32 class Notification; | 32 class Notification; |
| 33 class NotificationDelegate; | 33 class NotificationDelegate; |
| 34 class NotificationUIManager; | 34 class NotificationUIManager; |
| 35 class Profile; | 35 class Profile; |
| 36 | 36 |
| 37 namespace content { | 37 namespace content { |
| 38 class DesktopNotificationDelegate; | 38 class DesktopNotificationDelegate; |
| 39 class RenderFrameHost; | |
| 40 struct ShowDesktopNotificationHostMsgParams; | 39 struct ShowDesktopNotificationHostMsgParams; |
| 41 } | 40 } |
| 42 | 41 |
| 43 namespace extensions { | 42 namespace extensions { |
| 44 class ExtensionRegistry; | 43 class ExtensionRegistry; |
| 45 } | 44 } |
| 46 | 45 |
| 47 namespace gfx { | 46 namespace gfx { |
| 48 class Image; | 47 class Image; |
| 49 } | 48 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 content::WebContents* web_contents, | 82 content::WebContents* web_contents, |
| 84 const PermissionRequestID& request_id, | 83 const PermissionRequestID& request_id, |
| 85 const GURL& requesting_frame, | 84 const GURL& requesting_frame, |
| 86 bool user_gesture, | 85 bool user_gesture, |
| 87 const NotificationPermissionCallback& callback); | 86 const NotificationPermissionCallback& callback); |
| 88 | 87 |
| 89 // Show a desktop notification. If |cancel_callback| is non-null, it's set to | 88 // Show a desktop notification. If |cancel_callback| is non-null, it's set to |
| 90 // a callback which can be used to cancel the notification. | 89 // a callback which can be used to cancel the notification. |
| 91 void ShowDesktopNotification( | 90 void ShowDesktopNotification( |
| 92 const content::ShowDesktopNotificationHostMsgParams& params, | 91 const content::ShowDesktopNotificationHostMsgParams& params, |
| 93 content::RenderFrameHost* render_frame_host, | |
| 94 scoped_ptr<content::DesktopNotificationDelegate> delegate, | 92 scoped_ptr<content::DesktopNotificationDelegate> delegate, |
| 95 base::Closure* cancel_callback); | 93 base::Closure* cancel_callback); |
| 96 | 94 |
| 97 // Returns true if the notifier with |notifier_id| is allowed to send | 95 // Returns true if the notifier with |notifier_id| is allowed to send |
| 98 // notifications. | 96 // notifications. |
| 99 bool IsNotifierEnabled(const message_center::NotifierId& notifier_id); | 97 bool IsNotifierEnabled(const message_center::NotifierId& notifier_id); |
| 100 | 98 |
| 101 // Updates the availability of the notifier. | 99 // Updates the availability of the notifier. |
| 102 void SetNotifierEnabled(const message_center::NotifierId& notifier_id, | 100 void SetNotifierEnabled(const message_center::NotifierId& notifier_id, |
| 103 bool enabled); | 101 bool enabled); |
| 104 | 102 |
| 105 // Adds in a the welcome notification if required for components built | 103 // Adds in a the welcome notification if required for components built |
| 106 // into Chrome that show notifications like Chrome Now. | 104 // into Chrome that show notifications like Chrome Now. |
| 107 void ShowWelcomeNotificationIfNecessary(const Notification& notification); | 105 void ShowWelcomeNotificationIfNecessary(const Notification& notification); |
| 108 | 106 |
| 109 private: | 107 private: |
| 110 // Returns a display name for an origin in the process id, to be used in | 108 // Returns a display name for an origin, to be used in the permission request |
| 111 // permission infobar or on the frame of the notification toast. Different | 109 // or on the frame of the notification toast. Different from the origin itself |
| 112 // from the origin itself when dealing with extensions. | 110 // when dealing with extensions. |
| 113 base::string16 DisplayNameForOriginInProcessId(const GURL& origin, | 111 base::string16 DisplayNameForOrigin(const GURL& origin); |
| 114 int process_id); | |
| 115 | 112 |
| 116 // Called when the string list pref has been changed. | 113 // Called when the string list pref has been changed. |
| 117 void OnStringListPrefChanged( | 114 void OnStringListPrefChanged( |
| 118 const char* pref_name, std::set<std::string>* ids_field); | 115 const char* pref_name, std::set<std::string>* ids_field); |
| 119 | 116 |
| 120 // Called when the disabled_extension_id pref has been changed. | 117 // Called when the disabled_extension_id pref has been changed. |
| 121 void OnDisabledExtensionIdsChanged(); | 118 void OnDisabledExtensionIdsChanged(); |
| 122 | 119 |
| 123 // Used as a callback once a permission has been decided to convert |allowed| | 120 // Used as a callback once a permission has been decided to convert |allowed| |
| 124 // to one of the blink::WebNotificationPermission values. | 121 // to one of the blink::WebNotificationPermission values. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 155 |
| 159 // Welcome Notification | 156 // Welcome Notification |
| 160 scoped_ptr<ExtensionWelcomeNotification> chrome_now_welcome_notification_; | 157 scoped_ptr<ExtensionWelcomeNotification> chrome_now_welcome_notification_; |
| 161 | 158 |
| 162 base::WeakPtrFactory<DesktopNotificationService> weak_factory_; | 159 base::WeakPtrFactory<DesktopNotificationService> weak_factory_; |
| 163 | 160 |
| 164 DISALLOW_COPY_AND_ASSIGN(DesktopNotificationService); | 161 DISALLOW_COPY_AND_ASSIGN(DesktopNotificationService); |
| 165 }; | 162 }; |
| 166 | 163 |
| 167 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ | 164 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ |
| OLD | NEW |