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 "chrome/browser/bookmarks/bookmark_model_observer.h"
20 @
class BookmarkBarController
;
22 class BookmarkBarBridge
: public BookmarkModelObserver
{
24 BookmarkBarBridge(Profile
* profile
,
25 BookmarkBarController
* controller
,
26 BookmarkModel
* model
);
27 virtual ~BookmarkBarBridge();
29 // Overridden from BookmarkModelObserver:
30 virtual void BookmarkModelLoaded(BookmarkModel
* model
,
31 bool ids_reassigned
) OVERRIDE
;
32 virtual void BookmarkModelBeingDeleted(BookmarkModel
* model
) OVERRIDE
;
33 virtual void BookmarkNodeMoved(BookmarkModel
* model
,
34 const BookmarkNode
* old_parent
,
36 const BookmarkNode
* new_parent
,
37 int new_index
) OVERRIDE
;
38 virtual void BookmarkNodeAdded(BookmarkModel
* model
,
39 const BookmarkNode
* parent
,
41 virtual void BookmarkNodeRemoved(BookmarkModel
* model
,
42 const BookmarkNode
* parent
,
44 const BookmarkNode
* node
) OVERRIDE
;
45 virtual void BookmarkAllNodesRemoved(BookmarkModel
* model
) OVERRIDE
;
46 virtual void BookmarkNodeChanged(BookmarkModel
* model
,
47 const BookmarkNode
* node
) OVERRIDE
;
48 virtual void BookmarkNodeFaviconChanged(BookmarkModel
* model
,
49 const BookmarkNode
* node
) OVERRIDE
;
50 virtual void BookmarkNodeChildrenReordered(BookmarkModel
* model
,
51 const BookmarkNode
* node
) OVERRIDE
;
52 virtual void ExtensiveBookmarkChangesBeginning(BookmarkModel
* model
) OVERRIDE
;
53 virtual void ExtensiveBookmarkChangesEnded(BookmarkModel
* model
) OVERRIDE
;
56 BookmarkBarController
* controller_
; // weak; owns me
57 BookmarkModel
* model_
; // weak; it is owned by a Profile.
60 // Needed to react to kShowAppsShortcutInBookmarkBar changes.
61 PrefChangeRegistrar profile_pref_registrar_
;
63 // Updates the visibility of the apps shortcut based on the pref value.
64 void OnAppsPageShortcutVisibilityPrefChanged();
66 DISALLOW_COPY_AND_ASSIGN(BookmarkBarBridge
);
69 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_BRIDGE_H_