| 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 |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/compiler_specific.h" |
| 13 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
| 14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 16 #include "chrome/browser/bookmarks/bookmark_context_menu_controller.h" | 17 #include "chrome/browser/bookmarks/bookmark_context_menu_controller.h" |
| 17 #include "chrome/browser/bookmarks/bookmark_model_observer.h" | 18 #include "chrome/browser/bookmarks/bookmark_model_observer.h" |
| 18 #include "chrome/browser/prefs/pref_member.h" | 19 #include "chrome/browser/prefs/pref_member.h" |
| 19 #include "chrome/browser/ui/bookmarks/bookmark_bar.h" | 20 #include "chrome/browser/ui/bookmarks/bookmark_bar.h" |
| 20 #include "chrome/browser/ui/gtk/bookmarks/bookmark_bar_instructions_gtk.h" | 21 #include "chrome/browser/ui/gtk/bookmarks/bookmark_bar_instructions_gtk.h" |
| 21 #include "chrome/browser/ui/gtk/menu_bar_helper.h" | 22 #include "chrome/browser/ui/gtk/menu_bar_helper.h" |
| 22 #include "chrome/browser/ui/gtk/view_id_util.h" | 23 #include "chrome/browser/ui/gtk/view_id_util.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 void SetBookmarkBarState(BookmarkBar::State state, | 71 void SetBookmarkBarState(BookmarkBar::State state, |
| 71 BookmarkBar::AnimateChangeType animate_type); | 72 BookmarkBar::AnimateChangeType animate_type); |
| 72 | 73 |
| 73 // Get the current height of the bookmark bar. | 74 // Get the current height of the bookmark bar. |
| 74 int GetHeight(); | 75 int GetHeight(); |
| 75 | 76 |
| 76 // Returns true if the bookmark bar is showing an animation. | 77 // Returns true if the bookmark bar is showing an animation. |
| 77 bool IsAnimating(); | 78 bool IsAnimating(); |
| 78 | 79 |
| 79 // ui::AnimationDelegate implementation -------------------------------------- | 80 // ui::AnimationDelegate implementation -------------------------------------- |
| 80 virtual void AnimationProgressed(const ui::Animation* animation); | 81 virtual void AnimationProgressed(const ui::Animation* animation) OVERRIDE; |
| 81 virtual void AnimationEnded(const ui::Animation* animation); | 82 virtual void AnimationEnded(const ui::Animation* animation) OVERRIDE; |
| 82 | 83 |
| 83 // MenuBarHelper::Delegate implementation ------------------------------------ | 84 // MenuBarHelper::Delegate implementation ------------------------------------ |
| 84 virtual void PopupForButton(GtkWidget* button); | 85 virtual void PopupForButton(GtkWidget* button) OVERRIDE; |
| 85 virtual void PopupForButtonNextTo(GtkWidget* button, | 86 virtual void PopupForButtonNextTo(GtkWidget* button, |
| 86 GtkMenuDirectionType dir); | 87 GtkMenuDirectionType dir) OVERRIDE; |
| 87 | 88 |
| 88 // BookmarkContextMenuController::Delegate implementation -------------------- | 89 // BookmarkContextMenuController::Delegate implementation -------------------- |
| 89 virtual void CloseMenu(); | 90 virtual void CloseMenu() OVERRIDE; |
| 90 | 91 |
| 91 const ui::Animation* animation() { return &slide_animation_; } | 92 const ui::Animation* animation() { return &slide_animation_; } |
| 92 | 93 |
| 93 private: | 94 private: |
| 94 FRIEND_TEST_ALL_PREFIXES(BookmarkBarGtkUnittest, DisplaysHelpMessageOnEmpty); | 95 FRIEND_TEST_ALL_PREFIXES(BookmarkBarGtkUnittest, DisplaysHelpMessageOnEmpty); |
| 95 FRIEND_TEST_ALL_PREFIXES(BookmarkBarGtkUnittest, | 96 FRIEND_TEST_ALL_PREFIXES(BookmarkBarGtkUnittest, |
| 96 HidesHelpMessageWithBookmark); | 97 HidesHelpMessageWithBookmark); |
| 97 FRIEND_TEST_ALL_PREFIXES(BookmarkBarGtkUnittest, BuildsButtons); | 98 FRIEND_TEST_ALL_PREFIXES(BookmarkBarGtkUnittest, BuildsButtons); |
| 98 | 99 |
| 99 // Change the visibility of the bookmarks bar. (Starts out hidden, per GTK's | 100 // Change the visibility of the bookmarks bar. (Starts out hidden, per GTK's |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 const BookmarkNode* node) OVERRIDE; | 227 const BookmarkNode* node) OVERRIDE; |
| 227 // Invoked when a favicon has finished loading. | 228 // Invoked when a favicon has finished loading. |
| 228 virtual void BookmarkNodeFaviconChanged(BookmarkModel* model, | 229 virtual void BookmarkNodeFaviconChanged(BookmarkModel* model, |
| 229 const BookmarkNode* node) OVERRIDE; | 230 const BookmarkNode* node) OVERRIDE; |
| 230 virtual void BookmarkNodeChildrenReordered(BookmarkModel* model, | 231 virtual void BookmarkNodeChildrenReordered(BookmarkModel* model, |
| 231 const BookmarkNode* node) OVERRIDE; | 232 const BookmarkNode* node) OVERRIDE; |
| 232 | 233 |
| 233 // Overridden from content::NotificationObserver: | 234 // Overridden from content::NotificationObserver: |
| 234 virtual void Observe(int type, | 235 virtual void Observe(int type, |
| 235 const content::NotificationSource& source, | 236 const content::NotificationSource& source, |
| 236 const content::NotificationDetails& details); | 237 const content::NotificationDetails& details) OVERRIDE; |
| 237 | 238 |
| 238 GtkWidget* CreateBookmarkButton(const BookmarkNode* node); | 239 GtkWidget* CreateBookmarkButton(const BookmarkNode* node); |
| 239 GtkToolItem* CreateBookmarkToolItem(const BookmarkNode* node); | 240 GtkToolItem* CreateBookmarkToolItem(const BookmarkNode* node); |
| 240 | 241 |
| 241 void ConnectFolderButtonEvents(GtkWidget* widget, bool is_tool_item); | 242 void ConnectFolderButtonEvents(GtkWidget* widget, bool is_tool_item); |
| 242 | 243 |
| 243 // Finds the BookmarkNode from the model associated with |button|. | 244 // Finds the BookmarkNode from the model associated with |button|. |
| 244 const BookmarkNode* GetNodeForToolButton(GtkWidget* button); | 245 const BookmarkNode* GetNodeForToolButton(GtkWidget* button); |
| 245 | 246 |
| 246 // Creates and displays a popup menu for BookmarkNode |node|. | 247 // Creates and displays a popup menu for BookmarkNode |node|. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 CHROMEGTK_CALLBACK_0(BookmarkBarGtk, void, OnEventBoxDestroy); | 284 CHROMEGTK_CALLBACK_0(BookmarkBarGtk, void, OnEventBoxDestroy); |
| 284 | 285 |
| 285 // Callbacks on our parent widget. | 286 // Callbacks on our parent widget. |
| 286 CHROMEGTK_CALLBACK_1(BookmarkBarGtk, void, OnParentSizeAllocate, | 287 CHROMEGTK_CALLBACK_1(BookmarkBarGtk, void, OnParentSizeAllocate, |
| 287 GtkAllocation*); | 288 GtkAllocation*); |
| 288 | 289 |
| 289 // |throbbing_widget_| callback. | 290 // |throbbing_widget_| callback. |
| 290 CHROMEGTK_CALLBACK_0(BookmarkBarGtk, void, OnThrobbingWidgetDestroy); | 291 CHROMEGTK_CALLBACK_0(BookmarkBarGtk, void, OnThrobbingWidgetDestroy); |
| 291 | 292 |
| 292 // Overriden from BookmarkBarInstructionsGtk::Delegate. | 293 // Overriden from BookmarkBarInstructionsGtk::Delegate. |
| 293 virtual void ShowImportDialog(); | 294 virtual void ShowImportDialog() OVERRIDE; |
| 294 | 295 |
| 295 // Updates the drag&drop state when |edit_bookmarks_enabled_| changes. | 296 // Updates the drag&drop state when |edit_bookmarks_enabled_| changes. |
| 296 void OnEditBookmarksEnabledChanged(); | 297 void OnEditBookmarksEnabledChanged(); |
| 297 | 298 |
| 298 // Used for opening urls. | 299 // Used for opening urls. |
| 299 PageNavigator* page_navigator_; | 300 PageNavigator* page_navigator_; |
| 300 | 301 |
| 301 Browser* browser_; | 302 Browser* browser_; |
| 302 BrowserWindowGtk* window_; | 303 BrowserWindowGtk* window_; |
| 303 | 304 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 | 403 |
| 403 BookmarkBar::State bookmark_bar_state_; | 404 BookmarkBar::State bookmark_bar_state_; |
| 404 | 405 |
| 405 // Maximum height of the bookmark bar. | 406 // Maximum height of the bookmark bar. |
| 406 int max_height_; | 407 int max_height_; |
| 407 | 408 |
| 408 DISALLOW_COPY_AND_ASSIGN(BookmarkBarGtk); | 409 DISALLOW_COPY_AND_ASSIGN(BookmarkBarGtk); |
| 409 }; | 410 }; |
| 410 | 411 |
| 411 #endif // CHROME_BROWSER_UI_GTK_BOOKMARKS_BOOKMARK_BAR_GTK_H_ | 412 #endif // CHROME_BROWSER_UI_GTK_BOOKMARKS_BOOKMARK_BAR_GTK_H_ |
| OLD | NEW |