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/renderer/test_runner/notification_presenter.h

Issue 264003003: test_runner: Move everything else into content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
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_RENDERER_TEST_RUNNER_NOTIFICATION_PRESENTER_H_ 5 #ifndef CONTENT_SHELL_RENDERER_TEST_RUNNER_NOTIFICATION_PRESENTER_H_
6 #define CONTENT_SHELL_RENDERER_TEST_RUNNER_NOTIFICATION_PRESENTER_H_ 6 #define CONTENT_SHELL_RENDERER_TEST_RUNNER_NOTIFICATION_PRESENTER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "third_party/WebKit/public/web/WebNotification.h" 12 #include "third_party/WebKit/public/web/WebNotification.h"
13 #include "third_party/WebKit/public/web/WebNotificationPresenter.h" 13 #include "third_party/WebKit/public/web/WebNotificationPresenter.h"
14 14
15 namespace WebTestRunner { 15 namespace content {
16
16 class WebTestDelegate; 17 class WebTestDelegate;
17 }
18
19 namespace content {
20 18
21 // A class that implements WebNotificationPresenter for the TestRunner library. 19 // A class that implements WebNotificationPresenter for the TestRunner library.
22 class NotificationPresenter : public blink::WebNotificationPresenter { 20 class NotificationPresenter : public blink::WebNotificationPresenter {
23 public: 21 public:
24 NotificationPresenter(); 22 NotificationPresenter();
25 virtual ~NotificationPresenter(); 23 virtual ~NotificationPresenter();
26 24
27 // Called by the TestRunner to simulate a user granting permission. 25 // Called by the TestRunner to simulate a user granting permission.
28 void GrantPermission(const std::string& origin, bool permission_granted); 26 void GrantPermission(const std::string& origin, bool permission_granted);
29 27
30 // Called by the TestRunner to simulate a user clicking on a notification. 28 // Called by the TestRunner to simulate a user clicking on a notification.
31 bool SimulateClick(const std::string& title); 29 bool SimulateClick(const std::string& title);
32 30
33 // Called by the TestRunner to reset the presenter to an default state. 31 // Called by the TestRunner to reset the presenter to an default state.
34 void Reset(); 32 void Reset();
35 33
36 void set_delegate(WebTestRunner::WebTestDelegate* delegate) { 34 void set_delegate(WebTestDelegate* delegate) { delegate_ = delegate; }
37 delegate_ = delegate;
38 }
39 35
40 // blink::WebNotificationPresenter interface 36 // blink::WebNotificationPresenter interface
41 virtual bool show(const blink::WebNotification& notification); 37 virtual bool show(const blink::WebNotification& notification);
42 virtual void cancel(const blink::WebNotification& notification); 38 virtual void cancel(const blink::WebNotification& notification);
43 virtual void objectDestroyed(const blink::WebNotification& notification); 39 virtual void objectDestroyed(const blink::WebNotification& notification);
44 virtual Permission checkPermission( 40 virtual Permission checkPermission(
45 const blink::WebSecurityOrigin& security_origin); 41 const blink::WebSecurityOrigin& security_origin);
46 virtual void requestPermission( 42 virtual void requestPermission(
47 const blink::WebSecurityOrigin& security_origin, 43 const blink::WebSecurityOrigin& security_origin,
48 blink::WebNotificationPermissionCallback* callback); 44 blink::WebNotificationPermissionCallback* callback);
49 45
50 private: 46 private:
51 WebTestRunner::WebTestDelegate* delegate_; 47 WebTestDelegate* delegate_;
52 48
53 // Map of known origins and whether they are allowed to show notifications. 49 // Map of known origins and whether they are allowed to show notifications.
54 typedef std::map<std::string, bool> KnownOriginMap; 50 typedef std::map<std::string, bool> KnownOriginMap;
55 KnownOriginMap known_origins_; 51 KnownOriginMap known_origins_;
56 52
57 // Map of currently active notifications. 53 // Map of currently active notifications.
58 typedef std::map<std::string, blink::WebNotification> ActiveNotificationMap; 54 typedef std::map<std::string, blink::WebNotification> ActiveNotificationMap;
59 ActiveNotificationMap active_notifications_; 55 ActiveNotificationMap active_notifications_;
60 56
61 // Map of replacement identifiers to the titles of those notifications. 57 // Map of replacement identifiers to the titles of those notifications.
62 std::map<std::string, std::string> replacements_; 58 std::map<std::string, std::string> replacements_;
63 59
64 DISALLOW_COPY_AND_ASSIGN(NotificationPresenter); 60 DISALLOW_COPY_AND_ASSIGN(NotificationPresenter);
65 }; 61 };
66 62
67 } // namespace content 63 } // namespace content
68 64
69 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_NOTIFICATION_PRESENTER_H_ 65 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_NOTIFICATION_PRESENTER_H_
OLDNEW
« no previous file with comments | « content/shell/renderer/test_runner/gamepad_controller.cc ('k') | content/shell/renderer/test_runner/test_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698