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

Unified Diff: components/sync/core/write_node.cc

Issue 2130453004: [Sync] Move //sync to //components/sync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/sync/core/write_node.h ('k') | components/sync/core/write_transaction.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/sync/core/write_node.cc
diff --git a/sync/internal_api/write_node.cc b/components/sync/core/write_node.cc
similarity index 91%
rename from sync/internal_api/write_node.cc
rename to components/sync/core/write_node.cc
index da7afb64f560290c54c92a3a9aed2de1cd3b1bc2..0977234702cbce013978ddd190d8df1375a17d00 100644
--- a/sync/internal_api/write_node.cc
+++ b/components/sync/core/write_node.cc
@@ -2,22 +2,22 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "sync/internal_api/public/write_node.h"
+#include "components/sync/core/write_node.h"
#include <stdint.h>
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
-#include "sync/internal_api/public/base_transaction.h"
-#include "sync/internal_api/public/write_transaction.h"
-#include "sync/internal_api/syncapi_internal.h"
-#include "sync/protocol/bookmark_specifics.pb.h"
-#include "sync/protocol/typed_url_specifics.pb.h"
-#include "sync/syncable/mutable_entry.h"
-#include "sync/syncable/nigori_util.h"
-#include "sync/syncable/syncable_util.h"
-#include "sync/util/cryptographer.h"
+#include "components/sync/base/cryptographer.h"
+#include "components/sync/core/base_transaction.h"
+#include "components/sync/core/write_transaction.h"
+#include "components/sync/core_impl/syncapi_internal.h"
+#include "components/sync/protocol/bookmark_specifics.pb.h"
+#include "components/sync/protocol/typed_url_specifics.pb.h"
+#include "components/sync/syncable/mutable_entry.h"
+#include "components/sync/syncable/nigori_util.h"
+#include "components/sync/syncable/syncable_util.h"
using std::string;
using std::vector;
@@ -59,8 +59,7 @@ void WriteNode::SetTitle(const std::string& title) {
}
std::string current_legal_title;
- if (BOOKMARKS == type &&
- entry_->GetSpecifics().has_encrypted()) {
+ if (BOOKMARKS == type && entry_->GetSpecifics().has_encrypted()) {
// Encrypted bookmarks only have their title in the unencrypted specifics.
current_legal_title = GetBookmarkSpecifics().title();
} else {
@@ -71,8 +70,8 @@ void WriteNode::SetTitle(const std::string& title) {
}
bool title_matches = (current_legal_title == new_legal_title);
- bool encrypted_without_overwriting_name = (needs_encryption &&
- entry_->GetNonUniqueName() != kEncryptedString);
+ bool encrypted_without_overwriting_name =
+ (needs_encryption && entry_->GetNonUniqueName() != kEncryptedString);
// For bookmarks, we also set the title field in the specifics.
// TODO(zea): refactor bookmarks to not need this functionality.
@@ -100,8 +99,7 @@ void WriteNode::SetTitle(const std::string& title) {
else
entry_->PutNonUniqueName(new_legal_title);
- DVLOG(1) << "Overwriting title of type "
- << ModelTypeToString(type)
+ DVLOG(1) << "Overwriting title of type " << ModelTypeToString(type)
<< " and marking for syncing.";
MarkForSyncing();
}
@@ -113,8 +111,7 @@ void WriteNode::SetBookmarkSpecifics(
SetEntitySpecifics(entity_specifics);
}
-void WriteNode::SetNigoriSpecifics(
- const sync_pb::NigoriSpecifics& new_value) {
+void WriteNode::SetNigoriSpecifics(const sync_pb::NigoriSpecifics& new_value) {
sync_pb::EntitySpecifics entity_specifics;
entity_specifics.mutable_nigori()->CopyFrom(new_value);
SetEntitySpecifics(entity_specifics);
@@ -149,10 +146,8 @@ void WriteNode::SetPasswordSpecifics(
SetEntitySpecifics(entity_specifics);
}
-void WriteNode::SetEntitySpecifics(
- const sync_pb::EntitySpecifics& new_value) {
- ModelType new_specifics_type =
- GetModelTypeFromSpecifics(new_value);
+void WriteNode::SetEntitySpecifics(const sync_pb::EntitySpecifics& new_value) {
+ ModelType new_specifics_type = GetModelTypeFromSpecifics(new_value);
CHECK(!new_value.password().has_client_only_encrypted_data());
DCHECK_NE(new_specifics_type, UNSPECIFIED);
DVLOG(1) << "Writing entity specifics of type "
@@ -163,13 +158,12 @@ void WriteNode::SetEntitySpecifics(
const sync_pb::EntitySpecifics& old_specifics = entry_->GetSpecifics();
sync_pb::EntitySpecifics new_specifics;
new_specifics.CopyFrom(new_value);
- new_specifics.mutable_unknown_fields()
- ->append(old_specifics.unknown_fields());
+ new_specifics.mutable_unknown_fields()->append(
+ old_specifics.unknown_fields());
// Will update the entry if encryption was necessary.
if (!UpdateEntryWithEncryption(GetTransaction()->GetWrappedTrans(),
- new_specifics,
- entry_)) {
+ new_specifics, entry_)) {
return;
}
if (entry_->GetSpecifics().has_encrypted()) {
@@ -277,9 +271,9 @@ bool WriteNode::InitBookmarkByCreation(const BaseNode& parent,
// the caller to set a meaningful name after creation.
string dummy(kDefaultNameForNewNodes);
- entry_ = new syncable::MutableEntry(transaction_->GetWrappedWriteTrans(),
- syncable::CREATE, BOOKMARKS,
- parent_id, dummy);
+ entry_ =
+ new syncable::MutableEntry(transaction_->GetWrappedWriteTrans(),
+ syncable::CREATE, BOOKMARKS, parent_id, dummy);
if (!entry_->good())
return false;
@@ -384,8 +378,8 @@ WriteNode::InitUniqueByCreationResult WriteNode::InitUniqueByCreationImpl(
return INIT_FAILED_DECRYPT_EXISTING_ENTRY;
} else {
entry_ = new syncable::MutableEntry(transaction_->GetWrappedWriteTrans(),
- syncable::CREATE,
- model_type, parent_id, dummy);
+ syncable::CREATE, model_type, parent_id,
+ dummy);
}
if (!entry_->good())
« no previous file with comments | « components/sync/core/write_node.h ('k') | components/sync/core/write_transaction.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698