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

Side by Side Diff: chrome/browser/chromeos/extensions/quick_unlock_private/quick_unlock_private_api.h

Issue 1968083004: Implement the private API for quick unlock. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Address comments Created 4 years, 6 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
(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 }
16
17 namespace extensions {
18
19 class QuickUnlockPrivateGetAvailableModesFunction
20 : public UIThreadExtensionFunction {
21 public:
22 QuickUnlockPrivateGetAvailableModesFunction();
23 DECLARE_EXTENSION_FUNCTION("quickUnlockPrivate.getAvailableModes",
24 QUICKUNLOCKPRIVATE_GETAVAILABLEMODES);
25
26 protected:
27 ~QuickUnlockPrivateGetAvailableModesFunction() override;
28
29 // ExtensionFunction overrides.
30 ResponseAction Run() override;
31
32 private:
33 ChromeExtensionFunctionDetails chrome_details_;
34
35 DISALLOW_COPY_AND_ASSIGN(QuickUnlockPrivateGetAvailableModesFunction);
36 };
37
38 class QuickUnlockPrivateGetActiveModesFunction
39 : public UIThreadExtensionFunction {
40 public:
41 QuickUnlockPrivateGetActiveModesFunction();
42 DECLARE_EXTENSION_FUNCTION("quickUnlockPrivate.getActiveModes",
43 QUICKUNLOCKPRIVATE_GETACTIVEMODES);
44
45 protected:
46 ~QuickUnlockPrivateGetActiveModesFunction() override;
47
48 // ExtensionFunction overrides.
49 ResponseAction Run() override;
50
51 private:
52 ChromeExtensionFunctionDetails chrome_details_;
53
54 DISALLOW_COPY_AND_ASSIGN(QuickUnlockPrivateGetActiveModesFunction);
55 };
56
57 class QuickUnlockPrivateSetModesFunction : public UIThreadExtensionFunction,
58 public chromeos::AuthStatusConsumer {
59 public:
60 using CreateAuthenticator =
61 chromeos::ExtendedAuthenticator* (*)(chromeos::AuthStatusConsumer*
62 auth_status_consumer);
63
64 QuickUnlockPrivateSetModesFunction();
65
66 // Use the given |allocator| to create an ExtendedAuthenticator instance. This
67 // lets tests intercept authentication calls.
68 static void SetCreateAuthenticatorForTesting(CreateAuthenticator allocator);
69
70 DECLARE_EXTENSION_FUNCTION("quickUnlockPrivate.setModes",
71 QUICKUNLOCKPRIVATE_SETMODES);
72
73 protected:
74 ~QuickUnlockPrivateSetModesFunction() override;
75
76 // ExtensionFunction overrides.
77 ResponseAction Run() override;
78
79 // AuthStatusConsumer overrides.
80 void OnAuthFailure(const chromeos::AuthFailure& error) override;
81 void OnAuthSuccess(const chromeos::UserContext& user_context) override;
82
83 void ApplyModeChange();
84
85 private:
86 ChromeExtensionFunctionDetails chrome_details_;
87 scoped_refptr<chromeos::ExtendedAuthenticator> extended_authenticator_;
88
89 DISALLOW_COPY_AND_ASSIGN(QuickUnlockPrivateSetModesFunction);
90 };
91
92 } // namespace extensions
93
94 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_QUICK_UNLOCK_PRIVATE_QUICK_UNLOCK_ PRIVATE_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698