OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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_QUICK_UNLOCK_PRIVATE_QUICK_UNLOCK_PRI VATE_API_H_ | 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_ | 6 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_QUICK_UNLOCK_PRIVATE_QUICK_UNLOCK_PRI VATE_API_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "chrome/browser/extensions/chrome_extension_function_details.h" | 10 #include "chrome/browser/extensions/chrome_extension_function_details.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
44 DECLARE_EXTENSION_FUNCTION("quickUnlockPrivate.getActiveModes", | 44 DECLARE_EXTENSION_FUNCTION("quickUnlockPrivate.getActiveModes", |
45 QUICKUNLOCKPRIVATE_GETACTIVEMODES); | 45 QUICKUNLOCKPRIVATE_GETACTIVEMODES); |
46 | 46 |
47 protected: | 47 protected: |
48 ~QuickUnlockPrivateGetActiveModesFunction() override; | 48 ~QuickUnlockPrivateGetActiveModesFunction() override; |
49 | 49 |
50 // ExtensionFunction overrides. | 50 // ExtensionFunction overrides. |
51 ResponseAction Run() override; | 51 ResponseAction Run() override; |
52 | 52 |
53 private: | 53 private: |
54 void OnGetActiveModes( | |
55 const std::vector<api::quick_unlock_private::QuickUnlockMode>& modes); | |
56 | |
54 ChromeExtensionFunctionDetails chrome_details_; | 57 ChromeExtensionFunctionDetails chrome_details_; |
55 | 58 |
56 DISALLOW_COPY_AND_ASSIGN(QuickUnlockPrivateGetActiveModesFunction); | 59 DISALLOW_COPY_AND_ASSIGN(QuickUnlockPrivateGetActiveModesFunction); |
57 }; | 60 }; |
58 | 61 |
59 class QuickUnlockPrivateCheckCredentialFunction | 62 class QuickUnlockPrivateCheckCredentialFunction |
60 : public UIThreadExtensionFunction { | 63 : public UIThreadExtensionFunction { |
61 public: | 64 public: |
62 QuickUnlockPrivateCheckCredentialFunction(); | 65 QuickUnlockPrivateCheckCredentialFunction(); |
63 DECLARE_EXTENSION_FUNCTION("quickUnlockPrivate.checkCredential", | 66 DECLARE_EXTENSION_FUNCTION("quickUnlockPrivate.checkCredential", |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
120 protected: | 123 protected: |
121 ~QuickUnlockPrivateSetModesFunction() override; | 124 ~QuickUnlockPrivateSetModesFunction() override; |
122 | 125 |
123 // ExtensionFunction overrides. | 126 // ExtensionFunction overrides. |
124 ResponseAction Run() override; | 127 ResponseAction Run() override; |
125 | 128 |
126 // AuthStatusConsumer overrides. | 129 // AuthStatusConsumer overrides. |
127 void OnAuthFailure(const chromeos::AuthFailure& error) override; | 130 void OnAuthFailure(const chromeos::AuthFailure& error) override; |
128 void OnAuthSuccess(const chromeos::UserContext& user_context) override; | 131 void OnAuthSuccess(const chromeos::UserContext& user_context) override; |
129 | 132 |
130 void ApplyModeChange(); | 133 // Continuation of OnAuthSuccess after active modes have been fetched. |
134 void OnGetActiveModesAfterAuthSuccess( | |
135 const chromeos::UserContext& user_context, | |
136 const std::vector<api::quick_unlock_private::QuickUnlockMode>& modes); | |
137 | |
138 // Apply any changes specified in |params_|. Returns the new active modes. | |
139 std::vector<api::quick_unlock_private::QuickUnlockMode> ApplyModeChange( | |
achuithb
2017/05/13 01:01:57
Is it worthwhile using a typedef for this?
jdufault
2017/06/06 18:17:06
Done.
| |
140 const chromeos::UserContext& user_context); | |
131 | 141 |
132 private: | 142 private: |
133 void FireEvent(const std::vector<QuickUnlockMode>& modes); | 143 void FireEvent(const std::vector<QuickUnlockMode>& modes); |
134 | 144 |
135 ChromeExtensionFunctionDetails chrome_details_; | 145 ChromeExtensionFunctionDetails chrome_details_; |
136 scoped_refptr<chromeos::ExtendedAuthenticator> extended_authenticator_; | 146 scoped_refptr<chromeos::ExtendedAuthenticator> extended_authenticator_; |
137 std::unique_ptr<api::quick_unlock_private::SetModes::Params> params_; | 147 std::unique_ptr<api::quick_unlock_private::SetModes::Params> params_; |
138 | 148 |
139 AuthenticatorAllocator authenticator_allocator_; | 149 AuthenticatorAllocator authenticator_allocator_; |
140 ModesChangedEventHandler modes_changed_handler_; | 150 ModesChangedEventHandler modes_changed_handler_; |
141 | 151 |
142 DISALLOW_COPY_AND_ASSIGN(QuickUnlockPrivateSetModesFunction); | 152 DISALLOW_COPY_AND_ASSIGN(QuickUnlockPrivateSetModesFunction); |
143 }; | 153 }; |
144 | 154 |
145 } // namespace extensions | 155 } // namespace extensions |
146 | 156 |
147 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_QUICK_UNLOCK_PRIVATE_QUICK_UNLOCK_ PRIVATE_API_H_ | 157 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_QUICK_UNLOCK_PRIVATE_QUICK_UNLOCK_ PRIVATE_API_H_ |
OLD | NEW |