OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_QUICK_UNLOCK_PRIVATE_QUICK_UNLOCK_PRI VATE_API_H_ | |
6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_QUICK_UNLOCK_PRIVATE_QUICK_UNLOCK_PRI VATE_API_H_ | |
7 | |
8 #include "base/memory/ref_counted.h" | |
9 #include "chrome/browser/extensions/chrome_extension_function_details.h" | |
10 #include "chromeos/login/auth/auth_status_consumer.h" | |
11 #include "extensions/browser/extension_function.h" | |
12 | |
13 namespace chromeos { | |
14 class ExtendedAuthenticator; | |
15 } // namespace chromeos | |
achuithb
2016/05/20 23:50:21
don't think you need the comment
jdufault
2016/05/23 18:06:09
Done.
| |
16 | |
17 namespace extensions { | |
18 | |
19 // Implements the chrome.quickUnlockPrivate.checkPassword method. | |
20 class QuickUnlockPrivateCheckPasswordFunction | |
21 : public UIThreadExtensionFunction, | |
22 public chromeos::AuthStatusConsumer { | |
23 public: | |
24 // Override how the ExtendedAuthenticator is created. This allows tests to | |
25 // bypass the cryptohome calls. | |
26 using CreateAuthenticator = | |
27 chromeos::ExtendedAuthenticator* (*)(chromeos::AuthStatusConsumer* | |
achuithb
2016/05/20 23:50:21
why not base::Callback? I think that pattern is mo
jdufault
2016/05/23 18:06:09
base::Callback has a dtor so it cannot be have sta
| |
28 auth_status_consumer); | |
29 static void SetCreateAuthenticatorForTesting(CreateAuthenticator allocator); | |
30 | |
31 QuickUnlockPrivateCheckPasswordFunction(); | |
32 DECLARE_EXTENSION_FUNCTION("quickUnlockPrivate.checkPassword", | |
33 QUICKUNLOCKPRIVATE_CHECKPASSWORD); | |
34 | |
35 protected: | |
36 ~QuickUnlockPrivateCheckPasswordFunction() override; | |
37 | |
38 // ExtensionFunction overrides. | |
39 ResponseAction Run() override; | |
40 | |
41 // AuthStatusConsumer overrides. | |
42 void OnAuthFailure(const chromeos::AuthFailure& error) override; | |
43 void OnAuthSuccess(const chromeos::UserContext& user_context) override; | |
44 | |
45 private: | |
46 ChromeExtensionFunctionDetails chrome_details_; | |
47 scoped_refptr<chromeos::ExtendedAuthenticator> extended_authenticator_; | |
48 | |
49 DISALLOW_COPY_AND_ASSIGN(QuickUnlockPrivateCheckPasswordFunction); | |
50 }; | |
51 | |
52 // Implements the chrome.quickUnlockPrivate.setModes method. | |
53 class QuickUnlockPrivateSetModesFunction : public UIThreadExtensionFunction { | |
54 public: | |
55 QuickUnlockPrivateSetModesFunction(); | |
56 DECLARE_EXTENSION_FUNCTION("quickUnlockPrivate.setModes", | |
57 QUICKUNLOCKPRIVATE_SETMODES); | |
58 | |
59 protected: | |
60 ~QuickUnlockPrivateSetModesFunction() override; | |
61 | |
62 // ExtensionFunction overrides. | |
63 ResponseAction Run() override; | |
64 | |
65 private: | |
66 ChromeExtensionFunctionDetails chrome_details_; | |
67 | |
68 DISALLOW_COPY_AND_ASSIGN(QuickUnlockPrivateSetModesFunction); | |
69 }; | |
70 | |
71 // Implements the chrome.quickUnlockPrivate.getActiveModes method. | |
72 class QuickUnlockPrivateGetActiveModesFunction | |
73 : public UIThreadExtensionFunction { | |
74 public: | |
75 QuickUnlockPrivateGetActiveModesFunction(); | |
76 DECLARE_EXTENSION_FUNCTION("quickUnlockPrivate.getActiveModes", | |
77 QUICKUNLOCKPRIVATE_GETACTIVEMODES); | |
78 | |
79 protected: | |
80 ~QuickUnlockPrivateGetActiveModesFunction() override; | |
81 | |
82 // ExtensionFunction overrides. | |
83 ResponseAction Run() override; | |
84 | |
85 private: | |
86 ChromeExtensionFunctionDetails chrome_details_; | |
87 | |
88 DISALLOW_COPY_AND_ASSIGN(QuickUnlockPrivateGetActiveModesFunction); | |
89 }; | |
90 | |
91 // Implements the chrome.quickUnlockPrivate.getAvailableModes method. | |
92 class QuickUnlockPrivateGetAvailableModesFunction | |
93 : public UIThreadExtensionFunction { | |
94 public: | |
95 QuickUnlockPrivateGetAvailableModesFunction(); | |
96 DECLARE_EXTENSION_FUNCTION("quickUnlockPrivate.getAvailableModes", | |
97 QUICKUNLOCKPRIVATE_GETAVAILABLEMODES); | |
98 | |
99 protected: | |
100 ~QuickUnlockPrivateGetAvailableModesFunction() override; | |
101 | |
102 // ExtensionFunction overrides. | |
103 ResponseAction Run() override; | |
104 | |
105 private: | |
106 ChromeExtensionFunctionDetails chrome_details_; | |
107 | |
108 DISALLOW_COPY_AND_ASSIGN(QuickUnlockPrivateGetAvailableModesFunction); | |
109 }; | |
110 | |
111 } // namespace extensions | |
112 | |
113 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_QUICK_UNLOCK_PRIVATE_QUICK_UNLOCK_ PRIVATE_API_H_ | |
OLD | NEW |