| 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/test/test_bookmark_client.h" | 5 #include "components/bookmarks/test/test_bookmark_client.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 |
| 8 #include <utility> | 9 #include <utility> |
| 9 | 10 |
| 10 #include "base/bind.h" | 11 #include "base/bind.h" |
| 11 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
| 12 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/memory/ptr_util.h" |
| 13 #include "components/bookmarks/browser/bookmark_model.h" | 15 #include "components/bookmarks/browser/bookmark_model.h" |
| 14 #include "components/bookmarks/browser/bookmark_node.h" | 16 #include "components/bookmarks/browser/bookmark_node.h" |
| 15 #include "components/bookmarks/browser/bookmark_storage.h" | 17 #include "components/bookmarks/browser/bookmark_storage.h" |
| 16 | 18 |
| 17 namespace bookmarks { | 19 namespace bookmarks { |
| 18 | 20 |
| 19 TestBookmarkClient::TestBookmarkClient() {} | 21 TestBookmarkClient::TestBookmarkClient() {} |
| 20 | 22 |
| 21 TestBookmarkClient::~TestBookmarkClient() {} | 23 TestBookmarkClient::~TestBookmarkClient() {} |
| 22 | 24 |
| 23 // static | 25 // static |
| 24 scoped_ptr<BookmarkModel> TestBookmarkClient::CreateModel() { | 26 std::unique_ptr<BookmarkModel> TestBookmarkClient::CreateModel() { |
| 25 return CreateModelWithClient(make_scoped_ptr(new TestBookmarkClient)); | 27 return CreateModelWithClient(base::WrapUnique(new TestBookmarkClient)); |
| 26 } | 28 } |
| 27 | 29 |
| 28 // static | 30 // static |
| 29 scoped_ptr<BookmarkModel> TestBookmarkClient::CreateModelWithClient( | 31 std::unique_ptr<BookmarkModel> TestBookmarkClient::CreateModelWithClient( |
| 30 scoped_ptr<BookmarkClient> client) { | 32 std::unique_ptr<BookmarkClient> client) { |
| 31 scoped_ptr<BookmarkModel> bookmark_model( | 33 std::unique_ptr<BookmarkModel> bookmark_model( |
| 32 new BookmarkModel(std::move(client))); | 34 new BookmarkModel(std::move(client))); |
| 33 scoped_ptr<BookmarkLoadDetails> details = bookmark_model->CreateLoadDetails(); | 35 std::unique_ptr<BookmarkLoadDetails> details = |
| 36 bookmark_model->CreateLoadDetails(); |
| 34 details->LoadExtraNodes(); | 37 details->LoadExtraNodes(); |
| 35 bookmark_model->DoneLoading(std::move(details)); | 38 bookmark_model->DoneLoading(std::move(details)); |
| 36 return bookmark_model; | 39 return bookmark_model; |
| 37 } | 40 } |
| 38 | 41 |
| 39 void TestBookmarkClient::SetExtraNodesToLoad( | 42 void TestBookmarkClient::SetExtraNodesToLoad( |
| 40 BookmarkPermanentNodeList extra_nodes) { | 43 BookmarkPermanentNodeList extra_nodes) { |
| 41 extra_nodes_to_load_ = std::move(extra_nodes); | 44 extra_nodes_to_load_ = std::move(extra_nodes); |
| 42 // Keep a copy in |extra_nodes_| for the acessor. | 45 // Keep a copy in |extra_nodes_| for the acessor. |
| 43 extra_nodes_ = extra_nodes_to_load_.get(); | 46 extra_nodes_ = extra_nodes_to_load_.get(); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 } | 95 } |
| 93 | 96 |
| 94 // static | 97 // static |
| 95 BookmarkPermanentNodeList TestBookmarkClient::LoadExtraNodes( | 98 BookmarkPermanentNodeList TestBookmarkClient::LoadExtraNodes( |
| 96 BookmarkPermanentNodeList extra_nodes, | 99 BookmarkPermanentNodeList extra_nodes, |
| 97 int64_t* next_id) { | 100 int64_t* next_id) { |
| 98 return extra_nodes; | 101 return extra_nodes; |
| 99 } | 102 } |
| 100 | 103 |
| 101 } // namespace bookmarks | 104 } // namespace bookmarks |
| OLD | NEW |