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

Unified Diff: chrome/browser/sync/util/user_settings_posix.cc

Issue 8636020: Remove obsolete UserSettings class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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
« no previous file with comments | « chrome/browser/sync/util/user_settings.cc ('k') | chrome/browser/sync/util/user_settings_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/util/user_settings_posix.cc
diff --git a/chrome/browser/sync/util/user_settings_posix.cc b/chrome/browser/sync/util/user_settings_posix.cc
deleted file mode 100644
index 660c2823b88cdb33e79f3f02eaa28da0891d5712..0000000000000000000000000000000000000000
--- a/chrome/browser/sync/util/user_settings_posix.cc
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright (c) 2011 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.
-//
-// Implement the storage of service tokens in memory.
-
-#include "chrome/browser/sync/util/user_settings.h"
-
-#include "base/logging.h"
-#include "chrome/browser/password_manager/encryptor.h"
-#include "chrome/browser/sync/util/sqlite_utils.h"
-
-namespace browser_sync {
-
-void UserSettings::SetAuthTokenForService(
- const std::string& email,
- const std::string& service_name,
- const std::string& long_lived_service_token) {
-
- VLOG(1) << "Saving auth token " << long_lived_service_token
- << " for " << email << "for service " << service_name;
-
- std::string encrypted_service_token;
- if (!Encryptor::EncryptString(long_lived_service_token,
- &encrypted_service_token)) {
- LOG(ERROR) << "Encrytion failed: " << long_lived_service_token;
- return;
- }
- ScopedDBHandle dbhandle(this);
- sqlite_utils::SQLStatement statement;
- statement.prepare(dbhandle.get(),
- "INSERT INTO cookies "
- "(email, service_name, service_token) "
- "values (?, ?, ?)");
- statement.bind_string(0, email);
- statement.bind_string(1, service_name);
- statement.bind_blob(2, encrypted_service_token.data(),
- encrypted_service_token.size());
- if (SQLITE_DONE != statement.step()) {
- LOG(FATAL) << sqlite3_errmsg(dbhandle.get());
- }
-}
-
-bool UserSettings::GetLastUserAndServiceToken(const std::string& service_name,
- std::string* username,
- std::string* service_token) {
- ScopedDBHandle dbhandle(this);
- sqlite_utils::SQLStatement query;
- query.prepare(dbhandle.get(),
- "SELECT email, service_token FROM cookies"
- " WHERE service_name = ?");
- query.bind_string(0, service_name.c_str());
-
- if (SQLITE_ROW == query.step()) {
- std::string encrypted_service_token;
- query.column_blob_as_string(1, &encrypted_service_token);
- if (!Encryptor::DecryptString(encrypted_service_token, service_token)) {
- LOG(ERROR) << "Decryption failed: " << encrypted_service_token;
- return false;
- }
- *username = query.column_string(0);
-
- VLOG(1) << "Found service token for:" << *username << " @ " << service_name
- << " returning: " << *service_token;
-
- return true;
- }
-
- VLOG(1) << "Couldn't find service token for " << service_name;
-
- return false;
-}
-
-} // namespace browser_sync
« no previous file with comments | « chrome/browser/sync/util/user_settings.cc ('k') | chrome/browser/sync/util/user_settings_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698