OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_UI_GTK_BOOKMARKS_BOOKMARK_BAR_GTK_H_ | 5 #ifndef CHROME_BROWSER_UI_GTK_BOOKMARKS_BOOKMARK_BAR_GTK_H_ |
6 #define CHROME_BROWSER_UI_GTK_BOOKMARKS_BOOKMARK_BAR_GTK_H_ | 6 #define CHROME_BROWSER_UI_GTK_BOOKMARKS_BOOKMARK_BAR_GTK_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "ui/gfx/point.h" | 30 #include "ui/gfx/point.h" |
31 #include "ui/gfx/size.h" | 31 #include "ui/gfx/size.h" |
32 | 32 |
33 class BookmarkMenuController; | 33 class BookmarkMenuController; |
34 class Browser; | 34 class Browser; |
35 class BrowserWindowGtk; | 35 class BrowserWindowGtk; |
36 class CustomContainerButton; | 36 class CustomContainerButton; |
37 class GtkThemeService; | 37 class GtkThemeService; |
38 class MenuGtk; | 38 class MenuGtk; |
39 class PageNavigator; | 39 class PageNavigator; |
40 class Profile; | |
41 class TabstripOriginProvider; | 40 class TabstripOriginProvider; |
42 | 41 |
43 class BookmarkBarGtk : public ui::AnimationDelegate, | 42 class BookmarkBarGtk : public ui::AnimationDelegate, |
44 public ProfileSyncServiceObserver, | 43 public ProfileSyncServiceObserver, |
45 public BookmarkModelObserver, | 44 public BookmarkModelObserver, |
46 public MenuBarHelper::Delegate, | 45 public MenuBarHelper::Delegate, |
47 public NotificationObserver, | 46 public NotificationObserver, |
48 public BookmarkBarInstructionsGtk::Delegate, | 47 public BookmarkBarInstructionsGtk::Delegate, |
49 public BookmarkContextMenuControllerDelegate { | 48 public BookmarkContextMenuControllerDelegate { |
50 public: | 49 public: |
51 // The NTP needs to have access to this. | 50 // The NTP needs to have access to this. |
52 static const int kBookmarkBarNTPHeight; | 51 static const int kBookmarkBarNTPHeight; |
53 | 52 |
54 BookmarkBarGtk(BrowserWindowGtk* window, | 53 BookmarkBarGtk(BrowserWindowGtk* window, |
55 Profile* profile, | |
56 Browser* browser, | 54 Browser* browser, |
57 TabstripOriginProvider* tabstrip_origin_provider); | 55 TabstripOriginProvider* tabstrip_origin_provider); |
58 virtual ~BookmarkBarGtk(); | 56 virtual ~BookmarkBarGtk(); |
59 | 57 |
60 // Resets the profile. This removes any buttons for the current profile and | |
61 // recreates the models. | |
62 void SetProfile(Profile* profile); | |
63 | |
64 // Returns the current profile. | |
65 Profile* GetProfile() { return profile_; } | |
66 | |
67 // Returns the current browser. | 58 // Returns the current browser. |
68 Browser* browser() const { return browser_; } | 59 Browser* browser() const { return browser_; } |
69 | 60 |
70 // Returns the top level widget. | 61 // Returns the top level widget. |
71 GtkWidget* widget() const { return event_box_.get(); } | 62 GtkWidget* widget() const { return event_box_.get(); } |
72 | 63 |
73 // Sets the PageNavigator that is used when the user selects an entry on | 64 // Sets the PageNavigator that is used when the user selects an entry on |
74 // the bookmark bar. | 65 // the bookmark bar. |
75 void SetPageNavigator(PageNavigator* navigator); | 66 void SetPageNavigator(PageNavigator* navigator); |
76 | 67 |
77 // Create the contents of the bookmark bar. | 68 // Create the contents of the bookmark bar. |
78 void Init(Profile* profile); | 69 void Init(); |
79 | 70 |
80 // Changes the state of the bookmark bar. | 71 // Changes the state of the bookmark bar. |
81 void SetBookmarkBarState(BookmarkBar::State state, | 72 void SetBookmarkBarState(BookmarkBar::State state, |
82 BookmarkBar::AnimateChangeType animate_type); | 73 BookmarkBar::AnimateChangeType animate_type); |
83 | 74 |
84 // Get the current height of the bookmark bar. | 75 // Get the current height of the bookmark bar. |
85 int GetHeight(); | 76 int GetHeight(); |
86 | 77 |
87 // Returns true if the bookmark bar is showing an animation. | 78 // Returns true if the bookmark bar is showing an animation. |
88 bool IsAnimating(); | 79 bool IsAnimating(); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 // any bookmarks in the bookmark bar node. | 118 // any bookmarks in the bookmark bar node. |
128 void SetInstructionState(); | 119 void SetInstructionState(); |
129 | 120 |
130 // Sets the visibility of the overflow chevron. | 121 // Sets the visibility of the overflow chevron. |
131 void SetChevronState(); | 122 void SetChevronState(); |
132 | 123 |
133 // Shows or hides the other bookmarks button depending on whether there are | 124 // Shows or hides the other bookmarks button depending on whether there are |
134 // bookmarks in it. | 125 // bookmarks in it. |
135 void UpdateOtherBookmarksVisibility(); | 126 void UpdateOtherBookmarksVisibility(); |
136 | 127 |
137 // Helper function which destroys all the bookmark buttons in the GtkToolbar. | 128 // Destroys all the bookmark buttons in the GtkToolbar. |
138 void RemoveAllBookmarkButtons(); | 129 void RemoveAllButtons(); |
| 130 |
| 131 // Adds the "other bookmarks" and overflow buttons. |
| 132 void AddCoreButtons(); |
| 133 |
| 134 // Removes and recreates all buttons in the bar. |
| 135 void ResetButtons(); |
139 | 136 |
140 // Returns the number of buttons corresponding to starred urls/folders. This | 137 // Returns the number of buttons corresponding to starred urls/folders. This |
141 // is equivalent to the number of children the bookmark bar node from the | 138 // is equivalent to the number of children the bookmark bar node from the |
142 // bookmark bar model has. | 139 // bookmark bar model has. |
143 int GetBookmarkButtonCount(); | 140 int GetBookmarkButtonCount(); |
144 | 141 |
145 // Set the appearance of the overflow button appropriately (either chromium | 142 // Set the appearance of the overflow button appropriately (either chromium |
146 // style or GTK style). | 143 // style or GTK style). |
147 void SetOverflowButtonAppearance(); | 144 void SetOverflowButtonAppearance(); |
148 | 145 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 | 292 |
296 // ProfileSyncServiceObserver method. | 293 // ProfileSyncServiceObserver method. |
297 virtual void OnStateChanged(); | 294 virtual void OnStateChanged(); |
298 | 295 |
299 // Overriden from BookmarkBarInstructionsGtk::Delegate. | 296 // Overriden from BookmarkBarInstructionsGtk::Delegate. |
300 virtual void ShowImportDialog(); | 297 virtual void ShowImportDialog(); |
301 | 298 |
302 // Updates the drag&drop state when |edit_bookmarks_enabled_| changes. | 299 // Updates the drag&drop state when |edit_bookmarks_enabled_| changes. |
303 void OnEditBookmarksEnabledChanged(); | 300 void OnEditBookmarksEnabledChanged(); |
304 | 301 |
305 Profile* profile_; | |
306 | |
307 // Used for opening urls. | 302 // Used for opening urls. |
308 PageNavigator* page_navigator_; | 303 PageNavigator* page_navigator_; |
309 | 304 |
310 Browser* browser_; | 305 Browser* browser_; |
311 BrowserWindowGtk* window_; | 306 BrowserWindowGtk* window_; |
312 | 307 |
313 // Provides us with the offset into the background theme image. | 308 // Provides us with the offset into the background theme image. |
314 TabstripOriginProvider* tabstrip_origin_provider_; | 309 TabstripOriginProvider* tabstrip_origin_provider_; |
315 | 310 |
316 // Model providing details as to the starred entries/folders that should be | 311 // Model providing details as to the starred entries/folders that should be |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 BooleanPrefMember edit_bookmarks_enabled_; | 406 BooleanPrefMember edit_bookmarks_enabled_; |
412 | 407 |
413 ScopedRunnableMethodFactory<BookmarkBarGtk> method_factory_; | 408 ScopedRunnableMethodFactory<BookmarkBarGtk> method_factory_; |
414 | 409 |
415 BookmarkBar::State bookmark_bar_state_; | 410 BookmarkBar::State bookmark_bar_state_; |
416 | 411 |
417 DISALLOW_COPY_AND_ASSIGN(BookmarkBarGtk); | 412 DISALLOW_COPY_AND_ASSIGN(BookmarkBarGtk); |
418 }; | 413 }; |
419 | 414 |
420 #endif // CHROME_BROWSER_UI_GTK_BOOKMARKS_BOOKMARK_BAR_GTK_H_ | 415 #endif // CHROME_BROWSER_UI_GTK_BOOKMARKS_BOOKMARK_BAR_GTK_H_ |
OLD | NEW |