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

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

Powered by Google App Engine
This is Rietveld 408576698