1 // Copyright (c) 2012 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 // C++ bridge class between Chromium and Cocoa to connect the
6 // Bookmarks (model) with the Bookmark Bar (view).
8 // There is exactly one BookmarkBarBridge per BookmarkBarController /
9 // BrowserWindowController / Browser.
11 #ifndef CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_BRIDGE_H_
12 #define CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_BRIDGE_H_
14 #include "base/basictypes.h"
15 #include "base/compiler_specific.h"
16 #include "base/prefs/pref_change_registrar.h"
17 #include "components/bookmarks/browser/bookmark_model_observer.h"
20 @
class BookmarkBarController
;
22 class BookmarkBarBridge
: public bookmarks::BookmarkModelObserver
{
24 BookmarkBarBridge(Profile
* profile
,
25 BookmarkBarController
* controller
,
26 bookmarks::BookmarkModel
* model
);
27 ~BookmarkBarBridge() override
;
29 // bookmarks::BookmarkModelObserver:
30 void BookmarkModelLoaded(bookmarks::BookmarkModel
* model
,
31 bool ids_reassigned
) override
;
32 void BookmarkModelBeingDeleted(bookmarks::BookmarkModel
* model
) override
;
33 void BookmarkNodeMoved(bookmarks::BookmarkModel
* model
,
34 const bookmarks::BookmarkNode
* old_parent
,
36 const bookmarks::BookmarkNode
* new_parent
,
37 int new_index
) override
;
38 void BookmarkNodeAdded(bookmarks::BookmarkModel
* model
,
39 const bookmarks::BookmarkNode
* parent
,
41 void BookmarkNodeRemoved(bookmarks::BookmarkModel
* model
,
42 const bookmarks::BookmarkNode
* parent
,
44 const bookmarks::BookmarkNode
* node
,
45 const std::set
<GURL
>& removed_urls
) override
;
46 void BookmarkAllUserNodesRemoved(bookmarks::BookmarkModel
* model
,
47 const std::set
<GURL
>& removed_urls
) override
;
48 void BookmarkNodeChanged(bookmarks::BookmarkModel
* model
,
49 const bookmarks::BookmarkNode
* node
) override
;
50 void BookmarkNodeFaviconChanged(bookmarks::BookmarkModel
* model
,
51 const bookmarks::BookmarkNode
* node
) override
;
52 void BookmarkNodeChildrenReordered(
53 bookmarks::BookmarkModel
* model
,
54 const bookmarks::BookmarkNode
* node
) override
;
55 void ExtensiveBookmarkChangesBeginning(
56 bookmarks::BookmarkModel
* model
) override
;
57 void ExtensiveBookmarkChangesEnded(bookmarks::BookmarkModel
* model
) override
;
60 BookmarkBarController
* controller_
; // weak; owns me
61 bookmarks::BookmarkModel
* model_
; // weak; it is owned by a Profile.
64 // Needed to react to kShowAppsShortcutInBookmarkBar changes.
65 PrefChangeRegistrar profile_pref_registrar_
;
67 // Updates the visibility of the apps shortcut and the managed bookmarks
68 // folder based on the pref values.
69 void OnExtraButtonsVisibilityChanged();
71 DISALLOW_COPY_AND_ASSIGN(BookmarkBarBridge
);
74 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_BRIDGE_H_