| 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 #if defined(OS_WINDOWS) | 10 #include "build/build_config.h" |
| 11 |
| 12 #if defined(OS_WIN) |
| 11 #include <windows.h> | 13 #include <windows.h> |
| 12 #endif | 14 #endif |
| 13 | 15 |
| 14 #include <limits> | 16 #include <limits> |
| 15 #include <string> | 17 #include <string> |
| 16 #include <vector> | 18 #include <vector> |
| 17 | 19 |
| 18 #include "base/file_util.h" | 20 #include "base/file_util.h" |
| 19 #include "base/string_util.h" | 21 #include "base/string_util.h" |
| 20 #include "chrome/browser/sync/syncable/directory_manager.h" // For migration. | 22 #include "chrome/browser/sync/syncable/directory_manager.h" // For migration. |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 ExecOrDie(dbhandle.get(), "INSERT INTO db_version values ( ? )", | 173 ExecOrDie(dbhandle.get(), "INSERT INTO db_version values ( ? )", |
| 172 kCurrentDBVersion); | 174 kCurrentDBVersion); |
| 173 | 175 |
| 174 MakeSigninsTable(dbhandle.get()); | 176 MakeSigninsTable(dbhandle.get()); |
| 175 MakeCookiesTable(dbhandle.get()); | 177 MakeCookiesTable(dbhandle.get()); |
| 176 MakeSigninTypesTable(dbhandle.get()); | 178 MakeSigninTypesTable(dbhandle.get()); |
| 177 MakeClientIDTable(dbhandle.get()); | 179 MakeClientIDTable(dbhandle.get()); |
| 178 } | 180 } |
| 179 ExecOrDie(dbhandle.get(), "COMMIT TRANSACTION"); | 181 ExecOrDie(dbhandle.get(), "COMMIT TRANSACTION"); |
| 180 } | 182 } |
| 181 #ifdef OS_WINDOWS | 183 #ifdef OS_WIN |
| 182 // Do not index this file. Scanning can occur every time we close the file, | 184 // Do not index this file. Scanning can occur every time we close the file, |
| 183 // which causes long delays in SQLite's file locking. | 185 // which causes long delays in SQLite's file locking. |
| 184 const DWORD attrs = GetFileAttributes(settings_path.c_str()); | 186 const DWORD attrs = GetFileAttributes(settings_path.c_str()); |
| 185 const BOOL attrs_set = | 187 const BOOL attrs_set = |
| 186 SetFileAttributes(settings_path.c_str(), | 188 SetFileAttributes(settings_path.c_str(), |
| 187 attrs | FILE_ATTRIBUTE_NOT_CONTENT_INDEXED); | 189 attrs | FILE_ATTRIBUTE_NOT_CONTENT_INDEXED); |
| 188 #endif | 190 #endif |
| 189 return true; | 191 return true; |
| 190 } | 192 } |
| 191 | 193 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 ScopedStatement query(PrepareQuery(dbhandle.get(), | 343 ScopedStatement query(PrepareQuery(dbhandle.get(), |
| 342 "SELECT id FROM client_id")); | 344 "SELECT id FROM client_id")); |
| 343 int query_result = sqlite3_step(query.get()); | 345 int query_result = sqlite3_step(query.get()); |
| 344 string client_id; | 346 string client_id; |
| 345 if (query_result == SQLITE_ROW) | 347 if (query_result == SQLITE_ROW) |
| 346 GetColumn(query.get(), 0, &client_id); | 348 GetColumn(query.get(), 0, &client_id); |
| 347 return client_id; | 349 return client_id; |
| 348 } | 350 } |
| 349 | 351 |
| 350 } // namespace browser_sync | 352 } // namespace browser_sync |
| OLD | NEW |