OLD | NEW |
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 "chrome/browser/sync/glue/password_model_associator.h" | 5 #include "chrome/browser/sync/glue/password_model_associator.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/stl_util-inl.h" | 9 #include "base/stl_util-inl.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 << "might be running against an out-of-date server."; | 184 << "might be running against an out-of-date server."; |
185 return false; | 185 return false; |
186 } | 186 } |
187 | 187 |
188 // The sync model has user created nodes if the password folder has any | 188 // The sync model has user created nodes if the password folder has any |
189 // children. | 189 // children. |
190 *has_nodes = sync_api::kInvalidId != password_node.GetFirstChildId(); | 190 *has_nodes = sync_api::kInvalidId != password_node.GetFirstChildId(); |
191 return true; | 191 return true; |
192 } | 192 } |
193 | 193 |
194 bool PasswordModelAssociator::ChromeModelHasUserCreatedNodes(bool* has_nodes) { | |
195 DCHECK(has_nodes); | |
196 std::vector<webkit_glue::PasswordForm*> passwords; | |
197 if (!password_store_->FillAutofillableLogins(&passwords) || | |
198 !password_store_->FillBlacklistLogins(&passwords)) { | |
199 STLDeleteElements(&passwords); | |
200 LOG(ERROR) << "Could not get the password entries."; | |
201 return false; | |
202 } | |
203 | |
204 *has_nodes = !passwords.empty(); | |
205 STLDeleteElements(&passwords); | |
206 return true; | |
207 } | |
208 | |
209 void PasswordModelAssociator::AbortAssociation() { | 194 void PasswordModelAssociator::AbortAssociation() { |
210 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); | 195 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); |
211 AutoLock lock(abort_association_pending_lock_); | 196 AutoLock lock(abort_association_pending_lock_); |
212 abort_association_pending_ = true; | 197 abort_association_pending_ = true; |
213 } | 198 } |
214 | 199 |
215 bool PasswordModelAssociator::IsAbortPending() { | 200 bool PasswordModelAssociator::IsAbortPending() { |
216 AutoLock lock(abort_association_pending_lock_); | 201 AutoLock lock(abort_association_pending_lock_); |
217 return abort_association_pending_; | 202 return abort_association_pending_; |
218 } | 203 } |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
391 const std::string& password_element, | 376 const std::string& password_element, |
392 const std::string& signon_realm) { | 377 const std::string& signon_realm) { |
393 return EscapePath(origin_url) + "|" + | 378 return EscapePath(origin_url) + "|" + |
394 EscapePath(username_element) + "|" + | 379 EscapePath(username_element) + "|" + |
395 EscapePath(username_value) + "|" + | 380 EscapePath(username_value) + "|" + |
396 EscapePath(password_element) + "|" + | 381 EscapePath(password_element) + "|" + |
397 EscapePath(signon_realm); | 382 EscapePath(signon_realm); |
398 } | 383 } |
399 | 384 |
400 } // namespace browser_sync | 385 } // namespace browser_sync |
OLD | NEW |