| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "components/sync/base/sync_prefs.h" | 5 #include "components/sync/base/sync_prefs.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/files/file_path.h" |
| 8 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/path_service.h" |
| 9 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/values.h" | 12 #include "base/values.h" |
| 11 #include "components/pref_registry/pref_registry_syncable.h" | 13 #include "components/pref_registry/pref_registry_syncable.h" |
| 12 #include "components/prefs/pref_service.h" | 14 #include "components/prefs/pref_service.h" |
| 13 #include "components/sync/base/pref_names.h" | 15 #include "components/sync/base/pref_names.h" |
| 14 | 16 |
| 15 namespace syncer { | 17 namespace syncer { |
| 16 | 18 |
| 17 SyncPrefObserver::~SyncPrefObserver() {} | 19 SyncPrefObserver::~SyncPrefObserver() {} |
| 18 | 20 |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 if (base::Base64Decode(encoded, &decoded)) { | 548 if (base::Base64Decode(encoded, &decoded)) { |
| 547 nigori_specifics->ParseFromString(decoded); | 549 nigori_specifics->ParseFromString(decoded); |
| 548 } | 550 } |
| 549 } | 551 } |
| 550 | 552 |
| 551 bool SyncPrefs::IsLocalSyncEnabled() const { | 553 bool SyncPrefs::IsLocalSyncEnabled() const { |
| 552 return pref_service_->GetBoolean(prefs::kEnableLocalSyncBackend); | 554 return pref_service_->GetBoolean(prefs::kEnableLocalSyncBackend); |
| 553 } | 555 } |
| 554 | 556 |
| 555 base::FilePath SyncPrefs::GetLocalSyncBackendDir() const { | 557 base::FilePath SyncPrefs::GetLocalSyncBackendDir() const { |
| 556 return pref_service_->GetFilePath(prefs::kLocalSyncBackendDir); | 558 base::FilePath local_sync_backend_folder = |
| 559 pref_service_->GetFilePath(prefs::kLocalSyncBackendDir); |
| 560 |
| 561 #if defined(OS_WIN) |
| 562 if (local_sync_backend_folder.empty()) { |
| 563 // TODO(pastarmovj): Add DIR_ROAMING_USER_DATA to PathService to simplify |
| 564 // this code and move the logic in its right place. See crbug/657810. |
| 565 CHECK( |
| 566 base::PathService::Get(base::DIR_APP_DATA, &local_sync_backend_folder)); |
| 567 local_sync_backend_folder = |
| 568 local_sync_backend_folder.Append(FILE_PATH_LITERAL("Chrome/User Data")); |
| 569 } |
| 570 #endif // defined(OS_WIN) |
| 571 return local_sync_backend_folder; |
| 557 } | 572 } |
| 558 | 573 |
| 559 } // namespace syncer | 574 } // namespace syncer |
| OLD | NEW |