OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CHROME_BROWSER_CHROMEOS_EXTENSIONS_SCREENLOCK_PRIVATE_API_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_SCREENLOCK_PRIVATE_API_H_ |
6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_SCREENLOCK_PRIVATE_API_H_ | 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_SCREENLOCK_PRIVATE_API_H_ |
7 | 7 |
8 #include "chrome/browser/chromeos/login/login_display.h" | 8 #include "chrome/browser/chromeos/login/login_display.h" |
9 #include "chrome/browser/extensions/chrome_extension_function.h" | 9 #include "chrome/browser/extensions/chrome_extension_function.h" |
10 #include "chromeos/dbus/session_manager_client.h" | 10 #include "chromeos/dbus/session_manager_client.h" |
11 #include "extensions/browser/browser_context_keyed_api_factory.h" | 11 #include "extensions/browser/browser_context_keyed_api_factory.h" |
12 | 12 |
13 namespace gfx { | 13 namespace gfx { |
14 class Image; | 14 class Image; |
15 } | 15 } |
16 | 16 |
17 namespace extensions { | 17 namespace extensions { |
18 | 18 |
19 class ScreenlockPrivateGetLockedFunction : public ChromeAsyncExtensionFunction { | 19 class ScreenlockPrivateGetLockedFunction : public ChromeAsyncExtensionFunction { |
20 public: | 20 public: |
21 DECLARE_EXTENSION_FUNCTION("screenlockPrivate.getLocked", | 21 DECLARE_EXTENSION_FUNCTION("screenlockPrivate.getLocked", |
22 SCREENLOCKPRIVATE_GETLOCKED) | 22 SCREENLOCKPRIVATE_GETLOCKED) |
23 ScreenlockPrivateGetLockedFunction(); | 23 ScreenlockPrivateGetLockedFunction(); |
24 virtual bool RunImpl() OVERRIDE; | 24 virtual bool RunAsync() OVERRIDE; |
| 25 |
25 private: | 26 private: |
26 virtual ~ScreenlockPrivateGetLockedFunction(); | 27 virtual ~ScreenlockPrivateGetLockedFunction(); |
27 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateGetLockedFunction); | 28 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateGetLockedFunction); |
28 }; | 29 }; |
29 | 30 |
30 class ScreenlockPrivateSetLockedFunction : public ChromeAsyncExtensionFunction { | 31 class ScreenlockPrivateSetLockedFunction : public ChromeAsyncExtensionFunction { |
31 public: | 32 public: |
32 DECLARE_EXTENSION_FUNCTION("screenlockPrivate.setLocked", | 33 DECLARE_EXTENSION_FUNCTION("screenlockPrivate.setLocked", |
33 SCREENLOCKPRIVATE_SETLOCKED) | 34 SCREENLOCKPRIVATE_SETLOCKED) |
34 ScreenlockPrivateSetLockedFunction(); | 35 ScreenlockPrivateSetLockedFunction(); |
35 virtual bool RunImpl() OVERRIDE; | 36 virtual bool RunAsync() OVERRIDE; |
| 37 |
36 private: | 38 private: |
37 virtual ~ScreenlockPrivateSetLockedFunction(); | 39 virtual ~ScreenlockPrivateSetLockedFunction(); |
38 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateSetLockedFunction); | 40 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateSetLockedFunction); |
39 }; | 41 }; |
40 | 42 |
41 class ScreenlockPrivateShowMessageFunction | 43 class ScreenlockPrivateShowMessageFunction |
42 : public ChromeAsyncExtensionFunction { | 44 : public ChromeAsyncExtensionFunction { |
43 public: | 45 public: |
44 DECLARE_EXTENSION_FUNCTION("screenlockPrivate.showMessage", | 46 DECLARE_EXTENSION_FUNCTION("screenlockPrivate.showMessage", |
45 SCREENLOCKPRIVATE_SHOWMESSAGE) | 47 SCREENLOCKPRIVATE_SHOWMESSAGE) |
46 ScreenlockPrivateShowMessageFunction(); | 48 ScreenlockPrivateShowMessageFunction(); |
47 virtual bool RunImpl() OVERRIDE; | 49 virtual bool RunAsync() OVERRIDE; |
| 50 |
48 private: | 51 private: |
49 virtual ~ScreenlockPrivateShowMessageFunction(); | 52 virtual ~ScreenlockPrivateShowMessageFunction(); |
50 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateShowMessageFunction ); | 53 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateShowMessageFunction ); |
51 }; | 54 }; |
52 | 55 |
53 class ScreenlockPrivateShowButtonFunction | 56 class ScreenlockPrivateShowButtonFunction |
54 : public ChromeAsyncExtensionFunction { | 57 : public ChromeAsyncExtensionFunction { |
55 public: | 58 public: |
56 DECLARE_EXTENSION_FUNCTION("screenlockPrivate.showButton", | 59 DECLARE_EXTENSION_FUNCTION("screenlockPrivate.showButton", |
57 SCREENLOCKPRIVATE_SHOWBUTTON) | 60 SCREENLOCKPRIVATE_SHOWBUTTON) |
58 ScreenlockPrivateShowButtonFunction(); | 61 ScreenlockPrivateShowButtonFunction(); |
59 virtual bool RunImpl() OVERRIDE; | 62 virtual bool RunAsync() OVERRIDE; |
| 63 |
60 private: | 64 private: |
61 virtual ~ScreenlockPrivateShowButtonFunction(); | 65 virtual ~ScreenlockPrivateShowButtonFunction(); |
62 void OnImageLoaded(const gfx::Image& image); | 66 void OnImageLoaded(const gfx::Image& image); |
63 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateShowButtonFunction); | 67 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateShowButtonFunction); |
64 }; | 68 }; |
65 | 69 |
66 class ScreenlockPrivateHideButtonFunction | 70 class ScreenlockPrivateHideButtonFunction |
67 : public ChromeAsyncExtensionFunction { | 71 : public ChromeAsyncExtensionFunction { |
68 public: | 72 public: |
69 DECLARE_EXTENSION_FUNCTION("screenlockPrivate.hideButton", | 73 DECLARE_EXTENSION_FUNCTION("screenlockPrivate.hideButton", |
70 SCREENLOCKPRIVATE_HIDEBUTTON) | 74 SCREENLOCKPRIVATE_HIDEBUTTON) |
71 ScreenlockPrivateHideButtonFunction(); | 75 ScreenlockPrivateHideButtonFunction(); |
72 virtual bool RunImpl() OVERRIDE; | 76 virtual bool RunAsync() OVERRIDE; |
73 | 77 |
74 private: | 78 private: |
75 virtual ~ScreenlockPrivateHideButtonFunction(); | 79 virtual ~ScreenlockPrivateHideButtonFunction(); |
76 void OnImageLoaded(const gfx::Image& image); | 80 void OnImageLoaded(const gfx::Image& image); |
77 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateHideButtonFunction); | 81 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateHideButtonFunction); |
78 }; | 82 }; |
79 | 83 |
80 class ScreenlockPrivateSetAuthTypeFunction | 84 class ScreenlockPrivateSetAuthTypeFunction |
81 : public ChromeAsyncExtensionFunction { | 85 : public ChromeAsyncExtensionFunction { |
82 public: | 86 public: |
83 DECLARE_EXTENSION_FUNCTION("screenlockPrivate.setAuthType", | 87 DECLARE_EXTENSION_FUNCTION("screenlockPrivate.setAuthType", |
84 SCREENLOCKPRIVATE_SETAUTHTYPE) | 88 SCREENLOCKPRIVATE_SETAUTHTYPE) |
85 ScreenlockPrivateSetAuthTypeFunction(); | 89 ScreenlockPrivateSetAuthTypeFunction(); |
86 virtual bool RunImpl() OVERRIDE; | 90 virtual bool RunAsync() OVERRIDE; |
87 | 91 |
88 private: | 92 private: |
89 virtual ~ScreenlockPrivateSetAuthTypeFunction(); | 93 virtual ~ScreenlockPrivateSetAuthTypeFunction(); |
90 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateSetAuthTypeFunction); | 94 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateSetAuthTypeFunction); |
91 }; | 95 }; |
92 | 96 |
93 class ScreenlockPrivateGetAuthTypeFunction | 97 class ScreenlockPrivateGetAuthTypeFunction |
94 : public ChromeAsyncExtensionFunction { | 98 : public ChromeAsyncExtensionFunction { |
95 public: | 99 public: |
96 DECLARE_EXTENSION_FUNCTION("screenlockPrivate.getAuthType", | 100 DECLARE_EXTENSION_FUNCTION("screenlockPrivate.getAuthType", |
97 SCREENLOCKPRIVATE_GETAUTHTYPE) | 101 SCREENLOCKPRIVATE_GETAUTHTYPE) |
98 ScreenlockPrivateGetAuthTypeFunction(); | 102 ScreenlockPrivateGetAuthTypeFunction(); |
99 virtual bool RunImpl() OVERRIDE; | 103 virtual bool RunAsync() OVERRIDE; |
100 | 104 |
101 private: | 105 private: |
102 virtual ~ScreenlockPrivateGetAuthTypeFunction(); | 106 virtual ~ScreenlockPrivateGetAuthTypeFunction(); |
103 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateGetAuthTypeFunction); | 107 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateGetAuthTypeFunction); |
104 }; | 108 }; |
105 | 109 |
106 class ScreenlockPrivateAcceptAuthAttemptFunction | 110 class ScreenlockPrivateAcceptAuthAttemptFunction |
107 : public ChromeAsyncExtensionFunction { | 111 : public ChromeAsyncExtensionFunction { |
108 public: | 112 public: |
109 DECLARE_EXTENSION_FUNCTION("screenlockPrivate.acceptAuthAttempt", | 113 DECLARE_EXTENSION_FUNCTION("screenlockPrivate.acceptAuthAttempt", |
110 SCREENLOCKPRIVATE_ACCEPTAUTHATTEMPT) | 114 SCREENLOCKPRIVATE_ACCEPTAUTHATTEMPT) |
111 ScreenlockPrivateAcceptAuthAttemptFunction(); | 115 ScreenlockPrivateAcceptAuthAttemptFunction(); |
112 virtual bool RunImpl() OVERRIDE; | 116 virtual bool RunAsync() OVERRIDE; |
113 | 117 |
114 private: | 118 private: |
115 virtual ~ScreenlockPrivateAcceptAuthAttemptFunction(); | 119 virtual ~ScreenlockPrivateAcceptAuthAttemptFunction(); |
116 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateAcceptAuthAttemptFunction); | 120 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateAcceptAuthAttemptFunction); |
117 }; | 121 }; |
118 | 122 |
119 class ScreenlockPrivateEventRouter | 123 class ScreenlockPrivateEventRouter |
120 : public extensions::BrowserContextKeyedAPI, | 124 : public extensions::BrowserContextKeyedAPI, |
121 public chromeos::SessionManagerClient::Observer { | 125 public chromeos::SessionManagerClient::Observer { |
122 public: | 126 public: |
(...skipping 28 matching lines...) Expand all Loading... |
151 | 155 |
152 void DispatchEvent(const std::string& event_name, base::Value* arg); | 156 void DispatchEvent(const std::string& event_name, base::Value* arg); |
153 | 157 |
154 content::BrowserContext* browser_context_; | 158 content::BrowserContext* browser_context_; |
155 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateEventRouter); | 159 DISALLOW_COPY_AND_ASSIGN(ScreenlockPrivateEventRouter); |
156 }; | 160 }; |
157 | 161 |
158 } // namespace extensions | 162 } // namespace extensions |
159 | 163 |
160 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_SCREENLOCK_PRIVATE_API_H_ | 164 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_SCREENLOCK_PRIVATE_API_H_ |
OLD | NEW |