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

Side by Side Diff: chrome/browser/notifications/desktop_notification_service.h

Issue 582673002: Fixed Build breaks while notification is enabled and extension is disabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed the comments Created 6 years, 3 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 (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>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/callback_forward.h" 13 #include "base/callback_forward.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "base/prefs/pref_member.h" 17 #include "base/prefs/pref_member.h"
18 #include "base/scoped_observer.h" 18 #include "base/scoped_observer.h"
19 #include "base/strings/string16.h" 19 #include "base/strings/string16.h"
20 #include "chrome/browser/content_settings/content_settings_provider.h" 20 #include "chrome/browser/content_settings/content_settings_provider.h"
21 #include "chrome/browser/content_settings/permission_context_base.h" 21 #include "chrome/browser/content_settings/permission_context_base.h"
22 #include "chrome/browser/notifications/extension_welcome_notification.h" 22 #include "chrome/browser/notifications/extension_welcome_notification.h"
23 #include "components/content_settings/core/common/content_settings.h" 23 #include "components/content_settings/core/common/content_settings.h"
24 #include "components/keyed_service/core/keyed_service.h" 24 #include "components/keyed_service/core/keyed_service.h"
25 #include "extensions/browser/extension_registry_observer.h" 25 #include "extensions/browser/extension_registry_observer.h"
Jun Mukai 2014/09/22 06:00:25 I think you should exclude this line by ENABLE_EXT
26 #include "third_party/WebKit/public/platform/WebNotificationPermission.h" 26 #include "third_party/WebKit/public/platform/WebNotificationPermission.h"
27 #include "third_party/WebKit/public/web/WebTextDirection.h" 27 #include "third_party/WebKit/public/web/WebTextDirection.h"
28 #include "ui/message_center/notifier_settings.h" 28 #include "ui/message_center/notifier_settings.h"
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; 39 class RenderFrameHost;
40 struct ShowDesktopNotificationHostMsgParams; 40 struct ShowDesktopNotificationHostMsgParams;
41 } 41 }
42 42
43 namespace extensions { 43 namespace extensions {
44 class ExtensionRegistry; 44 class ExtensionRegistry;
Jun Mukai 2014/09/22 06:00:25 Also better to exclude this as well just for safet
45 } 45 }
46 46
47 namespace gfx { 47 namespace gfx {
48 class Image; 48 class Image;
49 } 49 }
50 50
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_EXTENSIONS)
63 public extensions::ExtensionRegistryObserver { 63 ,
64 public extensions::ExtensionRegistryObserver
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
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(ENABLE_EXTENSIONS)
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(ENABLE_EXTENSIONS)
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_
OLDNEW
« no previous file with comments | « chrome/browser/chrome_content_browser_client.cc ('k') | chrome/browser/notifications/desktop_notification_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698