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

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

Issue 2770003: Changed syncable::PASSWORD to syncable::PASSWORDS for consistency (Closed)
Patch Set: Created 10 years, 6 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
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 "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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 PasswordVector new_passwords; 68 PasswordVector new_passwords;
69 PasswordVector updated_passwords; 69 PasswordVector updated_passwords;
70 70
71 for (std::vector<webkit_glue::PasswordForm*>::iterator ix = passwords.begin(); 71 for (std::vector<webkit_glue::PasswordForm*>::iterator ix = passwords.begin();
72 ix != passwords.end(); ++ix) { 72 ix != passwords.end(); ++ix) {
73 if (IsAbortPending()) 73 if (IsAbortPending())
74 return false; 74 return false;
75 std::string tag = MakeTag(**ix); 75 std::string tag = MakeTag(**ix);
76 76
77 sync_api::ReadNode node(&trans); 77 sync_api::ReadNode node(&trans);
78 if (node.InitByClientTagLookup(syncable::PASSWORD, tag)) { 78 if (node.InitByClientTagLookup(syncable::PASSWORDS, tag)) {
79 sync_pb::PasswordSpecificsData password; 79 sync_pb::PasswordSpecificsData password;
80 if (!node.GetPasswordSpecifics(&password)) { 80 if (!node.GetPasswordSpecifics(&password)) {
81 STLDeleteElements(&passwords); 81 STLDeleteElements(&passwords);
82 LOG(ERROR) << "Failed to get password specifics from sync node."; 82 LOG(ERROR) << "Failed to get password specifics from sync node.";
83 return false; 83 return false;
84 } 84 }
85 DCHECK_EQ(tag, MakeTag(password)); 85 DCHECK_EQ(tag, MakeTag(password));
86 86
87 webkit_glue::PasswordForm new_password; 87 webkit_glue::PasswordForm new_password;
88 88
89 if (MergePasswords(password, **ix, &new_password)) { 89 if (MergePasswords(password, **ix, &new_password)) {
90 sync_api::WriteNode write_node(&trans); 90 sync_api::WriteNode write_node(&trans);
91 if (!write_node.InitByClientTagLookup(syncable::PASSWORD, tag)) { 91 if (!write_node.InitByClientTagLookup(syncable::PASSWORDS, tag)) {
92 STLDeleteElements(&passwords); 92 STLDeleteElements(&passwords);
93 LOG(ERROR) << "Failed to edit password sync node."; 93 LOG(ERROR) << "Failed to edit password sync node.";
94 return false; 94 return false;
95 } 95 }
96 WriteToSyncNode(new_password, &write_node); 96 WriteToSyncNode(new_password, &write_node);
97 updated_passwords.push_back(new_password); 97 updated_passwords.push_back(new_password);
98 } 98 }
99 99
100 Associate(&tag, node.GetId()); 100 Associate(&tag, node.GetId());
101 } else { 101 } else {
102 sync_api::WriteNode node(&trans); 102 sync_api::WriteNode node(&trans);
103 if (!node.InitUniqueByCreation(syncable::PASSWORD, 103 if (!node.InitUniqueByCreation(syncable::PASSWORDS,
104 password_root, tag)) { 104 password_root, tag)) {
105 STLDeleteElements(&passwords); 105 STLDeleteElements(&passwords);
106 LOG(ERROR) << "Failed to create password sync node."; 106 LOG(ERROR) << "Failed to create password sync node.";
107 return false; 107 return false;
108 } 108 }
109 109
110 WriteToSyncNode(**ix, &node); 110 WriteToSyncNode(**ix, &node);
111 111
112 Associate(&tag, node.GetId()); 112 Associate(&tag, node.GetId());
113 } 113 }
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 std::string PasswordModelAssociator::MakeTag( 393 std::string PasswordModelAssociator::MakeTag(
394 const std::string& signon_realm, 394 const std::string& signon_realm,
395 const std::string& origin, 395 const std::string& origin,
396 const std::string& action) { 396 const std::string& action) {
397 return EscapePath(signon_realm) + "|" + 397 return EscapePath(signon_realm) + "|" +
398 EscapePath(origin) + "|" + 398 EscapePath(origin) + "|" +
399 EscapePath(action); 399 EscapePath(action);
400 } 400 }
401 401
402 } // namespace browser_sync 402 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/password_model_associator.h ('k') | chrome/browser/sync/glue/sync_backend_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698