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 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
,
45 const std::set
<GURL
>& removed_urls
) OVERRIDE
;
46 virtual void BookmarkAllNodesRemoved(
48 const std::set
<GURL
>& removed_urls
) OVERRIDE
;
49 virtual void BookmarkNodeChanged(BookmarkModel
* model
,
50 const BookmarkNode
* node
) OVERRIDE
;
51 virtual void BookmarkNodeFaviconChanged(BookmarkModel
* model
,
52 const BookmarkNode
* node
) OVERRIDE
;
53 virtual void BookmarkNodeChildrenReordered(BookmarkModel
* model
,
54 const BookmarkNode
* node
) OVERRIDE
;
55 virtual void ExtensiveBookmarkChangesBeginning(BookmarkModel
* model
) OVERRIDE
;
56 virtual void ExtensiveBookmarkChangesEnded(BookmarkModel
* model
) OVERRIDE
;
59 BookmarkBarController
* controller_
; // weak; owns me
60 BookmarkModel
* model_
; // weak; it is owned by a Profile.
63 // Needed to react to kShowAppsShortcutInBookmarkBar changes.
64 PrefChangeRegistrar profile_pref_registrar_
;
66 // Updates the visibility of the apps shortcut based on the pref value.
67 void OnAppsPageShortcutVisibilityPrefChanged();
69 DISALLOW_COPY_AND_ASSIGN(BookmarkBarBridge
);
72 #endif // CHROME_BROWSER_UI_COCOA_BOOKMARKS_BOOKMARK_BAR_BRIDGE_H_