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

Side by Side Diff: chrome/browser/policy/managed_bookmarks_policy_handler.cc

Issue 490123003: Move bookmark_pref_names.* into bookmarks namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: REBASE Created 6 years, 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/policy/managed_bookmarks_policy_handler.h" 5 #include "chrome/browser/policy/managed_bookmarks_policy_handler.h"
6 6
7 #include "base/prefs/pref_value_map.h" 7 #include "base/prefs/pref_value_map.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "components/bookmarks/common/bookmark_pref_names.h" 9 #include "components/bookmarks/common/bookmark_pref_names.h"
10 #include "components/policy/core/browser/managed_bookmarks_tracker.h" 10 #include "components/policy/core/browser/managed_bookmarks_tracker.h"
(...skipping 19 matching lines...) Expand all
30 PrefValueMap* prefs) { 30 PrefValueMap* prefs) {
31 scoped_ptr<base::Value> value; 31 scoped_ptr<base::Value> value;
32 if (!CheckAndGetValue(policies, NULL, &value)) 32 if (!CheckAndGetValue(policies, NULL, &value))
33 return; 33 return;
34 34
35 base::ListValue* list = NULL; 35 base::ListValue* list = NULL;
36 if (!value || !value->GetAsList(&list)) 36 if (!value || !value->GetAsList(&list))
37 return; 37 return;
38 38
39 FilterBookmarks(list); 39 FilterBookmarks(list);
40 prefs->SetValue(prefs::kManagedBookmarks, value.release()); 40 prefs->SetValue(bookmarks::prefs::kManagedBookmarks, value.release());
41 } 41 }
42 42
43 void ManagedBookmarksPolicyHandler::FilterBookmarks(base::ListValue* list) { 43 void ManagedBookmarksPolicyHandler::FilterBookmarks(base::ListValue* list) {
44 // Remove any non-conforming values found. 44 // Remove any non-conforming values found.
45 base::ListValue::iterator it = list->begin(); 45 base::ListValue::iterator it = list->begin();
46 while (it != list->end()) { 46 while (it != list->end()) {
47 base::DictionaryValue* dict = NULL; 47 base::DictionaryValue* dict = NULL;
48 if (!*it || !(*it)->GetAsDictionary(&dict)) { 48 if (!*it || !(*it)->GetAsDictionary(&dict)) {
49 it = list->Erase(it, NULL); 49 it = list->Erase(it, NULL);
50 continue; 50 continue;
(...skipping 24 matching lines...) Expand all
75 continue; 75 continue;
76 } 76 }
77 dict->SetString(ManagedBookmarksTracker::kUrl, gurl.spec()); 77 dict->SetString(ManagedBookmarksTracker::kUrl, gurl.spec());
78 } 78 }
79 79
80 ++it; 80 ++it;
81 } 81 }
82 } 82 }
83 83
84 } // namespace policy 84 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698