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 "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/location.h" | 9 #include "base/location.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 "Failed to edit password sync node.", | 110 "Failed to edit password sync node.", |
111 model_type()); | 111 model_type()); |
112 } | 112 } |
113 WriteToSyncNode(new_password, &write_node); | 113 WriteToSyncNode(new_password, &write_node); |
114 updated_passwords.push_back(new_password); | 114 updated_passwords.push_back(new_password); |
115 } | 115 } |
116 | 116 |
117 Associate(&tag, node.GetId()); | 117 Associate(&tag, node.GetId()); |
118 } else { | 118 } else { |
119 sync_api::WriteNode node(&trans); | 119 sync_api::WriteNode node(&trans); |
120 if (!node.InitUniqueByCreation(syncable::PASSWORDS, | 120 sync_api::WriteNode::InitUniqueByCreationResult result = |
121 password_root, tag)) { | 121 node.InitUniqueByCreation(syncable::PASSWORDS, password_root, tag); |
| 122 if (result != sync_api::WriteNode::INIT_SUCCESS) { |
122 STLDeleteElements(&passwords); | 123 STLDeleteElements(&passwords); |
123 return error_handler_->CreateAndUploadError( | 124 return error_handler_->CreateAndUploadError( |
124 FROM_HERE, | 125 FROM_HERE, |
125 "Failed to create password sync node.", | 126 "Failed to create password sync node.", |
126 model_type()); | 127 model_type()); |
127 } | 128 } |
128 | 129 |
129 WriteToSyncNode(**ix, &node); | 130 WriteToSyncNode(**ix, &node); |
130 | 131 |
131 Associate(&tag, node.GetId()); | 132 Associate(&tag, node.GetId()); |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 const std::string& password_element, | 436 const std::string& password_element, |
436 const std::string& signon_realm) { | 437 const std::string& signon_realm) { |
437 return net::EscapePath(origin_url) + "|" + | 438 return net::EscapePath(origin_url) + "|" + |
438 net::EscapePath(username_element) + "|" + | 439 net::EscapePath(username_element) + "|" + |
439 net::EscapePath(username_value) + "|" + | 440 net::EscapePath(username_value) + "|" + |
440 net::EscapePath(password_element) + "|" + | 441 net::EscapePath(password_element) + "|" + |
441 net::EscapePath(signon_realm); | 442 net::EscapePath(signon_realm); |
442 } | 443 } |
443 | 444 |
444 } // namespace browser_sync | 445 } // namespace browser_sync |
OLD | NEW |