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

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

Issue 2000803003: Use std::unique_ptr for base::DictionaryValue and base::ListValue's internal store. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More fixes Created 4 years, 7 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 <utility> 7 #include <utility>
8 8
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "components/bookmarks/common/bookmark_pref_names.h" 10 #include "components/bookmarks/common/bookmark_pref_names.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 42
43 prefs->SetString(bookmarks::prefs::kManagedBookmarksFolderName, 43 prefs->SetString(bookmarks::prefs::kManagedBookmarksFolderName,
44 GetFolderName(*list)); 44 GetFolderName(*list));
45 FilterBookmarks(list); 45 FilterBookmarks(list);
46 prefs->SetValue(bookmarks::prefs::kManagedBookmarks, std::move(value)); 46 prefs->SetValue(bookmarks::prefs::kManagedBookmarks, std::move(value));
47 } 47 }
48 48
49 std::string 49 std::string
50 ManagedBookmarksPolicyHandler::GetFolderName(const base::ListValue& list) { 50 ManagedBookmarksPolicyHandler::GetFolderName(const base::ListValue& list) {
51 // Iterate over the list, and try to find the FolderName. 51 // Iterate over the list, and try to find the FolderName.
52 for (auto el : list) { 52 for (const auto& el : list) {
53 const base::DictionaryValue* dict = NULL; 53 const base::DictionaryValue* dict = NULL;
54 if (!el || !el->GetAsDictionary(&dict)) continue; 54 if (!el || !el->GetAsDictionary(&dict)) continue;
55 55
56 std::string name; 56 std::string name;
57 if (dict->GetString(ManagedBookmarksTracker::kFolderName, &name)) { 57 if (dict->GetString(ManagedBookmarksTracker::kFolderName, &name)) {
58 return name; 58 return name;
59 } 59 }
60 } 60 }
61 61
62 // FolderName not present. 62 // FolderName not present.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 continue; 98 continue;
99 } 99 }
100 dict->SetString(ManagedBookmarksTracker::kUrl, gurl.spec()); 100 dict->SetString(ManagedBookmarksTracker::kUrl, gurl.spec());
101 } 101 }
102 102
103 ++it; 103 ++it;
104 } 104 }
105 } 105 }
106 106
107 } // namespace policy 107 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/plugins/plugin_prefs.cc ('k') | chrome/browser/spellchecker/spellcheck_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698