| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |