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

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: rebase 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
« no previous file with comments | « no previous file | chrome/browser/notifications/desktop_notification_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "third_party/WebKit/public/platform/WebNotificationPermission.h" 23 #include "third_party/WebKit/public/platform/WebNotificationPermission.h"
25 #include "third_party/WebKit/public/web/WebTextDirection.h" 24 #include "third_party/WebKit/public/web/WebTextDirection.h"
26 #include "ui/message_center/notifier_settings.h" 25 #include "ui/message_center/notifier_settings.h"
27 #include "url/gurl.h" 26 #include "url/gurl.h"
28 27
29 #if defined(ENABLE_EXTENSIONS) 28 #if defined(ENABLE_EXTENSIONS)
30 #include "extensions/browser/extension_registry_observer.h" 29 #include "extensions/browser/extension_registry_observer.h"
31 #endif 30 #endif
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 base::Closure* cancel_callback); 100 base::Closure* cancel_callback);
102 101
103 // Returns true if the notifier with |notifier_id| is allowed to send 102 // Returns true if the notifier with |notifier_id| is allowed to send
104 // notifications. 103 // notifications.
105 bool IsNotifierEnabled(const message_center::NotifierId& notifier_id); 104 bool IsNotifierEnabled(const message_center::NotifierId& notifier_id);
106 105
107 // Updates the availability of the notifier. 106 // Updates the availability of the notifier.
108 void SetNotifierEnabled(const message_center::NotifierId& notifier_id, 107 void SetNotifierEnabled(const message_center::NotifierId& notifier_id,
109 bool enabled); 108 bool enabled);
110 109
111 // Adds in a the welcome notification if required for components built
112 // into Chrome that show notifications like Chrome Now.
113 void ShowWelcomeNotificationIfNecessary(const Notification& notification);
114
115 private: 110 private:
116 // Returns a display name for an origin in the process id, to be used in 111 // Returns a display name for an origin in the process id, to be used in
117 // permission infobar or on the frame of the notification toast. Different 112 // permission infobar or on the frame of the notification toast. Different
118 // from the origin itself when dealing with extensions. 113 // from the origin itself when dealing with extensions.
119 base::string16 DisplayNameForOriginInProcessId(const GURL& origin, 114 base::string16 DisplayNameForOriginInProcessId(const GURL& origin,
120 int process_id); 115 int process_id);
121 116
122 // Called when the string list pref has been changed. 117 // Called when the string list pref has been changed.
123 void OnStringListPrefChanged( 118 void OnStringListPrefChanged(
124 const char* pref_name, std::set<std::string>* ids_field); 119 const char* pref_name, std::set<std::string>* ids_field);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 // On-memory data for the availability of system_component. 159 // On-memory data for the availability of system_component.
165 std::set<std::string> disabled_system_component_ids_; 160 std::set<std::string> disabled_system_component_ids_;
166 161
167 #if defined(ENABLE_EXTENSIONS) 162 #if defined(ENABLE_EXTENSIONS)
168 // An observer to listen when extension is uninstalled. 163 // An observer to listen when extension is uninstalled.
169 ScopedObserver<extensions::ExtensionRegistry, 164 ScopedObserver<extensions::ExtensionRegistry,
170 extensions::ExtensionRegistryObserver> 165 extensions::ExtensionRegistryObserver>
171 extension_registry_observer_; 166 extension_registry_observer_;
172 #endif 167 #endif
173 168
174 // Welcome Notification
175 scoped_ptr<ExtensionWelcomeNotification> chrome_now_welcome_notification_;
176
177 base::WeakPtrFactory<DesktopNotificationService> weak_factory_; 169 base::WeakPtrFactory<DesktopNotificationService> weak_factory_;
178 170
179 DISALLOW_COPY_AND_ASSIGN(DesktopNotificationService); 171 DISALLOW_COPY_AND_ASSIGN(DesktopNotificationService);
180 }; 172 };
181 173
182 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ 174 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/notifications/desktop_notification_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698