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

Side by Side Diff: chrome/browser/sync/glue/sync_backend_host.cc

Issue 6543037: Merge 73754 - [SYNC] Fix handling of password store corruption.... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/648/src/
Patch Set: Created 9 years, 10 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 99
100 if (CommandLine::ForCurrentProcess()->HasSwitch( 100 if (CommandLine::ForCurrentProcess()->HasSwitch(
101 switches::kEnableSyncTypedUrls) || types.count(syncable::TYPED_URLS)) { 101 switches::kEnableSyncTypedUrls) || types.count(syncable::TYPED_URLS)) {
102 // TODO(tim): Bug 53916. HistoryModelWorker crashes, so avoid adding it 102 // TODO(tim): Bug 53916. HistoryModelWorker crashes, so avoid adding it
103 // unless specifically requested until bug is fixed. 103 // unless specifically requested until bug is fixed.
104 registrar_.workers[GROUP_HISTORY] = 104 registrar_.workers[GROUP_HISTORY] =
105 new HistoryModelWorker( 105 new HistoryModelWorker(
106 profile_->GetHistoryService(Profile::IMPLICIT_ACCESS)); 106 profile_->GetHistoryService(Profile::IMPLICIT_ACCESS));
107 } 107 }
108 108
109 // Any datatypes that we want the syncer to pull down must
110 // be in the routing_info map. We set them to group passive, meaning that
111 // updates will be applied, but not dispatched to the UI thread yet.
112 for (syncable::ModelTypeSet::const_iterator it = types.begin();
113 it != types.end(); ++it) {
114 registrar_.routing_info[(*it)] = GROUP_PASSIVE;
115 }
116
109 PasswordStore* password_store = 117 PasswordStore* password_store =
110 profile_->GetPasswordStore(Profile::IMPLICIT_ACCESS); 118 profile_->GetPasswordStore(Profile::IMPLICIT_ACCESS);
111 if (password_store) { 119 if (password_store) {
112 registrar_.workers[GROUP_PASSWORD] = 120 registrar_.workers[GROUP_PASSWORD] =
113 new PasswordModelWorker(password_store); 121 new PasswordModelWorker(password_store);
114 } else { 122 } else {
115 LOG(WARNING) << "Password store not initialized, cannot sync passwords"; 123 LOG(WARNING) << "Password store not initialized, cannot sync passwords";
116 } 124 registrar_.routing_info.erase(syncable::PASSWORDS);
117
118 // Any datatypes that we want the syncer to pull down must
119 // be in the routing_info map. We set them to group passive, meaning that
120 // updates will be applied, but not dispatched to the UI thread yet.
121 for (syncable::ModelTypeSet::const_iterator it = types.begin();
122 it != types.end(); ++it) {
123 registrar_.routing_info[(*it)] = GROUP_PASSIVE;
124 } 125 }
125 126
126 // TODO(tim): Remove this special case once NIGORI is populated by 127 // TODO(tim): Remove this special case once NIGORI is populated by
127 // default. We piggy back off of the passwords flag for now to not 128 // default. We piggy back off of the passwords flag for now to not
128 // require both encryption and passwords flags. 129 // require both encryption and passwords flags.
129 bool enable_encryption = !CommandLine::ForCurrentProcess()->HasSwitch( 130 bool enable_encryption = !CommandLine::ForCurrentProcess()->HasSwitch(
130 switches::kDisableSyncPasswords) || types.count(syncable::PASSWORDS); 131 switches::kDisableSyncPasswords) || types.count(syncable::PASSWORDS);
131 if (enable_encryption) 132 if (enable_encryption)
132 registrar_.routing_info[syncable::NIGORI] = GROUP_PASSIVE; 133 registrar_.routing_info[syncable::NIGORI] = GROUP_PASSIVE;
133 134
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 } 894 }
894 895
895 void SyncBackendHost::Core::DeleteSyncDataFolder() { 896 void SyncBackendHost::Core::DeleteSyncDataFolder() {
896 if (file_util::DirectoryExists(host_->sync_data_folder_path())) { 897 if (file_util::DirectoryExists(host_->sync_data_folder_path())) {
897 if (!file_util::Delete(host_->sync_data_folder_path(), true)) 898 if (!file_util::Delete(host_->sync_data_folder_path(), true))
898 LOG(DFATAL) << "Could not delete the Sync Data folder."; 899 LOG(DFATAL) << "Could not delete the Sync Data folder.";
899 } 900 }
900 } 901 }
901 902
902 } // namespace browser_sync 903 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698