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

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

Issue 1634933006: Use NotificationResources instead of a bare SkBitmap. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unit tests. Created 4 years, 10 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 "content/public/browser/platform_notification_service.h" 15 #include "content/public/browser/platform_notification_service.h"
16 #include "third_party/WebKit/public/platform/modules/notifications/WebNotificati onPermission.h" 16 #include "third_party/WebKit/public/platform/modules/notifications/WebNotificati onPermission.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 PlatformNotificationData; 23 struct PlatformNotificationData;
23 24
24 // Responsible for tracking active notifications and allowed origins for the 25 // Responsible for tracking active notifications and allowed origins for the
25 // Web Notification API when running layout tests. 26 // Web Notification API when running layout tests.
26 class LayoutTestNotificationManager : public PlatformNotificationService { 27 class LayoutTestNotificationManager : public PlatformNotificationService {
27 public: 28 public:
28 LayoutTestNotificationManager(); 29 LayoutTestNotificationManager();
29 ~LayoutTestNotificationManager() override; 30 ~LayoutTestNotificationManager() override;
30 31
31 // Simulates a click on the notification titled |title|. |action_index| 32 // Simulates a click on the notification titled |title|. |action_index|
32 // 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
33 // clicked. Must be called on the UI thread. 34 // clicked. Must be called on the UI thread.
34 void SimulateClick(const std::string& title, int action_index); 35 void SimulateClick(const std::string& title, int action_index);
35 36
36 // PlatformNotificationService implementation. 37 // PlatformNotificationService implementation.
37 blink::WebNotificationPermission CheckPermissionOnUIThread( 38 blink::WebNotificationPermission CheckPermissionOnUIThread(
38 BrowserContext* browser_context, 39 BrowserContext* browser_context,
39 const GURL& origin, 40 const GURL& origin,
40 int render_process_id) override; 41 int render_process_id) override;
41 blink::WebNotificationPermission CheckPermissionOnIOThread( 42 blink::WebNotificationPermission CheckPermissionOnIOThread(
42 ResourceContext* resource_context, 43 ResourceContext* resource_context,
43 const GURL& origin, 44 const GURL& origin,
44 int render_process_id) override; 45 int render_process_id) override;
45 void DisplayNotification(BrowserContext* browser_context, 46 void DisplayNotification(BrowserContext* browser_context,
46 const GURL& origin, 47 const GURL& origin,
47 const SkBitmap& icon,
48 const PlatformNotificationData& notification_data, 48 const PlatformNotificationData& notification_data,
49 const NotificationResources& notification_resources,
49 scoped_ptr<DesktopNotificationDelegate> delegate, 50 scoped_ptr<DesktopNotificationDelegate> delegate,
50 base::Closure* cancel_callback) override; 51 base::Closure* cancel_callback) override;
51 void DisplayPersistentNotification( 52 void DisplayPersistentNotification(
52 BrowserContext* browser_context, 53 BrowserContext* browser_context,
53 int64_t persistent_notification_id, 54 int64_t persistent_notification_id,
54 const GURL& origin, 55 const GURL& origin,
55 const SkBitmap& icon, 56 const PlatformNotificationData& notification_data,
56 const PlatformNotificationData& notification_data) override; 57 const NotificationResources& notification_resources) override;
57 void ClosePersistentNotification( 58 void ClosePersistentNotification(
58 BrowserContext* browser_context, 59 BrowserContext* browser_context,
59 int64_t persistent_notification_id) override; 60 int64_t persistent_notification_id) override;
60 bool GetDisplayedPersistentNotifications( 61 bool GetDisplayedPersistentNotifications(
61 BrowserContext* browser_context, 62 BrowserContext* browser_context,
62 std::set<std::string>* displayed_notifications) override; 63 std::set<std::string>* displayed_notifications) override;
63 64
64 private: 65 private:
65 // Structure to represent the information of a persistent notification. 66 // Structure to represent the information of a persistent notification.
66 struct PersistentNotification { 67 struct PersistentNotification {
(...skipping 21 matching lines...) Expand all
88 std::map<std::string, std::string> replacements_; 89 std::map<std::string, std::string> replacements_;
89 90
90 base::WeakPtrFactory<LayoutTestNotificationManager> weak_factory_; 91 base::WeakPtrFactory<LayoutTestNotificationManager> weak_factory_;
91 92
92 DISALLOW_COPY_AND_ASSIGN(LayoutTestNotificationManager); 93 DISALLOW_COPY_AND_ASSIGN(LayoutTestNotificationManager);
93 }; 94 };
94 95
95 } // content 96 } // content
96 97
97 #endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_NOTIFICATION_MANAGER_H_ 98 #endif // CONTENT_SHELL_BROWSER_LAYOUT_TEST_LAYOUT_TEST_NOTIFICATION_MANAGER_H_
OLDNEW
« no previous file with comments | « content/public/common/notification_resources.h ('k') | content/shell/browser/layout_test/layout_test_notification_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698