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

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

Issue 1942353002: (reland) Move permission.mojom from WebKit/public/platform/ to components/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 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 <stdint.h> 8 #include <stdint.h>
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
11 11
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "components/permissions/permission_status.mojom.h"
15 #include "content/public/browser/platform_notification_service.h" 16 #include "content/public/browser/platform_notification_service.h"
16 #include "third_party/WebKit/public/platform/modules/permissions/permission_stat us.mojom.h"
17 #include "url/gurl.h" 17 #include "url/gurl.h"
18 18
19 namespace content { 19 namespace content {
20 20
21 class DesktopNotificationDelegate; 21 class DesktopNotificationDelegate;
22 struct NotificationResources; 22 struct NotificationResources;
23 struct PlatformNotificationData; 23 struct PlatformNotificationData;
24 24
25 // Responsible for tracking active notifications and allowed origins for the 25 // Responsible for tracking active notifications and allowed origins for the
26 // Web Notification API when running layout tests. 26 // Web Notification API when running layout tests.
27 class LayoutTestNotificationManager : public PlatformNotificationService { 27 class LayoutTestNotificationManager : public PlatformNotificationService {
28 public: 28 public:
29 LayoutTestNotificationManager(); 29 LayoutTestNotificationManager();
30 ~LayoutTestNotificationManager() override; 30 ~LayoutTestNotificationManager() override;
31 31
32 // Simulates a click on the notification titled |title|. |action_index| 32 // Simulates a click on the notification titled |title|. |action_index|
33 // indicates which action was clicked, or -1 if the main notification body was 33 // indicates which action was clicked, or -1 if the main notification body was
34 // clicked. Must be called on the UI thread. 34 // clicked. Must be called on the UI thread.
35 void SimulateClick(const std::string& title, int action_index); 35 void SimulateClick(const std::string& title, int action_index);
36 36
37 // Simulates the closing a notification titled |title|. Must be called on 37 // Simulates the closing a notification titled |title|. Must be called on
38 // the UI thread. 38 // the UI thread.
39 void SimulateClose(const std::string& title, bool by_user); 39 void SimulateClose(const std::string& title, bool by_user);
40 40
41 // PlatformNotificationService implementation. 41 // PlatformNotificationService implementation.
42 blink::mojom::PermissionStatus CheckPermissionOnUIThread( 42 permissions::mojom::PermissionStatus CheckPermissionOnUIThread(
43 BrowserContext* browser_context, 43 BrowserContext* browser_context,
44 const GURL& origin, 44 const GURL& origin,
45 int render_process_id) override; 45 int render_process_id) override;
46 blink::mojom::PermissionStatus CheckPermissionOnIOThread( 46 permissions::mojom::PermissionStatus CheckPermissionOnIOThread(
47 ResourceContext* resource_context, 47 ResourceContext* resource_context,
48 const GURL& origin, 48 const GURL& origin,
49 int render_process_id) override; 49 int render_process_id) override;
50 void DisplayNotification( 50 void DisplayNotification(
51 BrowserContext* browser_context, 51 BrowserContext* browser_context,
52 const GURL& origin, 52 const GURL& origin,
53 const PlatformNotificationData& notification_data, 53 const PlatformNotificationData& notification_data,
54 const NotificationResources& notification_resources, 54 const NotificationResources& notification_resources,
55 std::unique_ptr<DesktopNotificationDelegate> delegate, 55 std::unique_ptr<DesktopNotificationDelegate> delegate,
56 base::Closure* cancel_callback) override; 56 base::Closure* cancel_callback) override;
(...skipping 22 matching lines...) Expand all
79 void Close(const std::string& title); 79 void Close(const std::string& title);
80 80
81 // Fakes replacing the notification identified by |params| when it has a tag 81 // Fakes replacing the notification identified by |params| when it has a tag
82 // and a previous notification has been displayed using the same tag. All 82 // and a previous notification has been displayed using the same tag. All
83 // notifications, both page and persistent ones, will be considered for this. 83 // notifications, both page and persistent ones, will be considered for this.
84 void ReplaceNotificationIfNeeded( 84 void ReplaceNotificationIfNeeded(
85 const PlatformNotificationData& notification_data); 85 const PlatformNotificationData& notification_data);
86 86
87 // Checks if |origin| has permission to display notifications. May be called 87 // Checks if |origin| has permission to display notifications. May be called
88 // on both the IO and the UI threads. 88 // on both the IO and the UI threads.
89 blink::mojom::PermissionStatus CheckPermission(const GURL& origin); 89 permissions::mojom::PermissionStatus CheckPermission(const GURL& origin);
90 90
91 std::map<std::string, DesktopNotificationDelegate*> page_notifications_; 91 std::map<std::string, DesktopNotificationDelegate*> page_notifications_;
92 std::map<std::string, PersistentNotification> persistent_notifications_; 92 std::map<std::string, PersistentNotification> persistent_notifications_;
93 93
94 std::map<std::string, std::string> replacements_; 94 std::map<std::string, std::string> replacements_;
95 95
96 base::WeakPtrFactory<LayoutTestNotificationManager> weak_factory_; 96 base::WeakPtrFactory<LayoutTestNotificationManager> weak_factory_;
97 97
98 DISALLOW_COPY_AND_ASSIGN(LayoutTestNotificationManager); 98 DISALLOW_COPY_AND_ASSIGN(LayoutTestNotificationManager);
99 }; 99 };
100 100
101 } // content 101 } // content
102 102
103 #endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_NOTIFICATION_MANAGER_H_ 103 #endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_NOTIFICATION_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698