15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved. 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file. 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef CHROME_BROWSER_UI_GTK_BOOKMARKS_BOOKMARK_BAR_GTK_H_ 65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define CHROME_BROWSER_UI_GTK_BOOKMARKS_BOOKMARK_BAR_GTK_H_ 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <gtk/gtk.h> 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <vector> 115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/compiler_specific.h" 135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/gtest_prod_util.h" 145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/memory/scoped_ptr.h" 155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/memory/weak_ptr.h" 162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "base/prefs/pref_member.h" 175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/bookmarks/bookmark_model_observer.h" 1868043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)#include "chrome/browser/bookmarks/bookmark_stats.h" 195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/ui/bookmarks/bookmark_bar.h" 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/ui/bookmarks/bookmark_bar_instructions_delegate.h" 215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/ui/bookmarks/bookmark_context_menu_controller.h" 225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/ui/gtk/menu_bar_helper.h" 235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/public/browser/notification_observer.h" 245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "content/public/browser/notification_registrar.h" 255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/base/gtk/gtk_signal.h" 265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/base/gtk/owned_widget_gtk.h" 27d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)#include "ui/gfx/animation/animation.h" 28d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)#include "ui/gfx/animation/animation_delegate.h" 29d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)#include "ui/gfx/animation/slide_animation.h" 305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/gfx/point.h" 315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/gfx/size.h" 325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class BookmarkBarInstructionsGtk; 345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class BookmarkMenuController; 355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class Browser; 365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class BrowserWindowGtk; 375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class GtkThemeService; 385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class MenuGtk; 395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class TabstripOriginProvider; 405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace content { 425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class PageNavigator; 435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 45d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)class BookmarkBarGtk : public gfx::AnimationDelegate, 465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public BookmarkModelObserver, 475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public MenuBarHelper::Delegate, 485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public content::NotificationObserver, 49d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) public BookmarkBarInstructionsDelegate, 505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public BookmarkContextMenuControllerDelegate { 515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public: 525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) BookmarkBarGtk(BrowserWindowGtk* window, 535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) Browser* browser, 545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) TabstripOriginProvider* tabstrip_origin_provider); 555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual ~BookmarkBarGtk(); 565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns the current browser. 585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) Browser* browser() const { return browser_; } 595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns the top level widget. 615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GtkWidget* widget() const { return event_box_.get(); } 625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Sets the PageNavigator that is used when the user selects an entry on 645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // the bookmark bar. 655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void SetPageNavigator(content::PageNavigator* navigator); 665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Create the contents of the bookmark bar. 685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void Init(); 695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Changes the state of the bookmark bar. 715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void SetBookmarkBarState(BookmarkBar::State state, 725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) BookmarkBar::AnimateChangeType animate_type); 735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Get the current height of the bookmark bar. 755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int GetHeight(); 765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns true if the bookmark bar is showing an animation. 785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool IsAnimating(); 795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 80d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) // gfx::AnimationDelegate implementation ------------------------------------- 81d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) virtual void AnimationProgressed(const gfx::Animation* animation) OVERRIDE; 82d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) virtual void AnimationEnded(const gfx::Animation* animation) OVERRIDE; 835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // MenuBarHelper::Delegate implementation ------------------------------------ 855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void PopupForButton(GtkWidget* button) OVERRIDE; 865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void PopupForButtonNextTo(GtkWidget* button, 875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GtkMenuDirectionType dir) OVERRIDE; 885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // BookmarkContextMenuController::Delegate implementation -------------------- 905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void CloseMenu() OVERRIDE; 915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 92d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) const gfx::Animation* animation() { return &slide_animation_; } 935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 94424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) int max_height() const { return max_height_; } 95424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) 965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) private: 975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) FRIEND_TEST_ALL_PREFIXES(BookmarkBarGtkUnittest, DisplaysHelpMessageOnEmpty); 985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) FRIEND_TEST_ALL_PREFIXES(BookmarkBarGtkUnittest, 995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) HidesHelpMessageWithBookmark); 1005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) FRIEND_TEST_ALL_PREFIXES(BookmarkBarGtkUnittest, BuildsButtons); 1015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Change the visibility of the bookmarks bar. (Starts out hidden, per GTK's 1035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // default behaviour). There are three visiblity states: 1045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // 1055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Showing - bookmark bar is fully visible. 1065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Hidden - bookmark bar is hidden except for a few pixels that give 1075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // extra padding to the bottom of the toolbar. Buttons are not 1085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // clickable. 1095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Fullscreen - bookmark bar is fully hidden. 1105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void Show(BookmarkBar::State old_state, 1115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) BookmarkBar::AnimateChangeType animate_type); 1125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void Hide(BookmarkBar::State old_state, 1135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) BookmarkBar::AnimateChangeType animate_type); 1145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Calculate maximum height of bookmark bar. 1165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void CalculateMaxHeight(); 1175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Helper function which generates GtkToolItems for |bookmark_toolbar_|. 1195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void CreateAllBookmarkButtons(); 1205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Sets the visibility of the instructional text based on whether there are 1225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // any bookmarks in the bookmark bar node. 1235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void SetInstructionState(); 1245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Sets the visibility of the overflow chevron. 1265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void SetChevronState(); 1275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Shows or hides the other bookmarks button depending on whether there are 1295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // bookmarks in it. 1305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void UpdateOtherBookmarksVisibility(); 1315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Destroys all the bookmark buttons in the GtkToolbar. 1335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void RemoveAllButtons(); 1345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Adds the "other bookmarks" and overflow buttons. 1365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void AddCoreButtons(); 1375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Removes and recreates all buttons in the bar. 1395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void ResetButtons(); 1405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns the number of buttons corresponding to starred urls/folders. This 1425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // is equivalent to the number of children the bookmark bar node from the 1435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // bookmark bar model has. 1445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int GetBookmarkButtonCount(); 1455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 14668043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) // Returns BOOKMARK_LAUNCH_LOCATION_DETACHED_BAR or 14768043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) // BOOKMARK_LAUNCH_LOCATION_ATTACHED_BAR based on detached state. 14868043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles) BookmarkLaunchLocation GetBookmarkLaunchLocation() const; 1492a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Set the appearance of the overflow button appropriately (either chromium 1515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // style or GTK style). 1525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void SetOverflowButtonAppearance(); 1535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns the index of the first bookmark that is not visible on the bar. 1555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns -1 if they are all visible. 1565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // |extra_space| is how much extra space to give the toolbar during the 1575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // calculation (for the purposes of determining if ditching the chevron 1585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // would be a good idea). 1595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // If non-NULL, |showing_folders| will be packed with all the folders that are 1605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // showing on the bar. 1615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int GetFirstHiddenBookmark(int extra_space, 1625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) std::vector<GtkWidget*>* showing_folders); 1635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Update the detached state (either enable or disable it, or do nothing). 1655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void UpdateDetachedState(BookmarkBar::State old_state); 1665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Turns on or off the app_paintable flag on |event_box_|, depending on our 1685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // state. 1695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void UpdateEventBoxPaintability(); 1705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Queue a paint on the event box. 1725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void PaintEventBox(); 1735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1742a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Finds the size of the current web contents, if it exists and sets |size| 1755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // to the correct value. Returns false if there isn't a WebContents, a 1765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // condition that can happen during testing. 1772a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) bool GetWebContentsSize(gfx::Size* size); 1785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Connects to the "size-allocate" signal on the given widget, and causes it 1805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // to throb after allocation. This is called when a new item is added to the 1815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // bar. We can't call StartThrobbing directly because we don't know if it's 1825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // visible or not until after the widget is allocated. 1835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void StartThrobbingAfterAllocation(GtkWidget* item); 1845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Used by StartThrobbingAfterAllocation. 1865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) CHROMEGTK_CALLBACK_1(BookmarkBarGtk, void, OnItemAllocate, GtkAllocation*); 1875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Makes the appropriate widget on the bookmark bar stop throbbing 1895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // (a folder, the overflow chevron, or nothing). 1905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void StartThrobbing(const BookmarkNode* node); 1915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Set |throbbing_widget_| to |widget|. Also makes sure that 1935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // |throbbing_widget_| doesn't become stale. 1945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void SetThrobbingWidget(GtkWidget* widget); 1955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // An item has been dragged over the toolbar, update the drag context 1975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // and toolbar UI appropriately. 1985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) gboolean ItemDraggedOverToolbar( 1995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GdkDragContext* context, int index, guint time); 2005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // When dragging in the middle of a folder, assume the user wants to drop 2025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // on the folder. Towards the edges, assume the user wants to drop on the 2035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // toolbar. This makes it possible to drop between two folders. This function 2045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // returns the index on the toolbar the drag should target, or -1 if the 2055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // drag should hit the folder. 2065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int GetToolbarIndexForDragOverFolder(GtkWidget* button, gint x); 2075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void ClearToolbarDropHighlighting(); 2095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Overridden from BookmarkModelObserver: 2115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Invoked when the bookmark model has finished loading. Creates a button 2135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // for each of the children of the root node from the model. 2145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void Loaded(BookmarkModel* model, bool ids_reassigned) OVERRIDE; 2155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Invoked when the model is being deleted. 2175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void BookmarkModelBeingDeleted(BookmarkModel* model) OVERRIDE; 2185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Invoked when a node has moved. 2205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void BookmarkNodeMoved(BookmarkModel* model, 2215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const BookmarkNode* old_parent, 2225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int old_index, 2235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const BookmarkNode* new_parent, 2245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int new_index) OVERRIDE; 2255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void BookmarkNodeAdded(BookmarkModel* model, 2265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const BookmarkNode* parent, 2275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int index) OVERRIDE; 2285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void BookmarkNodeRemoved(BookmarkModel* model, 2295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const BookmarkNode* parent, 2305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int old_index, 2315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const BookmarkNode* node) OVERRIDE; 232c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) virtual void BookmarkAllNodesRemoved(BookmarkModel* model) OVERRIDE; 2335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void BookmarkNodeChanged(BookmarkModel* model, 2345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const BookmarkNode* node) OVERRIDE; 2355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Invoked when a favicon has finished loading. 2365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void BookmarkNodeFaviconChanged(BookmarkModel* model, 2375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const BookmarkNode* node) OVERRIDE; 2385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void BookmarkNodeChildrenReordered(BookmarkModel* model, 2395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const BookmarkNode* node) OVERRIDE; 2405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Overridden from content::NotificationObserver: 2425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void Observe(int type, 2435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const content::NotificationSource& source, 2445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const content::NotificationDetails& details) OVERRIDE; 2455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GtkWidget* CreateBookmarkButton(const BookmarkNode* node); 2475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GtkToolItem* CreateBookmarkToolItem(const BookmarkNode* node); 2485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void ConnectFolderButtonEvents(GtkWidget* widget, bool is_tool_item); 2505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Finds the BookmarkNode from the model associated with |button|. 2525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const BookmarkNode* GetNodeForToolButton(GtkWidget* button); 2535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Creates and displays a popup menu for BookmarkNode |node|. 2555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void PopupMenuForNode(GtkWidget* sender, const BookmarkNode* node, 2565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GdkEventButton* event); 2575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // GtkButton callbacks. 2595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) CHROMEGTK_CALLBACK_1(BookmarkBarGtk, gboolean, OnButtonPressed, 2605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GdkEventButton*); 2615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) CHROMEGTK_CALLBACK_0(BookmarkBarGtk, void, OnClicked); 2625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) CHROMEGTK_CALLBACK_1(BookmarkBarGtk, void, OnButtonDragBegin, 2635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GdkDragContext*); 2645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) CHROMEGTK_CALLBACK_1(BookmarkBarGtk, void, OnButtonDragEnd, GdkDragContext*); 2655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) CHROMEGTK_CALLBACK_4(BookmarkBarGtk, void, OnButtonDragGet, 2665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GdkDragContext*, GtkSelectionData*, guint, guint); 2675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // GtkButton callbacks for folder buttons. 2695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) CHROMEGTK_CALLBACK_0(BookmarkBarGtk, void, OnFolderClicked); 2705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2717dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // GtkButton callback for apps button. 2727dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch CHROMEGTK_CALLBACK_0(BookmarkBarGtk, void, OnAppsButtonClicked); 2737dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 2745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // GtkToolbar callbacks. 2755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) CHROMEGTK_CALLBACK_4(BookmarkBarGtk, gboolean, OnToolbarDragMotion, 2765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GdkDragContext*, gint, gint, guint); 2775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) CHROMEGTK_CALLBACK_1(BookmarkBarGtk, void, OnToolbarSizeAllocate, 2785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GtkAllocation*); 2795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Used for both folder buttons and the toolbar. 2815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) CHROMEGTK_CALLBACK_6(BookmarkBarGtk, void, OnDragReceived, 2825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GdkDragContext*, gint, gint, GtkSelectionData*, 2835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) guint, guint); 2845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) CHROMEGTK_CALLBACK_2(BookmarkBarGtk, void, OnDragLeave, 2855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GdkDragContext*, guint); 2865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Used for folder buttons. 2885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) CHROMEGTK_CALLBACK_4(BookmarkBarGtk, gboolean, OnFolderDragMotion, 2895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GdkDragContext*, gint, gint, guint); 2905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // GtkEventBox callbacks. 2925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) CHROMEGTK_CALLBACK_1(BookmarkBarGtk, gboolean, OnEventBoxExpose, 2935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GdkEventExpose*); 2945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) CHROMEGTK_CALLBACK_0(BookmarkBarGtk, void, OnEventBoxDestroy); 2955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Callbacks on our parent widget. 2975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) CHROMEGTK_CALLBACK_1(BookmarkBarGtk, void, OnParentSizeAllocate, 2985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GtkAllocation*); 2995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // |throbbing_widget_| callback. 3015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) CHROMEGTK_CALLBACK_0(BookmarkBarGtk, void, OnThrobbingWidgetDestroy); 3025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 303d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) // Overriden from BookmarkBarInstructionsDelegate: 3045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void ShowImportDialog() OVERRIDE; 3055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3067dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // Updates the visibility of the apps shortcut button |apps_shortcut_visible_| 3077dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // changes. 3087dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch void OnAppsPageShortcutVisibilityChanged(); 3097dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 3105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Updates the drag&drop state when |edit_bookmarks_enabled_| changes. 3115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void OnEditBookmarksEnabledChanged(); 3125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Used for opening urls. 3145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) content::PageNavigator* page_navigator_; 3155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) Browser* browser_; 3175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) BrowserWindowGtk* window_; 3185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Provides us with the offset into the background theme image. 3205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) TabstripOriginProvider* tabstrip_origin_provider_; 3215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Model providing details as to the starred entries/folders that should be 3235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // shown. This is owned by the Profile. 3245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) BookmarkModel* model_; 3255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Contains |bookmark_hbox_|. Event box exists to prevent leakage of 3275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // background color from the toplevel application window's GDK window. 3285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) ui::OwnedWidgetGtk event_box_; 3295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Used to detached the bookmark bar when on the NTP. 3315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GtkWidget* ntp_padding_box_; 3325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Used to paint the background of the bookmark bar when in detached mode. 3345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GtkWidget* paint_box_; 3355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Used to position all children. 3375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GtkWidget* bookmark_hbox_; 3385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Alignment widget that is visible if there are no bookmarks on 3405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // the bookmar bar. 3415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GtkWidget* instructions_; 3425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // BookmarkBarInstructionsGtk that holds the label and the link for importing 3445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // bookmarks when there are no bookmarks on the bookmark bar. 3455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) scoped_ptr<BookmarkBarInstructionsGtk> instructions_gtk_; 3465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3477dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // The apps page shortcut button. 3487dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch GtkWidget* apps_shortcut_button_; 3497dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 3505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // GtkToolbar which contains all the bookmark buttons. 3515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) ui::OwnedWidgetGtk bookmark_toolbar_; 3525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // The button that shows extra bookmarks that don't fit on the bookmark 3545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // bar. 3555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GtkWidget* overflow_button_; 3565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // A separator between the main bookmark bar area and 3585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // |other_bookmarks_button_|. 3595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GtkWidget* other_bookmarks_separator_; 3605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // The other bookmarks button. 3625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GtkWidget* other_bookmarks_button_; 3635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Padding for the other bookmarks button. 3655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GtkWidget* other_padding_; 3665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // The BookmarkNode from the model being dragged. NULL when we aren't 3685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // dragging. 3695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const BookmarkNode* dragged_node_; 3705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // The visual representation that follows the cursor during drags. 3725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GtkWidget* drag_icon_; 3735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // We create a GtkToolbarItem from |dragged_node_| ;or display. 3755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GtkToolItem* toolbar_drop_item_; 3765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Theme provider for building buttons. 3785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GtkThemeService* theme_service_; 3795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Whether we should show the instructional text in the bookmark bar. 3815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool show_instructions_; 3825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) MenuBarHelper menu_bar_helper_; 3845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // The last displayed right click menu, or NULL if no menus have been 3865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // displayed yet. 3875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // The controller. 3885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) scoped_ptr<BookmarkContextMenuController> current_context_menu_controller_; 3895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // The view. 3905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) scoped_ptr<MenuGtk> current_context_menu_; 3915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // The last displayed left click menu, or NULL if no menus have been 3935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // displayed yet. 3945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) scoped_ptr<BookmarkMenuController> current_menu_; 3955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 396d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) gfx::SlideAnimation slide_animation_; 3975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Used to optimize out |bookmark_toolbar_| size-allocate events we don't 3995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // need to respond to. 4005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int last_allocation_width_; 4015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) content::NotificationRegistrar registrar_; 4035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4042a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // The size of the web contents last time we forced a paint. We keep track 4055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // of this so we don't force too many paints. 4062a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) gfx::Size last_web_contents_size_; 4075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // The last coordinates recorded by OnButtonPress; used to line up the 4095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // drag icon during bookmark drags. 4105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) gfx::Point last_pressed_coordinates_; 4115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // The currently throbbing widget. This is NULL if no widget is throbbing. 4135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // We track it because we only want to allow one widget to throb at a time. 4145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GtkWidget* throbbing_widget_; 4155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4167dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch // Tracks whether the apps shortcut button should be shown. 4177dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch BooleanPrefMember apps_shortcut_visible_; 4187dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch 4195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Tracks whether bookmarks can be modified. 4205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) BooleanPrefMember edit_bookmarks_enabled_; 4215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) BookmarkBar::State bookmark_bar_state_; 4235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Maximum height of the bookmark bar. 4255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int max_height_; 4265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4274e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) base::WeakPtrFactory<BookmarkBarGtk> weak_factory_; 4284e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 4295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(BookmarkBarGtk); 4305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 4315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif // CHROME_BROWSER_UI_GTK_BOOKMARKS_BOOKMARK_BAR_GTK_H_ 433