Chromium Code Reviews

Unified Diff: chrome/browser/policy/managed_bookmarks_policy_handler.cc

Issue 305973004: BookmarkClient can add extra nodes to BookmarkModel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: chrome/browser/policy/managed_bookmarks_policy_handler.cc
diff --git a/chrome/browser/policy/managed_bookmarks_policy_handler.cc b/chrome/browser/policy/managed_bookmarks_policy_handler.cc
index e0370678a85e38b4f09575358b6b9a7e71b11617..5f81b2517714e3c3a37ae23858d7d65fec16efce 100644
--- a/chrome/browser/policy/managed_bookmarks_policy_handler.cc
+++ b/chrome/browser/policy/managed_bookmarks_policy_handler.cc
@@ -7,6 +7,7 @@
#include "base/prefs/pref_value_map.h"
#include "base/values.h"
#include "chrome/common/net/url_fixer_upper.h"
+#include "components/bookmarks/browser/managed_bookmarks_tracker.h"
#include "components/bookmarks/common/bookmark_pref_names.h"
#include "components/policy/core/browser/policy_error_map.h"
#include "components/policy/core/common/policy_map.h"
@@ -16,10 +17,6 @@
namespace policy {
-const char ManagedBookmarksPolicyHandler::kName[] = "name";
-const char ManagedBookmarksPolicyHandler::kUrl[] = "url";
-const char ManagedBookmarksPolicyHandler::kChildren[] = "children";
-
ManagedBookmarksPolicyHandler::ManagedBookmarksPolicyHandler(
Schema chrome_schema)
: SchemaValidatingPolicyHandler(
@@ -59,26 +56,26 @@ void ManagedBookmarksPolicyHandler::FilterBookmarks(base::ListValue* list) {
base::ListValue* children = NULL;
// Every bookmark must have a name, and then either a URL of a list of
// child bookmarks.
- if (!dict->GetString(kName, &name) ||
- (!dict->GetList(kChildren, &children) &&
- !dict->GetString(kUrl, &url))) {
+ if (!dict->GetString(ManagedBookmarksTracker::kName, &name) ||
+ (!dict->GetList(ManagedBookmarksTracker::kChildren, &children) &&
+ !dict->GetString(ManagedBookmarksTracker::kUrl, &url))) {
it = list->Erase(it, NULL);
continue;
}
if (children) {
// Ignore the URL if this bookmark has child nodes.
- dict->Remove(kUrl, NULL);
+ dict->Remove(ManagedBookmarksTracker::kUrl, NULL);
FilterBookmarks(children);
} else {
// Make sure the URL is valid before passing a bookmark to the pref.
- dict->Remove(kChildren, NULL);
+ dict->Remove(ManagedBookmarksTracker::kChildren, NULL);
GURL gurl = URLFixerUpper::FixupURL(url, "");
if (!gurl.is_valid()) {
it = list->Erase(it, NULL);
continue;
}
- dict->SetString(kUrl, gurl.spec());
+ dict->SetString(ManagedBookmarksTracker::kUrl, gurl.spec());
}
++it;

Powered by Google App Engine