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

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

Issue 6250135: [SYNC] Fix handling of password store corruption. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix tests. 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 104
105 if (CommandLine::ForCurrentProcess()->HasSwitch( 105 if (CommandLine::ForCurrentProcess()->HasSwitch(
106 switches::kEnableSyncTypedUrls) || types.count(syncable::TYPED_URLS)) { 106 switches::kEnableSyncTypedUrls) || types.count(syncable::TYPED_URLS)) {
107 // TODO(tim): Bug 53916. HistoryModelWorker crashes, so avoid adding it 107 // TODO(tim): Bug 53916. HistoryModelWorker crashes, so avoid adding it
108 // unless specifically requested until bug is fixed. 108 // unless specifically requested until bug is fixed.
109 registrar_.workers[GROUP_HISTORY] = 109 registrar_.workers[GROUP_HISTORY] =
110 new HistoryModelWorker( 110 new HistoryModelWorker(
111 profile_->GetHistoryService(Profile::IMPLICIT_ACCESS)); 111 profile_->GetHistoryService(Profile::IMPLICIT_ACCESS));
112 } 112 }
113 113
114 // Any datatypes that we want the syncer to pull down must
115 // be in the routing_info map. We set them to group passive, meaning that
116 // updates will be applied, but not dispatched to the UI thread yet.
117 for (syncable::ModelTypeSet::const_iterator it = types.begin();
118 it != types.end(); ++it) {
119 registrar_.routing_info[(*it)] = GROUP_PASSIVE;
120 }
121
114 PasswordStore* password_store = 122 PasswordStore* password_store =
115 profile_->GetPasswordStore(Profile::IMPLICIT_ACCESS); 123 profile_->GetPasswordStore(Profile::IMPLICIT_ACCESS);
116 if (password_store) { 124 if (password_store) {
117 registrar_.workers[GROUP_PASSWORD] = 125 registrar_.workers[GROUP_PASSWORD] =
118 new PasswordModelWorker(password_store); 126 new PasswordModelWorker(password_store);
119 } else { 127 } else {
120 LOG(WARNING) << "Password store not initialized, cannot sync passwords"; 128 LOG(WARNING) << "Password store not initialized, cannot sync passwords";
121 } 129 registrar_.routing_info.erase(syncable::PASSWORDS);
122
123 // Any datatypes that we want the syncer to pull down must
124 // be in the routing_info map. We set them to group passive, meaning that
125 // updates will be applied, but not dispatched to the UI thread yet.
126 for (syncable::ModelTypeSet::const_iterator it = types.begin();
127 it != types.end(); ++it) {
128 registrar_.routing_info[(*it)] = GROUP_PASSIVE;
129 } 130 }
130 131
131 // TODO(tim): Remove this special case once NIGORI is populated by 132 // TODO(tim): Remove this special case once NIGORI is populated by
132 // default. We piggy back off of the passwords flag for now to not 133 // default. We piggy back off of the passwords flag for now to not
133 // require both encryption and passwords flags. 134 // require both encryption and passwords flags.
134 bool enable_encryption = !CommandLine::ForCurrentProcess()->HasSwitch( 135 bool enable_encryption = !CommandLine::ForCurrentProcess()->HasSwitch(
135 switches::kDisableSyncPasswords) || types.count(syncable::PASSWORDS); 136 switches::kDisableSyncPasswords) || types.count(syncable::PASSWORDS);
136 if (enable_encryption) 137 if (enable_encryption)
137 registrar_.routing_info[syncable::NIGORI] = GROUP_PASSIVE; 138 registrar_.routing_info[syncable::NIGORI] = GROUP_PASSIVE;
138 139
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 } 1005 }
1005 1006
1006 void SyncBackendHost::Core::DoProcessMessage( 1007 void SyncBackendHost::Core::DoProcessMessage(
1007 const std::string& name, const JsArgList& args, 1008 const std::string& name, const JsArgList& args,
1008 const JsEventHandler* sender) { 1009 const JsEventHandler* sender) {
1009 DCHECK_EQ(MessageLoop::current(), host_->core_thread_.message_loop()); 1010 DCHECK_EQ(MessageLoop::current(), host_->core_thread_.message_loop());
1010 syncapi_->GetJsBackend()->ProcessMessage(name, args, sender); 1011 syncapi_->GetJsBackend()->ProcessMessage(name, args, sender);
1011 } 1012 }
1012 1013
1013 } // namespace browser_sync 1014 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698