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

Side by Side Diff: content/shell/browser/layout_test/layout_test_notification_manager.h

Issue 622793002: Group the different permission related methods in the content api. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_NOTIFICATION_MANAGER_H_ 5 #ifndef CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_NOTIFICATION_MANAGER_H_
6 #define CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_NOTIFICATION_MANAGER_H_ 6 #define CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_NOTIFICATION_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "third_party/WebKit/public/platform/WebNotificationPermission.h" 11 #include "third_party/WebKit/public/platform/WebNotificationPermission.h"
12 #include "url/gurl.h" 12 #include "url/gurl.h"
13 13
14 namespace content { 14 namespace content {
15 15
16 // Responsible for tracking active notifications and allowed origins for the 16 // Responsible for tracking active notifications and allowed origins for the
17 // Web Notification API when running layout tests. The methods in this class 17 // Web Notification API when running layout tests. The methods in this class
18 // should only be used on the IO thread. 18 // should only be used on the IO thread.
19 class LayoutTestNotificationManager { 19 class LayoutTestNotificationManager {
20 public: 20 public:
21 LayoutTestNotificationManager(); 21 LayoutTestNotificationManager();
22 ~LayoutTestNotificationManager(); 22 ~LayoutTestNotificationManager();
23 23
24 // Checks whether |origin| has permission to display notifications in tests. 24 // Checks whether |origin| has permission to display notifications in tests.
25 blink::WebNotificationPermission CheckPermission( 25 blink::WebNotificationPermission CheckPermission(
26 const GURL& origin); 26 const GURL& origin);
27 27
28 // Requests permission for |origin| to display notifications in layout tests. 28 // Requests permission for |origin| to display notifications in layout tests.
29 void RequestPermission( 29 void RequestPermission(const GURL& origin,
30 const GURL& origin, 30 const base::Callback<void(bool)>& callback);
31 const base::Callback<void(blink::WebNotificationPermission)>& callback);
32 31
33 // Sets the permission to display notifications for |origin| to |permission|. 32 // Sets the permission to display notifications for |origin| to |permission|.
34 void SetPermission(const GURL& origin, 33 void SetPermission(const GURL& origin,
35 blink::WebNotificationPermission permission); 34 blink::WebNotificationPermission permission);
36 35
37 // Clears the currently granted permissions. 36 // Clears the currently granted permissions.
38 void ClearPermissions(); 37 void ClearPermissions();
39 38
40 private: 39 private:
41 typedef std::map<GURL, blink::WebNotificationPermission> 40 typedef std::map<GURL, blink::WebNotificationPermission>
42 NotificationPermissionMap; 41 NotificationPermissionMap;
43 NotificationPermissionMap permission_map_; 42 NotificationPermissionMap permission_map_;
44 43
45 DISALLOW_COPY_AND_ASSIGN(LayoutTestNotificationManager); 44 DISALLOW_COPY_AND_ASSIGN(LayoutTestNotificationManager);
46 }; 45 };
47 46
48 } // content 47 } // content
49 48
50 #endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_NOTIFICATION_MANAGER_H_ 49 #endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_NOTIFICATION_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698