OLD | NEW |
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/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "content/public/browser/platform_notification_service.h" | 14 #include "content/public/browser/platform_notification_service.h" |
15 #include "third_party/WebKit/public/platform/modules/notifications/WebNotificati
onPermission.h" | 15 #include "third_party/WebKit/public/platform/modules/notifications/WebNotificati
onPermission.h" |
16 #include "url/gurl.h" | 16 #include "url/gurl.h" |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
20 class DesktopNotificationDelegate; | 20 class DesktopNotificationDelegate; |
21 struct PlatformNotificationData; | 21 struct PlatformNotificationData; |
22 | 22 |
23 // Responsible for tracking active notifications and allowed origins for the | 23 // Responsible for tracking active notifications and allowed origins for the |
24 // Web Notification API when running layout tests. | 24 // Web Notification API when running layout tests. |
25 class LayoutTestNotificationManager : public PlatformNotificationService { | 25 class LayoutTestNotificationManager : public PlatformNotificationService { |
26 public: | 26 public: |
27 LayoutTestNotificationManager(); | 27 LayoutTestNotificationManager(); |
28 ~LayoutTestNotificationManager() override; | 28 ~LayoutTestNotificationManager() override; |
29 | 29 |
30 // Simulates a click on the notification titled |title|. Must be called on the | 30 // Simulates a click on the notification titled |title|. |action_index| |
31 // UI thread. | 31 // indicates which action was clicked, or -1 if the main notification body was |
32 void SimulateClick(const std::string& title); | 32 // clicked. Must be called on the UI thread. |
| 33 void SimulateClick(const std::string& title, int action_index); |
33 | 34 |
34 // PlatformNotificationService implementation. | 35 // PlatformNotificationService implementation. |
35 blink::WebNotificationPermission CheckPermissionOnUIThread( | 36 blink::WebNotificationPermission CheckPermissionOnUIThread( |
36 BrowserContext* browser_context, | 37 BrowserContext* browser_context, |
37 const GURL& origin, | 38 const GURL& origin, |
38 int render_process_id) override; | 39 int render_process_id) override; |
39 blink::WebNotificationPermission CheckPermissionOnIOThread( | 40 blink::WebNotificationPermission CheckPermissionOnIOThread( |
40 ResourceContext* resource_context, | 41 ResourceContext* resource_context, |
41 const GURL& origin, | 42 const GURL& origin, |
42 int render_process_id) override; | 43 int render_process_id) override; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 std::map<std::string, std::string> replacements_; | 87 std::map<std::string, std::string> replacements_; |
87 | 88 |
88 base::WeakPtrFactory<LayoutTestNotificationManager> weak_factory_; | 89 base::WeakPtrFactory<LayoutTestNotificationManager> weak_factory_; |
89 | 90 |
90 DISALLOW_COPY_AND_ASSIGN(LayoutTestNotificationManager); | 91 DISALLOW_COPY_AND_ASSIGN(LayoutTestNotificationManager); |
91 }; | 92 }; |
92 | 93 |
93 } // content | 94 } // content |
94 | 95 |
95 #endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_NOTIFICATION_MANAGER_H_ | 96 #endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_NOTIFICATION_MANAGER_H_ |
OLD | NEW |