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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 | 286 |
296 // ProfileSyncServiceObserver method. | 287 // ProfileSyncServiceObserver method. |
297 virtual void OnStateChanged(); | 288 virtual void OnStateChanged(); |
298 | 289 |
299 // Overriden from BookmarkBarInstructionsGtk::Delegate. | 290 // Overriden from BookmarkBarInstructionsGtk::Delegate. |
300 virtual void ShowImportDialog(); | 291 virtual void ShowImportDialog(); |
301 | 292 |
302 // Updates the drag&drop state when |edit_bookmarks_enabled_| changes. | 293 // Updates the drag&drop state when |edit_bookmarks_enabled_| changes. |
303 void OnEditBookmarksEnabledChanged(); | 294 void OnEditBookmarksEnabledChanged(); |
304 | 295 |
305 Profile* profile_; | |
306 | |
307 // Used for opening urls. | 296 // Used for opening urls. |
308 PageNavigator* page_navigator_; | 297 PageNavigator* page_navigator_; |
309 | 298 |
310 Browser* browser_; | 299 Browser* browser_; |
311 BrowserWindowGtk* window_; | 300 BrowserWindowGtk* window_; |
312 | 301 |
313 // Provides us with the offset into the background theme image. | 302 // Provides us with the offset into the background theme image. |
314 TabstripOriginProvider* tabstrip_origin_provider_; | 303 TabstripOriginProvider* tabstrip_origin_provider_; |
315 | 304 |
316 // Model providing details as to the starred entries/folders that should be | 305 // 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_; | 400 BooleanPrefMember edit_bookmarks_enabled_; |
412 | 401 |
413 ScopedRunnableMethodFactory<BookmarkBarGtk> method_factory_; | 402 ScopedRunnableMethodFactory<BookmarkBarGtk> method_factory_; |
414 | 403 |
415 BookmarkBar::State bookmark_bar_state_; | 404 BookmarkBar::State bookmark_bar_state_; |
416 | 405 |
417 DISALLOW_COPY_AND_ASSIGN(BookmarkBarGtk); | 406 DISALLOW_COPY_AND_ASSIGN(BookmarkBarGtk); |
418 }; | 407 }; |
419 | 408 |
420 #endif // CHROME_BROWSER_UI_GTK_BOOKMARKS_BOOKMARK_BAR_GTK_H_ | 409 #endif // CHROME_BROWSER_UI_GTK_BOOKMARKS_BOOKMARK_BAR_GTK_H_ |
OLD | NEW |