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" |
(...skipping 29 matching lines...) Expand all Loading... |
40 | 40 |
41 ManagedBookmarksTracker::~ManagedBookmarksTracker() {} | 41 ManagedBookmarksTracker::~ManagedBookmarksTracker() {} |
42 | 42 |
43 scoped_ptr<base::ListValue> | 43 scoped_ptr<base::ListValue> |
44 ManagedBookmarksTracker::GetInitialManagedBookmarks() { | 44 ManagedBookmarksTracker::GetInitialManagedBookmarks() { |
45 const base::ListValue* list = prefs_->GetList(GetPrefName()); | 45 const base::ListValue* list = prefs_->GetList(GetPrefName()); |
46 return make_scoped_ptr(list->DeepCopy()); | 46 return make_scoped_ptr(list->DeepCopy()); |
47 } | 47 } |
48 | 48 |
49 // static | 49 // static |
50 int64 ManagedBookmarksTracker::LoadInitial(BookmarkNode* folder, | 50 int64_t ManagedBookmarksTracker::LoadInitial(BookmarkNode* folder, |
51 const base::ListValue* list, | 51 const base::ListValue* list, |
52 int64 next_node_id) { | 52 int64_t next_node_id) { |
53 for (size_t i = 0; i < list->GetSize(); ++i) { | 53 for (size_t i = 0; i < list->GetSize(); ++i) { |
54 // Extract the data for the next bookmark from the |list|. | 54 // Extract the data for the next bookmark from the |list|. |
55 base::string16 title; | 55 base::string16 title; |
56 GURL url; | 56 GURL url; |
57 const base::ListValue* children = NULL; | 57 const base::ListValue* children = NULL; |
58 if (!LoadBookmark(list, i, &title, &url, &children)) | 58 if (!LoadBookmark(list, i, &title, &url, &children)) |
59 continue; | 59 continue; |
60 | 60 |
61 BookmarkNode* child = new BookmarkNode(next_node_id++, url); | 61 BookmarkNode* child = new BookmarkNode(next_node_id++, url); |
62 child->SetTitle(title); | 62 child->SetTitle(title); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 return false; | 200 return false; |
201 } | 201 } |
202 if (!*children) { | 202 if (!*children) { |
203 *url = GURL(spec); | 203 *url = GURL(spec); |
204 DCHECK(url->is_valid()); | 204 DCHECK(url->is_valid()); |
205 } | 205 } |
206 return true; | 206 return true; |
207 } | 207 } |
208 | 208 |
209 } // namespace policy | 209 } // namespace policy |
OLD | NEW |