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 "components/bookmarks/managed/managed_bookmarks_tracker.h" | 5 #include "components/bookmarks/managed/managed_bookmarks_tracker.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/memory/ptr_util.h" |
13 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
14 #include "base/values.h" | 15 #include "base/values.h" |
15 #include "components/bookmarks/browser/bookmark_model.h" | 16 #include "components/bookmarks/browser/bookmark_model.h" |
16 #include "components/bookmarks/browser/bookmark_node.h" | 17 #include "components/bookmarks/browser/bookmark_node.h" |
17 #include "components/bookmarks/common/bookmark_pref_names.h" | 18 #include "components/bookmarks/common/bookmark_pref_names.h" |
18 #include "components/prefs/pref_service.h" | 19 #include "components/prefs/pref_service.h" |
19 #include "grit/components_strings.h" | 20 #include "grit/components_strings.h" |
20 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
21 #include "url/gurl.h" | 22 #include "url/gurl.h" |
22 | 23 |
(...skipping 11 matching lines...) Expand all Loading... |
34 const GetManagementDomainCallback& callback) | 35 const GetManagementDomainCallback& callback) |
35 : model_(model), | 36 : model_(model), |
36 is_supervised_(is_supervised), | 37 is_supervised_(is_supervised), |
37 managed_node_(NULL), | 38 managed_node_(NULL), |
38 prefs_(prefs), | 39 prefs_(prefs), |
39 get_management_domain_callback_(callback) { | 40 get_management_domain_callback_(callback) { |
40 } | 41 } |
41 | 42 |
42 ManagedBookmarksTracker::~ManagedBookmarksTracker() {} | 43 ManagedBookmarksTracker::~ManagedBookmarksTracker() {} |
43 | 44 |
44 scoped_ptr<base::ListValue> | 45 std::unique_ptr<base::ListValue> |
45 ManagedBookmarksTracker::GetInitialManagedBookmarks() { | 46 ManagedBookmarksTracker::GetInitialManagedBookmarks() { |
46 const base::ListValue* list = prefs_->GetList(GetPrefName()); | 47 const base::ListValue* list = prefs_->GetList(GetPrefName()); |
47 return make_scoped_ptr(list->DeepCopy()); | 48 return base::WrapUnique(list->DeepCopy()); |
48 } | 49 } |
49 | 50 |
50 // static | 51 // static |
51 int64_t ManagedBookmarksTracker::LoadInitial(BookmarkNode* folder, | 52 int64_t ManagedBookmarksTracker::LoadInitial(BookmarkNode* folder, |
52 const base::ListValue* list, | 53 const base::ListValue* list, |
53 int64_t next_node_id) { | 54 int64_t next_node_id) { |
54 for (size_t i = 0; i < list->GetSize(); ++i) { | 55 for (size_t i = 0; i < list->GetSize(); ++i) { |
55 // Extract the data for the next bookmark from the |list|. | 56 // Extract the data for the next bookmark from the |list|. |
56 base::string16 title; | 57 base::string16 title; |
57 GURL url; | 58 GURL url; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 return false; | 206 return false; |
206 } | 207 } |
207 if (!*children) { | 208 if (!*children) { |
208 *url = GURL(spec); | 209 *url = GURL(spec); |
209 DCHECK(url->is_valid()); | 210 DCHECK(url->is_valid()); |
210 } | 211 } |
211 return true; | 212 return true; |
212 } | 213 } |
213 | 214 |
214 } // namespace policy | 215 } // namespace policy |
OLD | NEW |