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

Side by Side Diff: chrome/browser/android/bookmarks/managed_bookmarks_shim.cc

Issue 307993005: Enable the ManagedBookmarks policy on all platforms. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 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
« no previous file with comments | « build/ios/grit_whitelist.txt ('k') | chrome/browser/bookmarks/bookmark_model_factory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/android/bookmarks/managed_bookmarks_shim.h" 5 #include "chrome/browser/android/bookmarks/managed_bookmarks_shim.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } 65 }
66 66
67 void ManagedBookmarksShim::Reload() { 67 void ManagedBookmarksShim::Reload() {
68 std::string domain; 68 std::string domain;
69 std::string username = prefs_->GetString(prefs::kGoogleServicesUsername); 69 std::string username = prefs_->GetString(prefs::kGoogleServicesUsername);
70 if (!username.empty()) 70 if (!username.empty())
71 domain = gaia::ExtractDomainName(username); 71 domain = gaia::ExtractDomainName(username);
72 base::string16 root_node_name; 72 base::string16 root_node_name;
73 if (domain.empty()) { 73 if (domain.empty()) {
74 root_node_name = 74 root_node_name =
75 l10n_util::GetStringUTF16(IDS_POLICY_MANAGED_BOOKMARKS_DEFAULT_NAME); 75 l10n_util::GetStringUTF16(IDS_BOOKMARK_BAR_MANAGED_FOLDER_DEFAULT_NAME);
76 } else { 76 } else {
77 root_node_name = l10n_util::GetStringFUTF16(IDS_POLICY_MANAGED_BOOKMARKS, 77 root_node_name = l10n_util::GetStringFUTF16(
78 base::UTF8ToUTF16(domain)); 78 IDS_BOOKMARK_BAR_MANAGED_FOLDER_DOMAIN_NAME, base::UTF8ToUTF16(domain));
79 } 79 }
80 80
81 root_.reset(new BookmarkPermanentNode(0)); 81 root_.reset(new BookmarkPermanentNode(0));
82 root_->SetTitle(root_node_name); 82 root_->SetTitle(root_node_name);
83 83
84 const base::ListValue* list = prefs_->GetList(prefs::kManagedBookmarks); 84 const base::ListValue* list = prefs_->GetList(prefs::kManagedBookmarks);
85 int64 id = 1; 85 int64 id = 1;
86 if (list) { 86 if (list) {
87 for (base::ListValue::const_iterator it = list->begin(); 87 for (base::ListValue::const_iterator it = list->begin();
88 it != list->end(); ++it) { 88 it != list->end(); ++it) {
(...skipping 13 matching lines...) Expand all
102 102
103 BookmarkNode* node = new BookmarkNode(id++, GURL(url)); 103 BookmarkNode* node = new BookmarkNode(id++, GURL(url));
104 node->set_type(BookmarkNode::URL); 104 node->set_type(BookmarkNode::URL);
105 node->SetTitle(name); 105 node->SetTitle(name);
106 root_->Add(node, root_->child_count()); 106 root_->Add(node, root_->child_count());
107 } 107 }
108 } 108 }
109 109
110 FOR_EACH_OBSERVER(Observer, observers_, OnManagedBookmarksChanged()); 110 FOR_EACH_OBSERVER(Observer, observers_, OnManagedBookmarksChanged());
111 } 111 }
OLDNEW
« no previous file with comments | « build/ios/grit_whitelist.txt ('k') | chrome/browser/bookmarks/bookmark_model_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698