diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-22 00:55:57 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-22 00:55:57 +0000 |
commit | 7fa5a1aeafaf667e734b68c263840fd608babd3d (patch) | |
tree | 75bdf4ea751c73c9638be4fa4b5a708248996ad2 | |
parent | d395db9f222e3b2c2ef24f74cf506b2917012521 (diff) | |
download | chromium_src-7fa5a1aeafaf667e734b68c263840fd608babd3d.zip chromium_src-7fa5a1aeafaf667e734b68c263840fd608babd3d.tar.gz chromium_src-7fa5a1aeafaf667e734b68c263840fd608babd3d.tar.bz2 |
Cleanup: Remove some std::wstring usage in sync.
BUG=23581
Review URL: https://codereview.chromium.org/235553007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@265131 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/sync/glue/bookmark_change_processor.cc | 2 | ||||
-rw-r--r-- | chrome/browser/sync/glue/synced_device_tracker.cc | 5 | ||||
-rw-r--r-- | chrome/browser/sync/glue/typed_url_change_processor.cc | 2 | ||||
-rw-r--r-- | chrome/browser/sync/glue/typed_url_model_associator.cc | 2 | ||||
-rw-r--r-- | chrome/browser/sync/profile_sync_service_bookmark_unittest.cc | 166 | ||||
-rw-r--r-- | components/sync_driver/generic_change_processor.cc | 4 | ||||
-rw-r--r-- | sync/internal_api/public/write_node.h | 2 | ||||
-rw-r--r-- | sync/internal_api/sync_manager_impl_unittest.cc | 37 | ||||
-rw-r--r-- | sync/internal_api/syncapi_internal.h | 2 | ||||
-rw-r--r-- | sync/internal_api/write_node.cc | 4 |
10 files changed, 112 insertions, 114 deletions
diff --git a/chrome/browser/sync/glue/bookmark_change_processor.cc b/chrome/browser/sync/glue/bookmark_change_processor.cc index 53695e0..729d0f7 100644 --- a/chrome/browser/sync/glue/bookmark_change_processor.cc +++ b/chrome/browser/sync/glue/bookmark_change_processor.cc @@ -76,7 +76,7 @@ void BookmarkChangeProcessor::UpdateSyncNodeProperties( syncer::WriteNode* dst) { // Set the properties of the item. dst->SetIsFolder(src->is_folder()); - dst->SetTitle(base::UTF16ToWideHack(src->GetTitle())); + dst->SetTitle(base::UTF16ToUTF8(src->GetTitle())); sync_pb::BookmarkSpecifics bookmark_specifics(dst->GetBookmarkSpecifics()); if (!src->is_folder()) bookmark_specifics.set_url(src->url().spec()); diff --git a/chrome/browser/sync/glue/synced_device_tracker.cc b/chrome/browser/sync/glue/synced_device_tracker.cc index 16eec33..fa4770f 100644 --- a/chrome/browser/sync/glue/synced_device_tracker.cc +++ b/chrome/browser/sync/glue/synced_device_tracker.cc @@ -129,7 +129,6 @@ void SyncedDeviceTracker::GetAllSyncedDeviceInfo( specifics.chrome_version(), specifics.sync_user_agent(), specifics.device_type())); - } } @@ -179,7 +178,7 @@ void SyncedDeviceTracker::WriteDeviceInfo( if (node.InitByClientTagLookup(syncer::DEVICE_INFO, tag) == syncer::BaseNode::INIT_OK) { node.SetDeviceInfoSpecifics(specifics); - node.SetTitle(base::UTF8ToWide(specifics.client_name())); + node.SetTitle(specifics.client_name()); } else { syncer::ReadNode type_root(&trans); syncer::BaseNode::InitByLookupResult type_root_lookup_result = @@ -193,7 +192,7 @@ void SyncedDeviceTracker::WriteDeviceInfo( tag); DCHECK_EQ(syncer::WriteNode::INIT_SUCCESS, create_result); new_node.SetDeviceInfoSpecifics(specifics); - new_node.SetTitle(base::UTF8ToWide(specifics.client_name())); + new_node.SetTitle(specifics.client_name()); } } diff --git a/chrome/browser/sync/glue/typed_url_change_processor.cc b/chrome/browser/sync/glue/typed_url_change_processor.cc index 2de9b65..75f7930 100644 --- a/chrome/browser/sync/glue/typed_url_change_processor.cc +++ b/chrome/browser/sync/glue/typed_url_change_processor.cc @@ -174,7 +174,7 @@ bool TypedUrlChangeProcessor::CreateOrUpdateSyncNode( return false; } - create_node.SetTitle(base::UTF8ToWide(tag)); + create_node.SetTitle(tag); model_associator_->WriteToSyncNode(url, visit_vector, &create_node); } return true; diff --git a/chrome/browser/sync/glue/typed_url_model_associator.cc b/chrome/browser/sync/glue/typed_url_model_associator.cc index adfdbf6..1a0503e 100644 --- a/chrome/browser/sync/glue/typed_url_model_associator.cc +++ b/chrome/browser/sync/glue/typed_url_model_associator.cc @@ -305,7 +305,7 @@ syncer::SyncError TypedUrlModelAssociator::DoAssociateModels() { model_type()); } - node.SetTitle(base::UTF8ToWide(tag)); + node.SetTitle(tag); WriteToSyncNode(*ix, visits, &node); } diff --git a/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc b/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc index 97cc544..75f9b22d 100644 --- a/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_bookmark_unittest.cc @@ -74,7 +74,7 @@ class FakeServerChange { } // Pretend that the server told the syncer to add a bookmark object. - int64 AddWithMetaInfo(const std::wstring& title, + int64 AddWithMetaInfo(const std::string& title, const std::string& url, const BookmarkNode::MetaInfoMap* meta_info_map, bool is_folder, @@ -110,7 +110,7 @@ class FakeServerChange { return node.GetId(); } - int64 Add(const std::wstring& title, + int64 Add(const std::string& title, const std::string& url, bool is_folder, int64 parent_id, @@ -120,12 +120,12 @@ class FakeServerChange { } // Add a bookmark folder. - int64 AddFolder(const std::wstring& title, + int64 AddFolder(const std::string& title, int64 parent_id, int64 predecessor_id) { return Add(title, std::string(), true, parent_id, predecessor_id); } - int64 AddFolderWithMetaInfo(const std::wstring& title, + int64 AddFolderWithMetaInfo(const std::string& title, const BookmarkNode::MetaInfoMap* meta_info_map, int64 parent_id, int64 predecessor_id) { @@ -134,13 +134,13 @@ class FakeServerChange { } // Add a bookmark. - int64 AddURL(const std::wstring& title, + int64 AddURL(const std::string& title, const std::string& url, int64 parent_id, int64 predecessor_id) { return Add(title, url, false, parent_id, predecessor_id); } - int64 AddURLWithMetaInfo(const std::wstring& title, + int64 AddURLWithMetaInfo(const std::string& title, const std::string& url, const BookmarkNode::MetaInfoMap* meta_info_map, int64 parent_id, @@ -178,13 +178,13 @@ class FakeServerChange { } // Set a new title value, and return the old value. - std::wstring ModifyTitle(int64 id, const std::wstring& new_title) { + std::string ModifyTitle(int64 id, const std::string& new_title) { syncer::WriteNode node(trans_); EXPECT_EQ(BaseNode::INIT_OK, node.InitByIdLookup(id)); std::string old_title = node.GetTitle(); node.SetTitle(new_title); SetModified(id); - return base::UTF8ToWide(old_title); + return old_title; } // Set a new parent and predecessor value. Return the old parent id. @@ -355,7 +355,7 @@ class ProfileSyncServiceBookmarkTest : public testing::Test { syncer::WriteNode node(trans); EXPECT_TRUE(node.InitBookmarkByCreation(bookmark_bar, NULL)); node.SetIsFolder(true); - node.SetTitle(base::ASCIIToWide(title)); + node.SetTitle(title); return node.GetId(); } @@ -383,7 +383,7 @@ class ProfileSyncServiceBookmarkTest : public testing::Test { syncer::WriteNode node(trans); EXPECT_TRUE(node.InitBookmarkByCreation(parent, NULL)); node.SetIsFolder(false); - node.SetTitle(base::ASCIIToWide(title)); + node.SetTitle(title); node.SetBookmarkSpecifics(specifics); return node.GetId(); @@ -469,7 +469,7 @@ class ProfileSyncServiceBookmarkTest : public testing::Test { return false; node.SetIsFolder(true); node.GetMutableEntryForTest()->PutUniqueServerTag(permanent_tags[i]); - node.SetTitle(base::UTF8ToWide(permanent_tags[i])); + node.SetTitle(permanent_tags[i]); node.SetExternalId(0); last_child_id = node.GetId(); } @@ -657,11 +657,11 @@ class ProfileSyncServiceBookmarkTest : public testing::Test { EXPECT_EQ(sync_id, syncer::kInvalidId); } - void ExpectBrowserNodeTitle(int64 sync_id, const std::wstring& title) { + void ExpectBrowserNodeTitle(int64 sync_id, const std::string& title) { const BookmarkNode* bnode = model_associator_->GetChromeNodeFromSyncId(sync_id); ASSERT_TRUE(bnode); - EXPECT_EQ(bnode->GetTitle(), base::WideToUTF16Hack(title)); + EXPECT_EQ(bnode->GetTitle(), base::UTF8ToUTF16(title)); } void ExpectBrowserNodeURL(int64 sync_id, const std::string& url) { @@ -856,15 +856,15 @@ TEST_F(ProfileSyncServiceBookmarkTest, ServerChangeProcessing) { syncer::WriteTransaction trans(FROM_HERE, test_user_share_.user_share()); FakeServerChange adds(&trans); - int64 f1 = adds.AddFolder(L"Server Folder B", bookmark_bar_id(), 0); - int64 f2 = adds.AddFolder(L"Server Folder A", bookmark_bar_id(), f1); - int64 u1 = adds.AddURL(L"Some old site", "ftp://nifty.andrew.cmu.edu/", + int64 f1 = adds.AddFolder("Server Folder B", bookmark_bar_id(), 0); + int64 f2 = adds.AddFolder("Server Folder A", bookmark_bar_id(), f1); + int64 u1 = adds.AddURL("Some old site", "ftp://nifty.andrew.cmu.edu/", bookmark_bar_id(), f2); - int64 u2 = adds.AddURL(L"Nifty", "ftp://nifty.andrew.cmu.edu/", f1, 0); + int64 u2 = adds.AddURL("Nifty", "ftp://nifty.andrew.cmu.edu/", f1, 0); // u3 is a duplicate URL - int64 u3 = adds.AddURL(L"Nifty2", "ftp://nifty.andrew.cmu.edu/", f1, u2); + int64 u3 = adds.AddURL("Nifty2", "ftp://nifty.andrew.cmu.edu/", f1, u2); // u4 is a duplicate title, different URL. - adds.AddURL(L"Some old site", "http://slog.thestranger.com/", + adds.AddURL("Some old site", "http://slog.thestranger.com/", bookmark_bar_id(), u1); // u5 tests an empty-string title. std::string javascript_url( @@ -872,9 +872,9 @@ TEST_F(ProfileSyncServiceBookmarkTest, ServerChangeProcessing) { "'about:blank','gnotesWin','location=0,menubar=0," \ "scrollbars=0,status=0,toolbar=0,width=300," \ "height=300,resizable');});"); - adds.AddURL(std::wstring(), javascript_url, other_bookmarks_id(), 0); + adds.AddURL(std::string(), javascript_url, other_bookmarks_id(), 0); int64 u6 = adds.AddURL( - L"Sync1", "http://www.syncable.edu/", mobile_bookmarks_id(), 0); + "Sync1", "http://www.syncable.edu/", mobile_bookmarks_id(), 0); syncer::ChangeRecordList::const_iterator it; // The bookmark model shouldn't yet have seen any of the nodes of |adds|. @@ -892,18 +892,18 @@ TEST_F(ProfileSyncServiceBookmarkTest, ServerChangeProcessing) { FakeServerChange mods(&trans); // Mess with u2, and move it into empty folder f2 // TODO(ncarter): Determine if we allow ModifyURL ops or not. - /* std::wstring u2_old_url = mods.ModifyURL(u2, L"http://www.google.com"); */ - std::wstring u2_old_title = mods.ModifyTitle(u2, L"The Google"); + /* std::string u2_old_url = mods.ModifyURL(u2, "http://www.google.com"); */ + std::string u2_old_title = mods.ModifyTitle(u2, "The Google"); int64 u2_old_parent = mods.ModifyPosition(u2, f2, 0); // Now move f1 after u2. - std::wstring f1_old_title = mods.ModifyTitle(f1, L"Server Folder C"); + std::string f1_old_title = mods.ModifyTitle(f1, "Server Folder C"); int64 f1_old_parent = mods.ModifyPosition(f1, f2, u2); // Then add u3 after f1. int64 u3_old_parent = mods.ModifyPosition(u3, f2, f1); - std::wstring u6_old_title = mods.ModifyTitle(u6, L"Mobile Folder A"); + std::string u6_old_title = mods.ModifyTitle(u6, "Mobile Folder A"); // Test that the property changes have not yet taken effect. ExpectBrowserNodeTitle(u2, u2_old_title); @@ -957,13 +957,13 @@ TEST_F(ProfileSyncServiceBookmarkTest, ServerChangeRequiringFosterParent) { std::string url("http://dev.chromium.org/"); FakeServerChange adds(&trans); int64 f0 = other_bookmarks_id(); // + other_node - int64 f1 = adds.AddFolder(L"f1", f0, 0); // + f1 - int64 f2 = adds.AddFolder(L"f2", f1, 0); // + f2 - int64 u3 = adds.AddURL( L"u3", url, f2, 0); // + u3 NOLINT - int64 u4 = adds.AddURL( L"u4", url, f2, u3); // + u4 NOLINT - int64 u5 = adds.AddURL( L"u5", url, f1, f2); // + u5 NOLINT - int64 f6 = adds.AddFolder(L"f6", f1, u5); // + f6 - int64 u7 = adds.AddURL( L"u7", url, f0, f1); // + u7 NOLINT + int64 f1 = adds.AddFolder("f1", f0, 0); // + f1 + int64 f2 = adds.AddFolder("f2", f1, 0); // + f2 + int64 u3 = adds.AddURL( "u3", url, f2, 0); // + u3 NOLINT + int64 u4 = adds.AddURL( "u4", url, f2, u3); // + u4 NOLINT + int64 u5 = adds.AddURL( "u5", url, f1, f2); // + u5 NOLINT + int64 f6 = adds.AddFolder("f6", f1, u5); // + f6 + int64 u7 = adds.AddURL( "u7", url, f0, f1); // + u7 NOLINT syncer::ChangeRecordList::const_iterator it; // The bookmark model shouldn't yet have seen any of the nodes of |adds|. @@ -1004,7 +1004,7 @@ TEST_F(ProfileSyncServiceBookmarkTest, ServerChangeWithNonCanonicalURL) { FakeServerChange adds(&trans); std::string url("http://dev.chromium.org"); EXPECT_NE(GURL(url).spec(), url); - adds.AddURL(L"u1", url, other_bookmarks_id(), 0); + adds.AddURL("u1", url, other_bookmarks_id(), 0); adds.ApplyPendingChanges(change_processor_.get()); @@ -1035,7 +1035,7 @@ TEST_F(ProfileSyncServiceBookmarkTest, DISABLED_ServerChangeWithInvalidURL) { FakeServerChange adds(&trans); std::string url("x"); EXPECT_FALSE(GURL(url).is_valid()); - adds.AddURL(L"u1", url, other_bookmarks_id(), 0); + adds.AddURL("u1", url, other_bookmarks_id(), 0); adds.ApplyPendingChanges(change_processor_.get()); @@ -1218,11 +1218,11 @@ TEST_F(ProfileSyncServiceBookmarkTest, ApplySyncDeletesFromJournal) { { syncer::WriteTransaction trans(FROM_HERE, test_user_share_.user_share()); FakeServerChange adds(&trans); - u0 = adds.AddURL(L"URL 0", "http://plus.google.com/", bookmark_bar_id(), 0); - f1 = adds.AddFolder(L"Folder 1", bookmark_bar_id(), u0); - u1 = adds.AddURL(L"URL 1", "http://www.google.com/", f1, 0); - f2 = adds.AddFolder(L"Folder 2", f1, u1); - u2 = adds.AddURL(L"URL 2", "http://mail.google.com/", f2, 0); + u0 = adds.AddURL("URL 0", "http://plus.google.com/", bookmark_bar_id(), 0); + f1 = adds.AddFolder("Folder 1", bookmark_bar_id(), u0); + u1 = adds.AddURL("URL 1", "http://www.google.com/", f1, 0); + f2 = adds.AddFolder("Folder 2", f1, u1); + u2 = adds.AddURL("URL 2", "http://mail.google.com/", f2, 0); adds.ApplyPendingChanges(change_processor_.get()); } StopSync(); @@ -1282,7 +1282,7 @@ TEST_F(ProfileSyncServiceBookmarkTest, ApplySyncDeletesFromJournal) { } struct TestData { - const wchar_t* title; + const char* title; const char* url; }; @@ -1372,64 +1372,64 @@ namespace { // +-- u5, http://www.u5.com/ static TestData kBookmarkBarChildren[] = { - { L"u2", "http://www.u2.com/" }, - { L"f1", NULL }, - { L"u1", "http://www.u1.com/" }, - { L"f2", NULL }, + { "u2", "http://www.u2.com/" }, + { "f1", NULL }, + { "u1", "http://www.u1.com/" }, + { "f2", NULL }, }; static TestData kF1Children[] = { - { L"f1u4", "http://www.f1u4.com/" }, - { L"f1u2", "http://www.f1u2.com/" }, - { L"f1u3", "http://www.f1u3.com/" }, - { L"f1u1", "http://www.f1u1.com/" }, + { "f1u4", "http://www.f1u4.com/" }, + { "f1u2", "http://www.f1u2.com/" }, + { "f1u3", "http://www.f1u3.com/" }, + { "f1u1", "http://www.f1u1.com/" }, }; static TestData kF2Children[] = { - { L"f2u2", "http://www.f2u2.com/" }, - { L"f2u4", "http://www.f2u4.com/" }, - { L"f2u3", "http://www.f2u3.com/" }, - { L"f2u1", "http://www.f2u1.com/" }, + { "f2u2", "http://www.f2u2.com/" }, + { "f2u4", "http://www.f2u4.com/" }, + { "f2u3", "http://www.f2u3.com/" }, + { "f2u1", "http://www.f2u1.com/" }, }; static TestData kOtherBookmarkChildren[] = { - { L"f3", NULL }, - { L"u4", "http://www.u4.com/" }, - { L"u3", "http://www.u3.com/" }, - { L"f4", NULL }, - { L"dup", NULL }, - { L"dup", NULL }, - { L" ls ", "http://www.ls.com/" } + { "f3", NULL }, + { "u4", "http://www.u4.com/" }, + { "u3", "http://www.u3.com/" }, + { "f4", NULL }, + { "dup", NULL }, + { "dup", NULL }, + { " ls ", "http://www.ls.com/" } }; static TestData kF3Children[] = { - { L"f3u4", "http://www.f3u4.com/" }, - { L"f3u2", "http://www.f3u2.com/" }, - { L"f3u3", "http://www.f3u3.com/" }, - { L"f3u1", "http://www.f3u1.com/" }, + { "f3u4", "http://www.f3u4.com/" }, + { "f3u2", "http://www.f3u2.com/" }, + { "f3u3", "http://www.f3u3.com/" }, + { "f3u1", "http://www.f3u1.com/" }, }; static TestData kF4Children[] = { - { L"f4u1", "http://www.f4u1.com/" }, - { L"f4u2", "http://www.f4u2.com/" }, - { L"f4u3", "http://www.f4u3.com/" }, - { L"f4u4", "http://www.f4u4.com/" }, + { "f4u1", "http://www.f4u1.com/" }, + { "f4u2", "http://www.f4u2.com/" }, + { "f4u3", "http://www.f4u3.com/" }, + { "f4u4", "http://www.f4u4.com/" }, }; static TestData kDup1Children[] = { - { L"dupu1", "http://www.dupu1.com/" }, + { "dupu1", "http://www.dupu1.com/" }, }; static TestData kDup2Children[] = { - { L"dupu2", "http://www.dupu2.com/" }, + { "dupu2", "http://www.dupu2.com/" }, }; static TestData kMobileBookmarkChildren[] = { - { L"f5", NULL }, - { L"f6", NULL }, - { L"u5", "http://www.u5.com/" }, + { "f5", NULL }, + { "f6", NULL }, + { "u5", "http://www.u5.com/" }, }; static TestData kF5Children[] = { - { L"f5u1", "http://www.f5u1.com/" }, - { L"f5u2", "http://www.f5u2.com/" }, + { "f5u1", "http://www.f5u1.com/" }, + { "f5u2", "http://www.f5u2.com/" }, }; static TestData kF6Children[] = { - { L"f6u1", "http://www.f6u1.com/" }, - { L"f6u2", "http://www.f6u2.com/" }, + { "f6u1", "http://www.f6u1.com/" }, + { "f6u2", "http://www.f6u2.com/" }, }; } // anonymous namespace. @@ -1452,10 +1452,10 @@ void ProfileSyncServiceBookmarkTestWithData::PopulateFromTestData( if (item.url) { const base::Time add_time = start_time_ + base::TimeDelta::FromMinutes(*running_count); - model_->AddURLWithCreationTime(node, i, base::WideToUTF16Hack(item.title), + model_->AddURLWithCreationTime(node, i, base::UTF8ToUTF16(item.title), GURL(item.url), add_time); } else { - model_->AddFolder(node, i, base::WideToUTF16Hack(item.title)); + model_->AddFolder(node, i, base::UTF8ToUTF16(item.title)); } (*running_count)++; } @@ -1475,7 +1475,7 @@ void ProfileSyncServiceBookmarkTestWithData::CompareWithTestData( const TestData& item = data[i]; GURL url = GURL(item.url == NULL ? "" : item.url); BookmarkNode test_node(url); - test_node.SetTitle(base::WideToUTF16Hack(item.title)); + test_node.SetTitle(base::UTF8ToUTF16(item.title)); EXPECT_EQ(child_node->GetTitle(), test_node.GetTitle()); if (item.url) { EXPECT_FALSE(child_node->is_folder()); @@ -1904,7 +1904,7 @@ TEST_F(ProfileSyncServiceBookmarkTestWithData, UpdateDateAdded) { // updates it's creation time. syncer::WriteTransaction trans(FROM_HERE, test_user_share_.user_share()); FakeServerChange adds(&trans); - const std::wstring kTitle = L"Some site"; + const std::string kTitle = "Some site"; const std::string kUrl = "http://www.whatwhat.yeah/"; const int kCreationTime = 30; int64 id = adds.AddURL(kTitle, kUrl, @@ -1917,7 +1917,7 @@ TEST_F(ProfileSyncServiceBookmarkTestWithData, UpdateDateAdded) { const BookmarkNode* node = model_->bookmark_bar_node()->GetChild(0); ASSERT_TRUE(node); EXPECT_TRUE(node->is_url()); - EXPECT_EQ(base::WideToUTF16Hack(kTitle), node->GetTitle()); + EXPECT_EQ(base::UTF8ToUTF16(kTitle), node->GetTitle()); EXPECT_EQ(kUrl, node->url().possibly_invalid_spec()); EXPECT_EQ(node->date_added(), base::Time::FromInternalValue(30)); } @@ -1935,11 +1935,11 @@ TEST_F(ProfileSyncServiceBookmarkTestWithData, UpdateMetaInfoFromSync) { BookmarkNode::MetaInfoMap folder_meta_info; folder_meta_info["folder"] = "foldervalue"; int64 folder_id = adds.AddFolderWithMetaInfo( - L"folder title", &folder_meta_info, bookmark_bar_id(), 0); + "folder title", &folder_meta_info, bookmark_bar_id(), 0); BookmarkNode::MetaInfoMap node_meta_info; node_meta_info["node"] = "nodevalue"; node_meta_info["other"] = "othervalue"; - int64 id = adds.AddURLWithMetaInfo(L"node title", "http://www.foo.com", + int64 id = adds.AddURLWithMetaInfo("node title", "http://www.foo.com", &node_meta_info, folder_id, 0); adds.ApplyPendingChanges(change_processor_.get()); diff --git a/components/sync_driver/generic_change_processor.cc b/components/sync_driver/generic_change_processor.cc index a112c6b..adc4c90 100644 --- a/components/sync_driver/generic_change_processor.cc +++ b/components/sync_driver/generic_change_processor.cc @@ -502,7 +502,7 @@ syncer::SyncError GenericChangeProcessor::HandleActionAdd( } } } - sync_node->SetTitle(base::UTF8ToWide(change.sync_data().GetTitle())); + sync_node->SetTitle(change.sync_data().GetTitle()); SetNodeSpecifics(change.sync_data().GetSpecifics(), sync_node); attachment_service_->OnSyncDataAdd(change.sync_data()); if (merge_result_.get()) { @@ -605,7 +605,7 @@ syncer::SyncError GenericChangeProcessor::HandleActionUpdate( } } - sync_node->SetTitle(base::UTF8ToWide(change.sync_data().GetTitle())); + sync_node->SetTitle(change.sync_data().GetTitle()); SetNodeSpecifics(change.sync_data().GetSpecifics(), sync_node); attachment_service_->OnSyncDataUpdate(sync_node->GetAttachmentIds(), change.sync_data()); diff --git a/sync/internal_api/public/write_node.h b/sync/internal_api/public/write_node.h index 07c896b..e41c966 100644 --- a/sync/internal_api/public/write_node.h +++ b/sync/internal_api/public/write_node.h @@ -92,7 +92,7 @@ class SYNC_EXPORT WriteNode : public BaseNode { // These Set() functions correspond to the Get() functions of BaseNode. void SetIsFolder(bool folder); - void SetTitle(const std::wstring& title); + void SetTitle(const std::string& title); // External ID is a client-only field, so setting it doesn't cause the item to // be synced again. diff --git a/sync/internal_api/sync_manager_impl_unittest.cc b/sync/internal_api/sync_manager_impl_unittest.cc index a8ee0be..a5c0c81 100644 --- a/sync/internal_api/sync_manager_impl_unittest.cc +++ b/sync/internal_api/sync_manager_impl_unittest.cc @@ -334,7 +334,7 @@ TEST_F(SyncApiTest, TestDeleteBehavior) { wnode.InitUniqueByCreation(BOOKMARKS, root_node, "testtag"); EXPECT_EQ(WriteNode::INIT_SUCCESS, result); wnode.SetIsFolder(false); - wnode.SetTitle(base::UTF8ToWide(test_title)); + wnode.SetTitle(test_title); node_id = wnode.GetId(); } @@ -379,7 +379,7 @@ TEST_F(SyncApiTest, TestDeleteBehavior) { EXPECT_EQ(wnode.GetParentId(), folder_node.GetId()); EXPECT_EQ(wnode.GetId(), node_id); EXPECT_NE(wnode.GetTitle(), test_title); // Title should be cleared - wnode.SetTitle(base::UTF8ToWide(test_title)); + wnode.SetTitle(test_title); } // Now look up should work. @@ -444,13 +444,13 @@ TEST_F(SyncApiTest, WriteEncryptedTitle) { WriteNode bookmark_node(&trans); ASSERT_TRUE(bookmark_node.InitBookmarkByCreation(root_node, NULL)); bookmark_id = bookmark_node.GetId(); - bookmark_node.SetTitle(base::UTF8ToWide("foo")); + bookmark_node.SetTitle("foo"); WriteNode pref_node(&trans); WriteNode::InitUniqueByCreationResult result = pref_node.InitUniqueByCreation(PREFERENCES, root_node, "bar"); ASSERT_EQ(WriteNode::INIT_SUCCESS, result); - pref_node.SetTitle(base::UTF8ToWide("bar")); + pref_node.SetTitle("bar"); } { ReadTransaction trans(FROM_HERE, test_user_share_.user_share()); @@ -1653,7 +1653,7 @@ TEST_F(SyncManagerTest, CreateLocalBookmark) { WriteNode node(&trans); ASSERT_TRUE(node.InitBookmarkByCreation(bookmark_root, NULL)); node.SetIsFolder(false); - node.SetTitle(base::UTF8ToWide(title)); + node.SetTitle(title); sync_pb::BookmarkSpecifics bookmark_specifics(node.GetBookmarkSpecifics()); bookmark_specifics.set_url(url); @@ -1992,7 +1992,7 @@ TEST_F(SyncManagerTest, SetBookmarkTitle) { WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, node.InitByClientTagLookup(BOOKMARKS, client_tag)); - node.SetTitle(base::UTF8ToWide(client_tag)); + node.SetTitle(client_tag); } EXPECT_FALSE(ResetUnsyncedEntry(BOOKMARKS, client_tag)); @@ -2002,7 +2002,7 @@ TEST_F(SyncManagerTest, SetBookmarkTitle) { WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, node.InitByClientTagLookup(BOOKMARKS, client_tag)); - node.SetTitle(base::UTF8ToWide("title2")); + node.SetTitle("title2"); } EXPECT_TRUE(ResetUnsyncedEntry(BOOKMARKS, client_tag)); } @@ -2041,7 +2041,7 @@ TEST_F(SyncManagerTest, SetBookmarkTitleWithEncryption) { WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, node.InitByClientTagLookup(BOOKMARKS, client_tag)); - node.SetTitle(base::UTF8ToWide(client_tag)); + node.SetTitle(client_tag); const syncable::Entry* node_entry = node.GetEntry(); const sync_pb::EntitySpecifics& specifics = node_entry->GetSpecifics(); EXPECT_TRUE(specifics.has_encrypted()); @@ -2056,7 +2056,7 @@ TEST_F(SyncManagerTest, SetBookmarkTitleWithEncryption) { WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, node.InitByClientTagLookup(BOOKMARKS, client_tag)); - node.SetTitle(base::UTF8ToWide("title2")); + node.SetTitle("title2"); const syncable::Entry* node_entry = node.GetEntry(); const sync_pb::EntitySpecifics& specifics = node_entry->GetSpecifics(); EXPECT_TRUE(specifics.has_encrypted()); @@ -2087,7 +2087,7 @@ TEST_F(SyncManagerTest, SetNonBookmarkTitle) { WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, node.InitByClientTagLookup(PREFERENCES, client_tag)); - node.SetTitle(base::UTF8ToWide(client_tag)); + node.SetTitle(client_tag); } EXPECT_FALSE(ResetUnsyncedEntry(PREFERENCES, client_tag)); @@ -2097,7 +2097,7 @@ TEST_F(SyncManagerTest, SetNonBookmarkTitle) { WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, node.InitByClientTagLookup(PREFERENCES, client_tag)); - node.SetTitle(base::UTF8ToWide("title2")); + node.SetTitle("title2"); } EXPECT_TRUE(ResetUnsyncedEntry(PREFERENCES, client_tag)); } @@ -2138,7 +2138,7 @@ TEST_F(SyncManagerTest, SetNonBookmarkTitleWithEncryption) { WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, node.InitByClientTagLookup(PREFERENCES, client_tag)); - node.SetTitle(base::UTF8ToWide(client_tag)); + node.SetTitle(client_tag); const syncable::Entry* node_entry = node.GetEntry(); const sync_pb::EntitySpecifics& specifics = node_entry->GetSpecifics(); EXPECT_TRUE(specifics.has_encrypted()); @@ -2153,7 +2153,7 @@ TEST_F(SyncManagerTest, SetNonBookmarkTitleWithEncryption) { WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, node.InitByClientTagLookup(PREFERENCES, client_tag)); - node.SetTitle(base::UTF8ToWide("title2")); + node.SetTitle("title2"); const syncable::Entry* node_entry = node.GetEntry(); const sync_pb::EntitySpecifics& specifics = node_entry->GetSpecifics(); EXPECT_TRUE(specifics.has_encrypted()); @@ -2186,7 +2186,7 @@ TEST_F(SyncManagerTest, SetLongTitle) { WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, node.InitByClientTagLookup(PREFERENCES, kClientTag)); - node.SetTitle(base::UTF8ToWide(title)); + node.SetTitle(title); EXPECT_EQ(node.GetTitle(), title.substr(0, 255)); } EXPECT_TRUE(ResetUnsyncedEntry(PREFERENCES, kClientTag)); @@ -2197,7 +2197,7 @@ TEST_F(SyncManagerTest, SetLongTitle) { WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, node.InitByClientTagLookup(PREFERENCES, kClientTag)); - node.SetTitle(base::UTF8ToWide(title)); + node.SetTitle(title); EXPECT_EQ(node.GetTitle(), title.substr(0, 255)); } EXPECT_FALSE(ResetUnsyncedEntry(PREFERENCES, kClientTag)); @@ -2208,7 +2208,7 @@ TEST_F(SyncManagerTest, SetLongTitle) { WriteNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, node.InitByClientTagLookup(PREFERENCES, kClientTag)); - node.SetTitle(base::UTF8ToWide("title2")); + node.SetTitle("title2"); } EXPECT_TRUE(ResetUnsyncedEntry(PREFERENCES, kClientTag)); } @@ -2655,7 +2655,7 @@ TEST_F(SyncManagerTest, PurgeUnappliedTypes) { // Take a snapshot to clear all the dirty bits. share->directory.get()->SaveChanges(); - // Now request a purge for the unapplied types. + // Now request a purge for the unapplied types. disabled_types.PutAll(unapplied_types); sync_manager_.PurgeDisabledTypes(disabled_types, ModelTypeSet(), @@ -2928,7 +2928,6 @@ TEST_F(SyncManagerChangeProcessingTest, MoveIntoPopulatedFolder) { "childB"); SetNodeProperties(&child_b); child_b_id = child_b.GetMetahandle(); - } // Close that transaction. The above was to setup the initial scenario. The @@ -3047,4 +3046,4 @@ TEST_F(SyncManagerInitInvalidStorageTest, FailToOpenDatabase) { EXPECT_FALSE(initialization_succeeded_); } -} // namespace +} // namespace syncer diff --git a/sync/internal_api/syncapi_internal.h b/sync/internal_api/syncapi_internal.h index 27e1400..2e7965d 100644 --- a/sync/internal_api/syncapi_internal.h +++ b/sync/internal_api/syncapi_internal.h @@ -26,7 +26,7 @@ sync_pb::PasswordSpecificsData* DecryptPasswordSpecifics( Cryptographer* crypto); SYNC_EXPORT void SyncAPINameToServerName(const std::string& syncer_name, - std::string* out); + std::string* out); SYNC_EXPORT void ServerNameToSyncAPIName(const std::string& server_name, std::string* out); diff --git a/sync/internal_api/write_node.cc b/sync/internal_api/write_node.cc index 018f444..6a634eb 100644 --- a/sync/internal_api/write_node.cc +++ b/sync/internal_api/write_node.cc @@ -41,7 +41,7 @@ void WriteNode::SetIsFolder(bool folder) { MarkForSyncing(); } -void WriteNode::SetTitle(const std::wstring& title) { +void WriteNode::SetTitle(const std::string& title) { DCHECK_NE(GetModelType(), UNSPECIFIED); ModelType type = GetModelType(); // It's possible the nigori lost the set of encrypted types. If the current @@ -57,7 +57,7 @@ void WriteNode::SetTitle(const std::wstring& title) { if (type != BOOKMARKS && needs_encryption) { new_legal_title = kEncryptedString; } else { - SyncAPINameToServerName(base::WideToUTF8(title), &new_legal_title); + SyncAPINameToServerName(title, &new_legal_title); base::TruncateUTF8ToByteSize(new_legal_title, 255, &new_legal_title); } |