| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_SYNC_UTIL_USER_SETTINGS_H_ | 5 #ifndef CHROME_BROWSER_SYNC_UTIL_USER_SETTINGS_H_ |
| 6 #define CHROME_BROWSER_SYNC_UTIL_USER_SETTINGS_H_ | 6 #define CHROME_BROWSER_SYNC_UTIL_USER_SETTINGS_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/file_path.h" |
| 12 #include "base/lock.h" | 13 #include "base/lock.h" |
| 13 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 14 #include "chrome/browser/sync/util/signin.h" | 15 #include "chrome/browser/sync/util/signin.h" |
| 15 #include "chrome/browser/sync/util/sync_types.h" | 16 #include "chrome/browser/sync/util/sync_types.h" |
| 16 | 17 |
| 17 extern "C" struct sqlite3; | 18 extern "C" struct sqlite3; |
| 18 | 19 |
| 19 namespace browser_sync { | 20 namespace browser_sync { |
| 20 | 21 |
| 21 class URLFactory; | 22 class URLFactory; |
| 22 | 23 |
| 23 class UserSettings { | 24 class UserSettings { |
| 24 public: | 25 public: |
| 25 // db_path is used for the main user settings. | 26 // db_path is used for the main user settings. |
| 26 // passwords_file contains hashes of passwords. | 27 // passwords_file contains hashes of passwords. |
| 27 UserSettings(); | 28 UserSettings(); |
| 28 ~UserSettings(); | 29 ~UserSettings(); |
| 29 // Returns false (failure) if the db is a newer version. | 30 // Returns false (failure) if the db is a newer version. |
| 30 bool Init(const PathString& settings_path); | 31 bool Init(const FilePath& settings_path); |
| 31 void StoreHashedPassword(const std::string& email, | 32 void StoreHashedPassword(const std::string& email, |
| 32 const std::string& password); | 33 const std::string& password); |
| 33 bool VerifyAgainstStoredHash(const std::string& email, | 34 bool VerifyAgainstStoredHash(const std::string& email, |
| 34 const std::string& password); | 35 const std::string& password); |
| 35 | 36 |
| 36 // Set the username. | 37 // Set the username. |
| 37 void SwitchUser(const std::string& email); | 38 void SwitchUser(const std::string& email); |
| 38 | 39 |
| 39 // Saves the email address and the named service token for the given user. | 40 // Saves the email address and the named service token for the given user. |
| 40 // Call this multiple times with the same email parameter to save multiple | 41 // Call this multiple times with the same email parameter to save multiple |
| (...skipping 11 matching lines...) Expand all Loading... |
| 52 // service token for the named service | 53 // service token for the named service |
| 53 bool GetLastUserAndServiceToken(const std::string& service_name, | 54 bool GetLastUserAndServiceToken(const std::string& service_name, |
| 54 std::string* username, | 55 std::string* username, |
| 55 std::string* service_token); | 56 std::string* service_token); |
| 56 | 57 |
| 57 void RememberSigninType(const std::string& signin, SignIn signin_type); | 58 void RememberSigninType(const std::string& signin, SignIn signin_type); |
| 58 SignIn RecallSigninType(const std::string& signin, SignIn default_type); | 59 SignIn RecallSigninType(const std::string& signin, SignIn default_type); |
| 59 | 60 |
| 60 void RemoveAllGuestSettings(); | 61 void RemoveAllGuestSettings(); |
| 61 | 62 |
| 62 void RemoveShare(const PathString& share_path); | |
| 63 | |
| 64 void StoreEmailForSignin(const std::string& signin, | 63 void StoreEmailForSignin(const std::string& signin, |
| 65 const std::string& primary_email); | 64 const std::string& primary_email); |
| 66 | 65 |
| 67 // Multiple email addresses can map to the same Google Account. This method | 66 // Multiple email addresses can map to the same Google Account. This method |
| 68 // returns the primary Google Account email associated with |signin|, which | 67 // returns the primary Google Account email associated with |signin|, which |
| 69 // is used as both input and output. | 68 // is used as both input and output. |
| 70 bool GetEmailForSignin(std::string* signin); | 69 bool GetEmailForSignin(std::string* signin); |
| 71 | 70 |
| 72 std::string email() const; | 71 std::string email() const; |
| 73 | 72 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 104 typedef std::map<std::string, std::string> ServiceTokenMap; | 103 typedef std::map<std::string, std::string> ServiceTokenMap; |
| 105 ServiceTokenMap service_tokens_; | 104 ServiceTokenMap service_tokens_; |
| 106 #endif // OS_WIN | 105 #endif // OS_WIN |
| 107 | 106 |
| 108 DISALLOW_COPY_AND_ASSIGN(UserSettings); | 107 DISALLOW_COPY_AND_ASSIGN(UserSettings); |
| 109 }; | 108 }; |
| 110 | 109 |
| 111 } // namespace browser_sync | 110 } // namespace browser_sync |
| 112 | 111 |
| 113 #endif // CHROME_BROWSER_SYNC_UTIL_USER_SETTINGS_H_ | 112 #endif // CHROME_BROWSER_SYNC_UTIL_USER_SETTINGS_H_ |
| OLD | NEW |