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

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 peter's comments. Created 6 years, 1 month 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // Show a desktop notification. If |cancel_callback| is non-null, it's set to 90 // Show a desktop notification. If |cancel_callback| is non-null, it's set to
91 // a callback which can be used to cancel the notification. 91 // a callback which can be used to cancel the notification.
92 void ShowDesktopNotification( 92 void ShowDesktopNotification(
93 const content::ShowDesktopNotificationHostMsgParams& params, 93 const content::ShowDesktopNotificationHostMsgParams& params,
94 content::RenderFrameHost* render_frame_host, 94 content::RenderFrameHost* render_frame_host,
95 scoped_ptr<content::DesktopNotificationDelegate> delegate, 95 scoped_ptr<content::DesktopNotificationDelegate> delegate,
96 base::Closure* cancel_callback); 96 base::Closure* cancel_callback);
97 97
98 // Returns true if the notifier with |notifier_id| is allowed to send 98 // Returns true if the notifier with |notifier_id| is allowed to send
99 // notifications. 99 // notifications.
100 bool IsNotifierEnabled(const message_center::NotifierId& notifier_id); 100 bool IsNotifierEnabled(const message_center::NotifierId& notifier_id) const;
101 101
102 // Updates the availability of the notifier. 102 // Updates the availability of the notifier.
103 void SetNotifierEnabled(const message_center::NotifierId& notifier_id, 103 void SetNotifierEnabled(const message_center::NotifierId& notifier_id,
104 bool enabled); 104 bool enabled);
105 105
106 private: 106 private:
107 FRIEND_TEST_ALL_PREFIXES(DesktopNotificationServiceTest,
108 TestOriginDisplayName);
107 // Returns a display name for an origin in the process id, to be used in 109 // Returns a display name for an origin in the process id, to be used in
108 // permission infobar or on the frame of the notification toast. Different 110 // permission infobar or on the frame of the notification toast. Different
109 // from the origin itself when dealing with extensions. 111 // from the origin itself when dealing with extensions.
110 base::string16 DisplayNameForOriginInProcessId(const GURL& origin, 112 base::string16 DisplayNameForOriginInProcessId(const GURL& origin,
111 int process_id); 113 int process_id) const;
114
115 #if defined(ENABLE_EXTENSIONS)
116 bool ExtensionDisplayName(const GURL& origin,
117 int process_id,
118 base::string16* out) const;
119 #endif
120
121 static base::string16 OriginDisplayName(const GURL& origin,
122 std::string languages);
Peter Beverloo 2014/10/29 16:25:19 Sorry, I meant the |languages| argument, that can
dewittj 2014/11/03 17:18:32 Done.
112 123
113 // Called when the string list pref has been changed. 124 // Called when the string list pref has been changed.
114 void OnStringListPrefChanged( 125 void OnStringListPrefChanged(
115 const char* pref_name, std::set<std::string>* ids_field); 126 const char* pref_name, std::set<std::string>* ids_field);
116 127
117 // Called when the disabled_extension_id pref has been changed. 128 // Called when the disabled_extension_id pref has been changed.
118 void OnDisabledExtensionIdsChanged(); 129 void OnDisabledExtensionIdsChanged();
119 130
120 void FirePermissionLevelChangedEvent( 131 void FirePermissionLevelChangedEvent(
121 const message_center::NotifierId& notifier_id, 132 const message_center::NotifierId& notifier_id,
(...skipping 30 matching lines...) Expand all
152 // An observer to listen when extension is uninstalled. 163 // An observer to listen when extension is uninstalled.
153 ScopedObserver<extensions::ExtensionRegistry, 164 ScopedObserver<extensions::ExtensionRegistry,
154 extensions::ExtensionRegistryObserver> 165 extensions::ExtensionRegistryObserver>
155 extension_registry_observer_; 166 extension_registry_observer_;
156 #endif 167 #endif
157 168
158 DISALLOW_COPY_AND_ASSIGN(DesktopNotificationService); 169 DISALLOW_COPY_AND_ASSIGN(DesktopNotificationService);
159 }; 170 };
160 171
161 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_ 172 #endif // CHROME_BROWSER_NOTIFICATIONS_DESKTOP_NOTIFICATION_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698