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

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

Issue 120983002: Update some uses of UTF conversions in chrome/browser to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/bookmark_change_processor.h" 5 #include "chrome/browser/sync/glue/bookmark_change_processor.h"
6 6
7 #include <map> 7 #include <map>
8 #include <stack> 8 #include <stack>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 void BookmarkChangeProcessor::UpdateBookmarkWithSyncData( 697 void BookmarkChangeProcessor::UpdateBookmarkWithSyncData(
698 const syncer::BaseNode& sync_node, 698 const syncer::BaseNode& sync_node,
699 BookmarkModel* model, 699 BookmarkModel* model,
700 const BookmarkNode* node, 700 const BookmarkNode* node,
701 Profile* profile) { 701 Profile* profile) {
702 DCHECK_EQ(sync_node.GetIsFolder(), node->is_folder()); 702 DCHECK_EQ(sync_node.GetIsFolder(), node->is_folder());
703 const sync_pb::BookmarkSpecifics& specifics = 703 const sync_pb::BookmarkSpecifics& specifics =
704 sync_node.GetBookmarkSpecifics(); 704 sync_node.GetBookmarkSpecifics();
705 if (!sync_node.GetIsFolder()) 705 if (!sync_node.GetIsFolder())
706 model->SetURL(node, GURL(specifics.url())); 706 model->SetURL(node, GURL(specifics.url()));
707 model->SetTitle(node, UTF8ToUTF16(sync_node.GetTitle())); 707 model->SetTitle(node, base::UTF8ToUTF16(sync_node.GetTitle()));
708 if (specifics.has_creation_time_us()) { 708 if (specifics.has_creation_time_us()) {
709 model->SetDateAdded( 709 model->SetDateAdded(
710 node, 710 node,
711 base::Time::FromInternalValue(specifics.creation_time_us())); 711 base::Time::FromInternalValue(specifics.creation_time_us()));
712 } 712 }
713 SetBookmarkFavicon(&sync_node, node, model, profile); 713 SetBookmarkFavicon(&sync_node, node, model, profile);
714 SetBookmarkMetaInfo(&sync_node, node, model); 714 SetBookmarkMetaInfo(&sync_node, node, model);
715 } 715 }
716 716
717 // static 717 // static
(...skipping 15 matching lines...) Expand all
733 const BookmarkNode* BookmarkChangeProcessor::CreateBookmarkNode( 733 const BookmarkNode* BookmarkChangeProcessor::CreateBookmarkNode(
734 syncer::BaseNode* sync_node, 734 syncer::BaseNode* sync_node,
735 const BookmarkNode* parent, 735 const BookmarkNode* parent,
736 BookmarkModel* model, 736 BookmarkModel* model,
737 Profile* profile, 737 Profile* profile,
738 int index) { 738 int index) {
739 DCHECK(parent); 739 DCHECK(parent);
740 740
741 const BookmarkNode* node; 741 const BookmarkNode* node;
742 if (sync_node->GetIsFolder()) { 742 if (sync_node->GetIsFolder()) {
743 node = model->AddFolder(parent, index, UTF8ToUTF16(sync_node->GetTitle())); 743 node = model->AddFolder(
744 parent, index, base::UTF8ToUTF16(sync_node->GetTitle()));
744 } else { 745 } else {
745 // 'creation_time_us' was added in m24. Assume a time of 0 means now. 746 // 'creation_time_us' was added in m24. Assume a time of 0 means now.
746 const sync_pb::BookmarkSpecifics& specifics = 747 const sync_pb::BookmarkSpecifics& specifics =
747 sync_node->GetBookmarkSpecifics(); 748 sync_node->GetBookmarkSpecifics();
748 const int64 create_time_internal = specifics.creation_time_us(); 749 const int64 create_time_internal = specifics.creation_time_us();
749 base::Time create_time = (create_time_internal == 0) ? 750 base::Time create_time = (create_time_internal == 0) ?
750 base::Time::Now() : base::Time::FromInternalValue(create_time_internal); 751 base::Time::Now() : base::Time::FromInternalValue(create_time_internal);
751 node = model->AddURLWithCreationTime(parent, index, 752 node = model->AddURLWithCreationTime(parent, index,
752 UTF8ToUTF16(sync_node->GetTitle()), 753 base::UTF8ToUTF16(
754 sync_node->GetTitle()),
753 GURL(specifics.url()), create_time); 755 GURL(specifics.url()), create_time);
754 if (node) 756 if (node)
755 SetBookmarkFavicon(sync_node, node, model, profile); 757 SetBookmarkFavicon(sync_node, node, model, profile);
756 } 758 }
757 if (node) 759 if (node)
758 SetBookmarkMetaInfo(sync_node, node, model); 760 SetBookmarkMetaInfo(sync_node, node, model);
759 return node; 761 return node;
760 } 762 }
761 763
762 // static 764 // static
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 sync_pb::BookmarkSpecifics updated_specifics( 859 sync_pb::BookmarkSpecifics updated_specifics(
858 sync_node->GetBookmarkSpecifics()); 860 sync_node->GetBookmarkSpecifics());
859 updated_specifics.set_favicon(favicon_bytes->front(), 861 updated_specifics.set_favicon(favicon_bytes->front(),
860 favicon_bytes->size()); 862 favicon_bytes->size());
861 updated_specifics.set_icon_url(bookmark_node->icon_url().spec()); 863 updated_specifics.set_icon_url(bookmark_node->icon_url().spec());
862 sync_node->SetBookmarkSpecifics(updated_specifics); 864 sync_node->SetBookmarkSpecifics(updated_specifics);
863 } 865 }
864 } 866 }
865 867
866 } // namespace browser_sync 868 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/about_sync_util_unittest.cc ('k') | chrome/browser/sync/glue/bookmark_model_associator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698