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

Side by Side Diff: components/bookmarks/managed/managed_bookmarks_tracker.cc

Issue 1906973002: Convert //components/bookmarks from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 "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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698