Chromium Code Reviews| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 51 namespace user_prefs { | 51 namespace user_prefs { |
| 52 class PrefRegistrySyncable; | 52 class PrefRegistrySyncable; |
| 53 } | 53 } |
| 54 | 54 |
| 55 // Callback to be invoked when the result of a permission request is known. | 55 // Callback to be invoked when the result of a permission request is known. |
| 56 typedef base::Callback<void(blink::WebNotificationPermission)> | 56 typedef base::Callback<void(blink::WebNotificationPermission)> |
| 57 NotificationPermissionCallback; | 57 NotificationPermissionCallback; |
| 58 | 58 |
| 59 // The DesktopNotificationService is an object, owned by the Profile, | 59 // The DesktopNotificationService is an object, owned by the Profile, |
| 60 // which provides the creation of desktop "toasts" to web pages and workers. | 60 // which provides the creation of desktop "toasts" to web pages and workers. |
| 61 class DesktopNotificationService | 61 class DesktopNotificationService : public PermissionContextBase |
| 62 : public PermissionContextBase, | 62 #if defined(ENABLE_EXTENSION) |
|
dewittj
2014/09/19 17:33:05
This should be ENABLE_EXTENSIONS
Jitu( very slow this week)
2014/09/22 05:49:44
Done.
| |
| 63 public extensions::ExtensionRegistryObserver { | 63 , |
| 64 public extensions::ExtensionRegistryObserver | |
|
stevenjb
2014/09/18 17:56:08
Ugh, this sort of #ifdef tends to be error prone.
Jun Mukai
2014/09/18 18:07:13
I am okay with this. Factoring-out the observer w
dewittj
2014/09/18 19:24:45
Seems to me that this is a temporary state of affa
| |
| 65 #endif | |
| 66 { | |
| 64 public: | 67 public: |
| 65 // Register profile-specific prefs of notifications. | 68 // Register profile-specific prefs of notifications. |
| 66 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* prefs); | 69 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* prefs); |
| 67 | 70 |
| 68 // Add a desktop notification. | 71 // Add a desktop notification. |
| 69 static std::string AddIconNotification(const GURL& origin_url, | 72 static std::string AddIconNotification(const GURL& origin_url, |
| 70 const base::string16& title, | 73 const base::string16& title, |
| 71 const base::string16& message, | 74 const base::string16& message, |
| 72 const gfx::Image& icon, | 75 const gfx::Image& icon, |
| 73 const base::string16& replace_id, | 76 const base::string16& replace_id, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 // Used as a callback once a permission has been decided to convert |allowed| | 126 // Used as a callback once a permission has been decided to convert |allowed| |
| 124 // to one of the blink::WebNotificationPermission values. | 127 // to one of the blink::WebNotificationPermission values. |
| 125 void OnNotificationPermissionRequested( | 128 void OnNotificationPermissionRequested( |
| 126 const base::Callback<void(blink::WebNotificationPermission)>& callback, | 129 const base::Callback<void(blink::WebNotificationPermission)>& callback, |
| 127 bool allowed); | 130 bool allowed); |
| 128 | 131 |
| 129 void FirePermissionLevelChangedEvent( | 132 void FirePermissionLevelChangedEvent( |
| 130 const message_center::NotifierId& notifier_id, | 133 const message_center::NotifierId& notifier_id, |
| 131 bool enabled); | 134 bool enabled); |
| 132 | 135 |
| 136 #if defined(ENABLED_EXTENSIONS) | |
|
dewittj
2014/09/19 17:33:05
This should be ENABLE_EXTENSIONS
Jitu( very slow this week)
2014/09/22 05:49:44
Done.
| |
| 133 // extensions::ExtensionRegistryObserver: | 137 // extensions::ExtensionRegistryObserver: |
| 134 virtual void OnExtensionUninstalled( | 138 virtual void OnExtensionUninstalled( |
| 135 content::BrowserContext* browser_context, | 139 content::BrowserContext* browser_context, |
| 136 const extensions::Extension* extension, | 140 const extensions::Extension* extension, |
| 137 extensions::UninstallReason reason) OVERRIDE; | 141 extensions::UninstallReason reason) OVERRIDE; |
| 142 #endif | |
| 138 | 143 |
| 139 // The profile which owns this object. | 144 // The profile which owns this object. |
| 140 Profile* profile_; | 145 Profile* profile_; |
| 141 | 146 |
| 142 // Prefs listener for disabled_extension_id. | 147 // Prefs listener for disabled_extension_id. |
| 143 StringListPrefMember disabled_extension_id_pref_; | 148 StringListPrefMember disabled_extension_id_pref_; |
| 144 | 149 |
| 145 // Prefs listener for disabled_system_component_id. | 150 // Prefs listener for disabled_system_component_id. |
| 146 StringListPrefMember disabled_system_component_id_pref_; | 151 StringListPrefMember disabled_system_component_id_pref_; |
| 147 | 152 |
| 148 // On-memory data for the availability of extensions. | 153 // On-memory data for the availability of extensions. |
| 149 std::set<std::string> disabled_extension_ids_; | 154 std::set<std::string> disabled_extension_ids_; |
| 150 | 155 |
| 151 // On-memory data for the availability of system_component. | 156 // On-memory data for the availability of system_component. |
| 152 std::set<std::string> disabled_system_component_ids_; | 157 std::set<std::string> disabled_system_component_ids_; |
| 153 | 158 |
| 159 #if defined(ENABLED_EXTENSIONS) | |
|
dewittj
2014/09/19 17:33:05
This should be ENABLE_EXTENSIONS
Jitu( very slow this week)
2014/09/22 05:49:44
Done.
| |
| 154 // An observer to listen when extension is uninstalled. | 160 // An observer to listen when extension is uninstalled. |
| 155 ScopedObserver<extensions::ExtensionRegistry, | 161 ScopedObserver<extensions::ExtensionRegistry, |
| 156 extensions::ExtensionRegistryObserver> | 162 extensions::ExtensionRegistryObserver> |
| 157 extension_registry_observer_; | 163 extension_registry_observer_; |
| 164 #endif | |
| 158 | 165 |
| 159 // Welcome Notification | 166 // Welcome Notification |
| 160 scoped_ptr<ExtensionWelcomeNotification> chrome_now_welcome_notification_; | 167 scoped_ptr<ExtensionWelcomeNotification> chrome_now_welcome_notification_; |
| 161 | 168 |
| 162 base::WeakPtrFactory<DesktopNotificationService> weak_factory_; | 169 base::WeakPtrFactory<DesktopNotificationService> weak_factory_; |
| 163 | 170 |
| 164 DISALLOW_COPY_AND_ASSIGN(DesktopNotificationService); | 171 DISALLOW_COPY_AND_ASSIGN(DesktopNotificationService); |
| 165 }; | 172 }; |
| 166 | 173 |
| 167 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ | 174 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ |
| OLD | NEW |