Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / signin / local_auth.h
blob570b5bc345a81e5ea9aeedc551fb9e183b7e1f96
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
3 // found in the LICENSE file.
4 //
5 // The local-auth module allows for user authentication in the case when
6 // on-line authentication is not possible (e.g. there is no network
7 // connection).
9 #ifndef CHROME_BROWSER_SIGNIN_LOCAL_AUTH_H_
10 #define CHROME_BROWSER_SIGNIN_LOCAL_AUTH_H_
12 #include <string>
14 #include "base/gtest_prod_util.h"
16 class LocalAuthTest;
17 class Profile;
19 namespace user_prefs {
20 class PrefRegistrySyncable;
23 class LocalAuth {
24 public:
25 static void RegisterLocalAuthPrefs(
26 user_prefs::PrefRegistrySyncable* registry);
28 static void SetLocalAuthCredentials(size_t profile_info_index,
29 const std::string& password);
32 static void SetLocalAuthCredentials(const Profile* profile,
33 const std::string& password);
35 static bool ValidateLocalAuthCredentials(size_t profile_info_index,
36 const std::string& password);
38 static bool ValidateLocalAuthCredentials(const Profile* profile,
39 const std::string& password);
41 private:
42 FRIEND_TEST_ALL_PREFIXES(LocalAuthTest, SetUpgradeAndCheckCredentials);
43 FRIEND_TEST_ALL_PREFIXES(LocalAuthTest, TruncateStringEvenly);
44 FRIEND_TEST_ALL_PREFIXES(LocalAuthTest, TruncateStringUnevenly);
46 // Return only the first |len_bits| bits of the string |str|. Defined here for
47 // testing.
48 static std::string TruncateStringByBits(const std::string& str,
49 const size_t len_bits);
51 static void SetLocalAuthCredentialsWithEncoding(size_t profile_info_index,
52 const std::string& password,
53 char encoding_version);
56 #endif // CHROME_BROWSER_SIGNIN_LOCAL_AUTH_H_