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

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

Issue 580093003: Factor Google Now welcome notifications out of DesktopNotificationService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/permission_context_base.h" 20 #include "chrome/browser/content_settings/permission_context_base.h"
21 #include "chrome/browser/notifications/extension_welcome_notification.h"
22 #include "components/content_settings/core/common/content_settings.h" 21 #include "components/content_settings/core/common/content_settings.h"
23 #include "components/keyed_service/core/keyed_service.h" 22 #include "components/keyed_service/core/keyed_service.h"
24 #include "extensions/browser/extension_registry_observer.h" 23 #include "extensions/browser/extension_registry_observer.h"
25 #include "third_party/WebKit/public/platform/WebNotificationPermission.h" 24 #include "third_party/WebKit/public/platform/WebNotificationPermission.h"
26 #include "third_party/WebKit/public/web/WebTextDirection.h" 25 #include "third_party/WebKit/public/web/WebTextDirection.h"
27 #include "ui/message_center/notifier_settings.h" 26 #include "ui/message_center/notifier_settings.h"
28 #include "url/gurl.h" 27 #include "url/gurl.h"
29 28
30 class Notification; 29 class Notification;
31 class NotificationDelegate; 30 class NotificationDelegate;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 base::Closure* cancel_callback); 92 base::Closure* cancel_callback);
94 93
95 // Returns true if the notifier with |notifier_id| is allowed to send 94 // Returns true if the notifier with |notifier_id| is allowed to send
96 // notifications. 95 // notifications.
97 bool IsNotifierEnabled(const message_center::NotifierId& notifier_id); 96 bool IsNotifierEnabled(const message_center::NotifierId& notifier_id);
98 97
99 // Updates the availability of the notifier. 98 // Updates the availability of the notifier.
100 void SetNotifierEnabled(const message_center::NotifierId& notifier_id, 99 void SetNotifierEnabled(const message_center::NotifierId& notifier_id,
101 bool enabled); 100 bool enabled);
102 101
103 // Adds in a the welcome notification if required for components built
104 // into Chrome that show notifications like Chrome Now.
105 void ShowWelcomeNotificationIfNecessary(const Notification& notification);
106
107 private: 102 private:
108 // Returns a display name for an origin in the process id, to be used in 103 // Returns a display name for an origin in the process id, to be used in
109 // permission infobar or on the frame of the notification toast. Different 104 // permission infobar or on the frame of the notification toast. Different
110 // from the origin itself when dealing with extensions. 105 // from the origin itself when dealing with extensions.
111 base::string16 DisplayNameForOriginInProcessId(const GURL& origin, 106 base::string16 DisplayNameForOriginInProcessId(const GURL& origin,
112 int process_id); 107 int process_id);
113 108
114 // Called when the string list pref has been changed. 109 // Called when the string list pref has been changed.
115 void OnStringListPrefChanged( 110 void OnStringListPrefChanged(
116 const char* pref_name, std::set<std::string>* ids_field); 111 const char* pref_name, std::set<std::string>* ids_field);
(...skipping 30 matching lines...) Expand all
147 std::set<std::string> disabled_extension_ids_; 142 std::set<std::string> disabled_extension_ids_;
148 143
149 // On-memory data for the availability of system_component. 144 // On-memory data for the availability of system_component.
150 std::set<std::string> disabled_system_component_ids_; 145 std::set<std::string> disabled_system_component_ids_;
151 146
152 // An observer to listen when extension is uninstalled. 147 // An observer to listen when extension is uninstalled.
153 ScopedObserver<extensions::ExtensionRegistry, 148 ScopedObserver<extensions::ExtensionRegistry,
154 extensions::ExtensionRegistryObserver> 149 extensions::ExtensionRegistryObserver>
155 extension_registry_observer_; 150 extension_registry_observer_;
156 151
157 // Welcome Notification
158 scoped_ptr<ExtensionWelcomeNotification> chrome_now_welcome_notification_;
159
160 base::WeakPtrFactory<DesktopNotificationService> weak_factory_; 152 base::WeakPtrFactory<DesktopNotificationService> weak_factory_;
161 153
162 DISALLOW_COPY_AND_ASSIGN(DesktopNotificationService); 154 DISALLOW_COPY_AND_ASSIGN(DesktopNotificationService);
163 }; 155 };
164 156
165 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ 157 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698