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

Side by Side Diff: chrome/browser/webdata/token_service_table.cc

Issue 12518017: Generalize migration code in WebDatabase. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Pure merge of LKGR Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/webdata/token_service_table.h ('k') | chrome/browser/webdata/web_apps_table.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "chrome/browser/webdata/token_service_table.h" 5 #include "chrome/browser/webdata/token_service_table.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "chrome/browser/password_manager/encryptor.h" 11 #include "chrome/browser/password_manager/encryptor.h"
12 #include "sql/statement.h" 12 #include "sql/statement.h"
13 13
14 bool TokenServiceTable::Init() { 14 bool TokenServiceTable::Init() {
15 if (!db_->DoesTableExist("token_service")) { 15 if (!db_->DoesTableExist("token_service")) {
16 if (!db_->Execute("CREATE TABLE token_service (" 16 if (!db_->Execute("CREATE TABLE token_service ("
17 "service VARCHAR PRIMARY KEY NOT NULL," 17 "service VARCHAR PRIMARY KEY NOT NULL,"
18 "encrypted_token BLOB)")) { 18 "encrypted_token BLOB)")) {
19 NOTREACHED(); 19 NOTREACHED();
20 return false; 20 return false;
21 } 21 }
22 } 22 }
23 return true; 23 return true;
24 } 24 }
25 25
26 bool TokenServiceTable::IsSyncable() { 26 bool TokenServiceTable::IsSyncable() {
27 return true; 27 return true;
28 } 28 }
29 29
30 bool TokenServiceTable::MigrateToVersion(int version,
31 const std::string& app_locale,
32 bool* update_compatible_version) {
33 return true;
34 }
35
30 bool TokenServiceTable::RemoveAllTokens() { 36 bool TokenServiceTable::RemoveAllTokens() {
31 sql::Statement s(db_->GetUniqueStatement( 37 sql::Statement s(db_->GetUniqueStatement(
32 "DELETE FROM token_service")); 38 "DELETE FROM token_service"));
33 39
34 return s.Run(); 40 return s.Run();
35 } 41 }
36 42
37 bool TokenServiceTable::SetTokenForService(const std::string& service, 43 bool TokenServiceTable::SetTokenForService(const std::string& service,
38 const std::string& token) { 44 const std::string& token) {
39 std::string encrypted_token; 45 std::string encrypted_token;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 if (entry_ok) { 78 if (entry_ok) {
73 Encryptor::DecryptString(encrypted_token, &decrypted_token); 79 Encryptor::DecryptString(encrypted_token, &decrypted_token);
74 (*tokens)[service] = decrypted_token; 80 (*tokens)[service] = decrypted_token;
75 } else { 81 } else {
76 NOTREACHED(); 82 NOTREACHED();
77 return false; 83 return false;
78 } 84 }
79 } 85 }
80 return true; 86 return true;
81 } 87 }
OLDNEW
« no previous file with comments | « chrome/browser/webdata/token_service_table.h ('k') | chrome/browser/webdata/web_apps_table.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698