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

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

Issue 661643002: Adds a context message of the security origin for web notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addresses comments and adds some unit tests. Created 6 years, 2 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>
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // Show a desktop notification. If |cancel_callback| is non-null, it's set to 94 // Show a desktop notification. If |cancel_callback| is non-null, it's set to
95 // a callback which can be used to cancel the notification. 95 // a callback which can be used to cancel the notification.
96 void ShowDesktopNotification( 96 void ShowDesktopNotification(
97 const content::ShowDesktopNotificationHostMsgParams& params, 97 const content::ShowDesktopNotificationHostMsgParams& params,
98 content::RenderFrameHost* render_frame_host, 98 content::RenderFrameHost* render_frame_host,
99 scoped_ptr<content::DesktopNotificationDelegate> delegate, 99 scoped_ptr<content::DesktopNotificationDelegate> delegate,
100 base::Closure* cancel_callback); 100 base::Closure* cancel_callback);
101 101
102 // 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
103 // notifications. 103 // notifications.
104 bool IsNotifierEnabled(const message_center::NotifierId& notifier_id); 104 bool IsNotifierEnabled(const message_center::NotifierId& notifier_id) const;
105 105
106 // Updates the availability of the notifier. 106 // Updates the availability of the notifier.
107 void SetNotifierEnabled(const message_center::NotifierId& notifier_id, 107 void SetNotifierEnabled(const message_center::NotifierId& notifier_id,
108 bool enabled); 108 bool enabled);
109 109
110 private: 110 private:
111 FRIEND_TEST_ALL_PREFIXES(DesktopNotificationServiceTest,
112 TestOriginDisplayName);
111 // Returns a display name for an origin in the process id, to be used in 113 // Returns a display name for an origin in the process id, to be used in
112 // permission infobar or on the frame of the notification toast. Different 114 // permission infobar or on the frame of the notification toast. Different
113 // from the origin itself when dealing with extensions. 115 // from the origin itself when dealing with extensions.
114 base::string16 DisplayNameForOriginInProcessId(const GURL& origin, 116 base::string16 DisplayNameForOriginInProcessId(const GURL& origin,
115 int process_id); 117 int process_id) const;
118
119 #if defined(ENABLE_EXTENSIONS)
120 bool ExtensionDisplayName(const GURL& origin,
121 int process_id,
122 base::string16* out) const;
123 #endif
124
125 static base::string16 OriginDisplayName(const GURL& origin,
126 std::string languages);
Peter Beverloo 2014/10/18 09:31:02 const std::string&
dewittj 2014/10/29 16:21:25 I don't think we want to return a string reference
116 127
117 // Called when the string list pref has been changed. 128 // Called when the string list pref has been changed.
118 void OnStringListPrefChanged( 129 void OnStringListPrefChanged(
119 const char* pref_name, std::set<std::string>* ids_field); 130 const char* pref_name, std::set<std::string>* ids_field);
120 131
121 // Called when the disabled_extension_id pref has been changed. 132 // Called when the disabled_extension_id pref has been changed.
122 void OnDisabledExtensionIdsChanged(); 133 void OnDisabledExtensionIdsChanged();
123 134
124 // Used as a callback once a permission has been decided to convert |allowed| 135 // Used as a callback once a permission has been decided to convert |allowed|
125 // to one of the blink::WebNotificationPermission values. 136 // to one of the blink::WebNotificationPermission values.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 extensions::ExtensionRegistryObserver> 176 extensions::ExtensionRegistryObserver>
166 extension_registry_observer_; 177 extension_registry_observer_;
167 #endif 178 #endif
168 179
169 base::WeakPtrFactory<DesktopNotificationService> weak_factory_; 180 base::WeakPtrFactory<DesktopNotificationService> weak_factory_;
170 181
171 DISALLOW_COPY_AND_ASSIGN(DesktopNotificationService); 182 DISALLOW_COPY_AND_ASSIGN(DesktopNotificationService);
172 }; 183 };
173 184
174 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ 185 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698