| Index: components/sync/core/base_node.cc
|
| diff --git a/sync/internal_api/base_node.cc b/components/sync/core/base_node.cc
|
| similarity index 86%
|
| rename from sync/internal_api/base_node.cc
|
| rename to components/sync/core/base_node.cc
|
| index d7c6380aaf11cd3bf73301b563948a90a11b809c..bddbeef922b903d6ef8756698f0bde93d78fcd5a 100644
|
| --- a/sync/internal_api/base_node.cc
|
| +++ b/components/sync/core/base_node.cc
|
| @@ -2,7 +2,7 @@
|
| // 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/base_node.h"
|
| +#include "components/sync/core/base_node.h"
|
|
|
| #include <stdint.h>
|
|
|
| @@ -10,22 +10,22 @@
|
|
|
| #include "base/strings/string_number_conversions.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| -#include "sync/internal_api/public/base_transaction.h"
|
| -#include "sync/internal_api/syncapi_internal.h"
|
| -#include "sync/protocol/app_specifics.pb.h"
|
| -#include "sync/protocol/autofill_specifics.pb.h"
|
| -#include "sync/protocol/bookmark_specifics.pb.h"
|
| -#include "sync/protocol/extension_specifics.pb.h"
|
| -#include "sync/protocol/nigori_specifics.pb.h"
|
| -#include "sync/protocol/password_specifics.pb.h"
|
| -#include "sync/protocol/session_specifics.pb.h"
|
| -#include "sync/protocol/theme_specifics.pb.h"
|
| -#include "sync/protocol/typed_url_specifics.pb.h"
|
| -#include "sync/syncable/directory.h"
|
| -#include "sync/syncable/entry.h"
|
| -#include "sync/syncable/syncable_base_transaction.h"
|
| -#include "sync/syncable/syncable_id.h"
|
| -#include "sync/util/time.h"
|
| +#include "components/sync/base/time.h"
|
| +#include "components/sync/core/base_transaction.h"
|
| +#include "components/sync/core_impl/syncapi_internal.h"
|
| +#include "components/sync/protocol/app_specifics.pb.h"
|
| +#include "components/sync/protocol/autofill_specifics.pb.h"
|
| +#include "components/sync/protocol/bookmark_specifics.pb.h"
|
| +#include "components/sync/protocol/extension_specifics.pb.h"
|
| +#include "components/sync/protocol/nigori_specifics.pb.h"
|
| +#include "components/sync/protocol/password_specifics.pb.h"
|
| +#include "components/sync/protocol/session_specifics.pb.h"
|
| +#include "components/sync/protocol/theme_specifics.pb.h"
|
| +#include "components/sync/protocol/typed_url_specifics.pb.h"
|
| +#include "components/sync/syncable/directory.h"
|
| +#include "components/sync/syncable/entry.h"
|
| +#include "components/sync/syncable/syncable_base_transaction.h"
|
| +#include "components/sync/syncable/syncable_id.h"
|
|
|
| using sync_pb::AutofillProfileSpecifics;
|
|
|
| @@ -51,9 +51,8 @@ BaseNode::~BaseNode() {}
|
|
|
| bool BaseNode::DecryptIfNecessary() {
|
| if (GetIsPermanentFolder())
|
| - return true; // Ignore unique folders.
|
| - const sync_pb::EntitySpecifics& specifics =
|
| - GetEntry()->GetSpecifics();
|
| + return true; // Ignore unique folders.
|
| + const sync_pb::EntitySpecifics& specifics = GetEntry()->GetSpecifics();
|
| if (specifics.has_password()) {
|
| // Passwords have their own legacy encryption structure.
|
| std::unique_ptr<sync_pb::PasswordSpecificsData> data(
|
| @@ -75,8 +74,7 @@ bool BaseNode::DecryptIfNecessary() {
|
| // we fill the unencrypted_data_ with a copy of the bookmark specifics that
|
| // follows the new bookmarks format.
|
| if (!specifics.has_encrypted()) {
|
| - if (GetModelType() == BOOKMARKS &&
|
| - !specifics.bookmark().has_title() &&
|
| + if (GetModelType() == BOOKMARKS && !specifics.bookmark().has_title() &&
|
| !GetTitle().empty()) { // Last check ensures this isn't a new node.
|
| // We need to fill in the title.
|
| std::string title = GetTitle();
|
| @@ -85,15 +83,14 @@ bool BaseNode::DecryptIfNecessary() {
|
| DVLOG(1) << "Reading from legacy bookmark, manually returning title "
|
| << title;
|
| unencrypted_data_.CopyFrom(specifics);
|
| - unencrypted_data_.mutable_bookmark()->set_title(
|
| - server_legal_title);
|
| + unencrypted_data_.mutable_bookmark()->set_title(server_legal_title);
|
| }
|
| return true;
|
| }
|
|
|
| const sync_pb::EncryptedData& encrypted = specifics.encrypted();
|
| - std::string plaintext_data = GetTransaction()->GetCryptographer()->
|
| - DecryptToString(encrypted);
|
| + std::string plaintext_data =
|
| + GetTransaction()->GetCryptographer()->DecryptToString(encrypted);
|
| if (plaintext_data.length() == 0) {
|
| GetTransaction()->GetWrappedTrans()->OnUnrecoverableError(
|
| FROM_HERE, std::string("Failed to decrypt encrypted node of type ") +
|
| @@ -178,8 +175,7 @@ std::string BaseNode::GetTitle() const {
|
| // Special case for legacy bookmarks dealing with encryption.
|
| ServerNameToSyncAPIName(GetBookmarkSpecifics().title(), &result);
|
| } else {
|
| - ServerNameToSyncAPIName(GetEntry()->GetNonUniqueName(),
|
| - &result);
|
| + ServerNameToSyncAPIName(GetEntry()->GetNonUniqueName(), &result);
|
| }
|
| return result;
|
| }
|
|
|