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

Side by Side Diff: components/bookmarks/test/test_bookmark_client.h

Issue 2379863002: Fix object ownership in ui/base/models. (Closed)
Patch Set: fix Created 4 years, 2 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 #ifndef COMPONENTS_BOOKMARKS_TEST_TEST_BOOKMARK_CLIENT_H_ 5 #ifndef COMPONENTS_BOOKMARKS_TEST_TEST_BOOKMARK_CLIENT_H_
6 #define COMPONENTS_BOOKMARKS_TEST_TEST_BOOKMARK_CLIENT_H_ 6 #define COMPONENTS_BOOKMARKS_TEST_TEST_BOOKMARK_CLIENT_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 15 matching lines...) Expand all
26 26
27 // Returns a new BookmarkModel using |client|. 27 // Returns a new BookmarkModel using |client|.
28 static std::unique_ptr<BookmarkModel> CreateModelWithClient( 28 static std::unique_ptr<BookmarkModel> CreateModelWithClient(
29 std::unique_ptr<BookmarkClient> client); 29 std::unique_ptr<BookmarkClient> client);
30 30
31 // Sets the list of extra nodes to be returned by the next call to 31 // Sets the list of extra nodes to be returned by the next call to
32 // CreateModel() or GetLoadExtraNodesCallback(). 32 // CreateModel() or GetLoadExtraNodesCallback().
33 void SetExtraNodesToLoad(BookmarkPermanentNodeList extra_nodes); 33 void SetExtraNodesToLoad(BookmarkPermanentNodeList extra_nodes);
34 34
35 // Returns the current extra_nodes, set via SetExtraNodesToLoad(). 35 // Returns the current extra_nodes, set via SetExtraNodesToLoad().
36 const std::vector<BookmarkPermanentNode*>& extra_nodes() { 36 const std::vector<BookmarkPermanentNode*> extra_nodes() {
37 return extra_nodes_; 37 return unowned_extra_nodes_;
38 } 38 }
39 39
40 // Returns true if |node| is one of the |extra_nodes_|. 40 // Returns true if |node| is one of the |extra_nodes_|.
41 bool IsExtraNodeRoot(const BookmarkNode* node); 41 bool IsExtraNodeRoot(const BookmarkNode* node);
42 42
43 // Returns true if |node| belongs to the tree of one of the |extra_nodes_|. 43 // Returns true if |node| belongs to the tree of one of the |extra_nodes_|.
44 bool IsAnExtraNode(const BookmarkNode* node); 44 bool IsAnExtraNode(const BookmarkNode* node);
45 45
46 private: 46 private:
47 // BookmarkClient: 47 // BookmarkClient:
48 bool IsPermanentNodeVisible(const BookmarkPermanentNode* node) override; 48 bool IsPermanentNodeVisible(const BookmarkPermanentNode* node) override;
49 void RecordAction(const base::UserMetricsAction& action) override; 49 void RecordAction(const base::UserMetricsAction& action) override;
50 LoadExtraCallback GetLoadExtraNodesCallback() override; 50 LoadExtraCallback GetLoadExtraNodesCallback() override;
51 bool CanSetPermanentNodeTitle(const BookmarkNode* permanent_node) override; 51 bool CanSetPermanentNodeTitle(const BookmarkNode* permanent_node) override;
52 bool CanSyncNode(const BookmarkNode* node) override; 52 bool CanSyncNode(const BookmarkNode* node) override;
53 bool CanBeEditedByUser(const BookmarkNode* node) override; 53 bool CanBeEditedByUser(const BookmarkNode* node) override;
54 54
55 // Helpers for GetLoadExtraNodesCallback(). 55 // Helpers for GetLoadExtraNodesCallback().
56 static BookmarkPermanentNodeList LoadExtraNodes( 56 static BookmarkPermanentNodeList LoadExtraNodes(
57 BookmarkPermanentNodeList extra_nodes, 57 BookmarkPermanentNodeList extra_nodes,
58 int64_t* next_id); 58 int64_t* next_id);
59 59
60 BookmarkPermanentNodeList extra_nodes_to_load_; 60 BookmarkPermanentNodeList extra_nodes_;
61 std::vector<BookmarkPermanentNode*> extra_nodes_; 61 std::vector<BookmarkPermanentNode*> unowned_extra_nodes_;
62 62
63 DISALLOW_COPY_AND_ASSIGN(TestBookmarkClient); 63 DISALLOW_COPY_AND_ASSIGN(TestBookmarkClient);
64 }; 64 };
65 65
66 } // namespace bookmarks 66 } // namespace bookmarks
67 67
68 #endif // COMPONENTS_BOOKMARKS_TEST_TEST_BOOKMARK_CLIENT_H_ 68 #endif // COMPONENTS_BOOKMARKS_TEST_TEST_BOOKMARK_CLIENT_H_
OLDNEW
« no previous file with comments | « components/bookmarks/managed/managed_bookmarks_tracker_unittest.cc ('k') | components/bookmarks/test/test_bookmark_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698