Roll src/third_party/WebKit 9f7fb92:f103b33 (svn 202621:202622)
[chromium-blink-merge.git] / components / bookmarks / test / test_bookmark_client.h
blob2c71e1b2fc7aa542a605779f82991085bf6f5787
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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_BOOKMARKS_TEST_TEST_BOOKMARK_CLIENT_H_
6 #define COMPONENTS_BOOKMARKS_TEST_TEST_BOOKMARK_CLIENT_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "components/bookmarks/browser/bookmark_client.h"
11 namespace bookmarks {
13 class BookmarkModel;
15 class TestBookmarkClient : public BookmarkClient {
16 public:
17 TestBookmarkClient();
18 ~TestBookmarkClient() override;
20 // Create a BookmarkModel using this object as its client. The returned
21 // BookmarkModel* is owned by the caller.
22 scoped_ptr<BookmarkModel> CreateModel();
24 // Sets the list of extra nodes to be returned by the next call to
25 // CreateModel() or GetLoadExtraNodesCallback().
26 void SetExtraNodesToLoad(BookmarkPermanentNodeList extra_nodes);
28 // Returns the current extra_nodes, set via SetExtraNodesToLoad().
29 const std::vector<BookmarkPermanentNode*>& extra_nodes() {
30 return extra_nodes_;
33 // Returns true if |node| is one of the |extra_nodes_|.
34 bool IsExtraNodeRoot(const BookmarkNode* node);
36 // Returns true if |node| belongs to the tree of one of the |extra_nodes_|.
37 bool IsAnExtraNode(const BookmarkNode* node);
39 private:
40 // BookmarkClient:
41 bool IsPermanentNodeVisible(const BookmarkPermanentNode* node) override;
42 void RecordAction(const base::UserMetricsAction& action) override;
43 LoadExtraCallback GetLoadExtraNodesCallback() override;
44 bool CanSetPermanentNodeTitle(const BookmarkNode* permanent_node) override;
45 bool CanSyncNode(const BookmarkNode* node) override;
46 bool CanBeEditedByUser(const BookmarkNode* node) override;
48 // Helpers for GetLoadExtraNodesCallback().
49 static BookmarkPermanentNodeList LoadExtraNodes(
50 BookmarkPermanentNodeList extra_nodes,
51 int64* next_id);
53 BookmarkPermanentNodeList extra_nodes_to_load_;
54 std::vector<BookmarkPermanentNode*> extra_nodes_;
56 DISALLOW_COPY_AND_ASSIGN(TestBookmarkClient);
59 } // namespace bookmarks
61 #endif // COMPONENTS_BOOKMARKS_TEST_TEST_BOOKMARK_CLIENT_H_