OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 entry. | 3 // found in the LICENSE entry. |
4 // | 4 // |
5 // This class isn't pretty. It's just a step better than globals, which is what | 5 // This class isn't pretty. It's just a step better than globals, which is what |
6 // these were previously. | 6 // these were previously. |
7 | 7 |
8 #include "chrome/browser/sync/util/user_settings.h" | 8 #include "chrome/browser/sync/util/user_settings.h" |
9 | 9 |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 // filename, so here we read the string, copy the file to the new name, | 81 // filename, so here we read the string, copy the file to the new name, |
82 // delete the old one, and then drop the unused shares table. | 82 // delete the old one, and then drop the unused shares table. |
83 ScopedStatement share_query(PrepareQuery(handle, | 83 ScopedStatement share_query(PrepareQuery(handle, |
84 "SELECT share_name, file_name FROM shares")); | 84 "SELECT share_name, file_name FROM shares")); |
85 int query_result = sqlite3_step(share_query.get()); | 85 int query_result = sqlite3_step(share_query.get()); |
86 CHECK(SQLITE_ROW == query_result); | 86 CHECK(SQLITE_ROW == query_result); |
87 PathString share_name, file_name; | 87 PathString share_name, file_name; |
88 GetColumn(share_query.get(), 0, &share_name); | 88 GetColumn(share_query.get(), 0, &share_name); |
89 GetColumn(share_query.get(), 1, &file_name); | 89 GetColumn(share_query.get(), 1, &file_name); |
90 | 90 |
91 if (!file_util::Move(file_name, | 91 if (!file_util::Move(FilePath(file_name), |
92 DirectoryManager::GetSyncDataDatabaseFilename())) { | 92 FilePath(DirectoryManager::GetSyncDataDatabaseFilename()))) { |
93 LOG(WARNING) << "Unable to upgrade UserSettings from v10"; | 93 LOG(WARNING) << "Unable to upgrade UserSettings from v10"; |
94 return; | 94 return; |
95 } | 95 } |
96 } | 96 } |
97 ExecOrDie(handle, "DROP TABLE shares"); | 97 ExecOrDie(handle, "DROP TABLE shares"); |
98 ExecOrDie(handle, "UPDATE db_version SET version = 11"); | 98 ExecOrDie(handle, "UPDATE db_version SET version = 11"); |
99 // FALL THROUGH | 99 // FALL THROUGH |
100 case kCurrentDBVersion: | 100 case kCurrentDBVersion: |
101 // Nothing to migrate. | 101 // Nothing to migrate. |
102 return; | 102 return; |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 ScopedStatement query(PrepareQuery(dbhandle.get(), | 343 ScopedStatement query(PrepareQuery(dbhandle.get(), |
344 "SELECT id FROM client_id")); | 344 "SELECT id FROM client_id")); |
345 int query_result = sqlite3_step(query.get()); | 345 int query_result = sqlite3_step(query.get()); |
346 string client_id; | 346 string client_id; |
347 if (query_result == SQLITE_ROW) | 347 if (query_result == SQLITE_ROW) |
348 GetColumn(query.get(), 0, &client_id); | 348 GetColumn(query.get(), 0, &client_id); |
349 return client_id; | 349 return client_id; |
350 } | 350 } |
351 | 351 |
352 } // namespace browser_sync | 352 } // namespace browser_sync |
OLD | NEW |