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

Side by Side Diff: ios/chrome/browser/ui/bookmarks/bookmark_model_bridge_observer.h

Issue 2586993002: Upstream Chrome on iOS source code [3/11]. (Closed)
Patch Set: Created 4 years 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
(Empty)
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.
4
5 #ifndef IOS_CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_MODEL_BRIDGE_OBSERVER_H_
6 #define IOS_CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_MODEL_BRIDGE_OBSERVER_H_
7
8 #import <Foundation/Foundation.h>
9
10 #include "base/compiler_specific.h"
11 #include "components/bookmarks/browser/bookmark_model_observer.h"
12
13 // The ObjC translations of the C++ observer callbacks are defined here.
14 @protocol BookmarkModelBridgeObserver<NSObject>
15 // The bookmark model has loaded.
16 - (void)bookmarkModelLoaded;
17 // The node has changed, but not its children.
18 - (void)bookmarkNodeChanged:(const bookmarks::BookmarkNode*)bookmarkNode;
19 // The node has not changed, but the ordering and existence of its children have
20 // changed.
21 - (void)bookmarkNodeChildrenChanged:
22 (const bookmarks::BookmarkNode*)bookmarkNode;
23 // The node has moved to a new parent folder.
24 - (void)bookmarkNode:(const bookmarks::BookmarkNode*)bookmarkNode
25 movedFromParent:(const bookmarks::BookmarkNode*)oldParent
26 toParent:(const bookmarks::BookmarkNode*)newParent;
27 // |node| was deleted from |folder|.
28 - (void)bookmarkNodeDeleted:(const bookmarks::BookmarkNode*)node
29 fromFolder:(const bookmarks::BookmarkNode*)folder;
30 // All non-permanent nodes have been removed.
31 - (void)bookmarkModelRemovedAllNodes;
32
33 @optional
34 // The node favicon changed.
35 - (void)bookmarkNodeFaviconChanged:(const bookmarks::BookmarkNode*)bookmarkNode;
36 @end
37
38 namespace bookmarks {
39 // A bridge that translates BookmarkModelObserver C++ callbacks into ObjC
40 // callbacks.
41 class BookmarkModelBridge : public BookmarkModelObserver {
42 public:
43 explicit BookmarkModelBridge(id<BookmarkModelBridgeObserver> observer,
44 BookmarkModel* model);
45 ~BookmarkModelBridge() override;
46
47 private:
48 void BookmarkModelLoaded(BookmarkModel* model, bool ids_reassigned) override;
49 void BookmarkModelBeingDeleted(BookmarkModel* model) override;
50 void BookmarkNodeMoved(BookmarkModel* model,
51 const BookmarkNode* old_parent,
52 int old_index,
53 const BookmarkNode* new_parent,
54 int new_index) override;
55 void BookmarkNodeAdded(BookmarkModel* model,
56 const BookmarkNode* parent,
57 int index) override;
58 void BookmarkNodeRemoved(BookmarkModel* model,
59 const BookmarkNode* parent,
60 int old_index,
61 const BookmarkNode* node,
62 const std::set<GURL>& removed_urls) override;
63 void BookmarkNodeChanged(BookmarkModel* model,
64 const BookmarkNode* node) override;
65 void BookmarkNodeFaviconChanged(BookmarkModel* model,
66 const BookmarkNode* node) override;
67 void BookmarkNodeChildrenReordered(BookmarkModel* model,
68 const BookmarkNode* node) override;
69 void BookmarkAllUserNodesRemoved(BookmarkModel* model,
70 const std::set<GURL>& removed_urls) override;
71
72 id<BookmarkModelBridgeObserver> observer_; // weak
73 BookmarkModel* model_; // weak
74 };
75 } // namespace bookmarks
76
77 #endif // IOS_CHROME_BROWSER_UI_BOOKMARKS_BOOKMARK_MODEL_BRIDGE_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698