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

Unified 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, 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/extensions/quick_unlock_private/quick_unlock_private_api.h
diff --git a/chrome/browser/chromeos/extensions/quick_unlock_private/quick_unlock_private_api.h b/chrome/browser/chromeos/extensions/quick_unlock_private/quick_unlock_private_api.h
new file mode 100644
index 0000000000000000000000000000000000000000..74e840032cde04dadb4f06a9fb793a27fe60846a
--- /dev/null
+++ b/chrome/browser/chromeos/extensions/quick_unlock_private/quick_unlock_private_api.h
@@ -0,0 +1,94 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_QUICK_UNLOCK_PRIVATE_QUICK_UNLOCK_PRIVATE_API_H_
+#define CHROME_BROWSER_CHROMEOS_EXTENSIONS_QUICK_UNLOCK_PRIVATE_QUICK_UNLOCK_PRIVATE_API_H_
+
+#include "base/memory/ref_counted.h"
+#include "chrome/browser/extensions/chrome_extension_function_details.h"
+#include "chromeos/login/auth/auth_status_consumer.h"
+#include "extensions/browser/extension_function.h"
+
+namespace chromeos {
+class ExtendedAuthenticator;
+}
+
+namespace extensions {
+
+class QuickUnlockPrivateGetAvailableModesFunction
+ : public UIThreadExtensionFunction {
+ public:
+ QuickUnlockPrivateGetAvailableModesFunction();
+ DECLARE_EXTENSION_FUNCTION("quickUnlockPrivate.getAvailableModes",
+ QUICKUNLOCKPRIVATE_GETAVAILABLEMODES);
+
+ protected:
+ ~QuickUnlockPrivateGetAvailableModesFunction() override;
+
+ // ExtensionFunction overrides.
+ ResponseAction Run() override;
+
+ private:
+ ChromeExtensionFunctionDetails chrome_details_;
+
+ DISALLOW_COPY_AND_ASSIGN(QuickUnlockPrivateGetAvailableModesFunction);
+};
+
+class QuickUnlockPrivateGetActiveModesFunction
+ : public UIThreadExtensionFunction {
+ public:
+ QuickUnlockPrivateGetActiveModesFunction();
+ DECLARE_EXTENSION_FUNCTION("quickUnlockPrivate.getActiveModes",
+ QUICKUNLOCKPRIVATE_GETACTIVEMODES);
+
+ protected:
+ ~QuickUnlockPrivateGetActiveModesFunction() override;
+
+ // ExtensionFunction overrides.
+ ResponseAction Run() override;
+
+ private:
+ ChromeExtensionFunctionDetails chrome_details_;
+
+ DISALLOW_COPY_AND_ASSIGN(QuickUnlockPrivateGetActiveModesFunction);
+};
+
+class QuickUnlockPrivateSetModesFunction : public UIThreadExtensionFunction,
+ public chromeos::AuthStatusConsumer {
+ public:
+ using CreateAuthenticator =
+ chromeos::ExtendedAuthenticator* (*)(chromeos::AuthStatusConsumer*
+ auth_status_consumer);
+
+ QuickUnlockPrivateSetModesFunction();
+
+ // Use the given |allocator| to create an ExtendedAuthenticator instance. This
+ // lets tests intercept authentication calls.
+ static void SetCreateAuthenticatorForTesting(CreateAuthenticator allocator);
+
+ DECLARE_EXTENSION_FUNCTION("quickUnlockPrivate.setModes",
+ QUICKUNLOCKPRIVATE_SETMODES);
+
+ protected:
+ ~QuickUnlockPrivateSetModesFunction() override;
+
+ // ExtensionFunction overrides.
+ ResponseAction Run() override;
+
+ // AuthStatusConsumer overrides.
+ void OnAuthFailure(const chromeos::AuthFailure& error) override;
+ void OnAuthSuccess(const chromeos::UserContext& user_context) override;
+
+ void ApplyModeChange();
+
+ private:
+ ChromeExtensionFunctionDetails chrome_details_;
+ scoped_refptr<chromeos::ExtendedAuthenticator> extended_authenticator_;
+
+ DISALLOW_COPY_AND_ASSIGN(QuickUnlockPrivateSetModesFunction);
+};
+
+} // namespace extensions
+
+#endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_QUICK_UNLOCK_PRIVATE_QUICK_UNLOCK_PRIVATE_API_H_

Powered by Google App Engine
This is Rietveld 408576698