Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(592)

Side by Side Diff: chrome/browser/views/bookmark_bar_view.h

Issue 328012: Makes it so that when a folder is open on the bookmark bar and the... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/views/bookmark_bar_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_VIEWS_BOOKMARK_BAR_VIEW_H_ 5 #ifndef CHROME_BROWSER_VIEWS_BOOKMARK_BAR_VIEW_H_
6 #define CHROME_BROWSER_VIEWS_BOOKMARK_BAR_VIEW_H_ 6 #define CHROME_BROWSER_VIEWS_BOOKMARK_BAR_VIEW_H_
7 7
8 #include "app/slide_animation.h" 8 #include "app/slide_animation.h"
9 #include "chrome/browser/bookmarks/bookmark_drag_data.h" 9 #include "chrome/browser/bookmarks/bookmark_drag_data.h"
10 #include "chrome/browser/bookmarks/bookmark_model_observer.h" 10 #include "chrome/browser/bookmarks/bookmark_model_observer.h"
11 #include "chrome/browser/extensions/extensions_service.h" 11 #include "chrome/browser/extensions/extensions_service.h"
12 #include "chrome/browser/sync/profile_sync_service.h" 12 #include "chrome/browser/sync/profile_sync_service.h"
13 #include "chrome/browser/views/bookmark_menu_controller_views.h" 13 #include "chrome/browser/views/bookmark_menu_controller_views.h"
14 #include "chrome/browser/views/detachable_toolbar_view.h" 14 #include "chrome/browser/views/detachable_toolbar_view.h"
15 #include "chrome/common/notification_registrar.h" 15 #include "chrome/common/notification_registrar.h"
16 #include "views/controls/button/menu_button.h" 16 #include "views/controls/button/button.h"
17 #include "views/controls/label.h"
18 #include "views/controls/menu/view_menu_delegate.h" 17 #include "views/controls/menu/view_menu_delegate.h"
19 #include "views/view.h"
20 #include "third_party/skia/include/core/SkRect.h"
21 18
22 class Browser; 19 class Browser;
23 class PageNavigator; 20 class PageNavigator;
24 class PrefService; 21 class PrefService;
25 22
26 namespace views { 23 namespace views {
24 class CustomButton;
25 class Label;
26 class MenuButton;
27 class MenuItemView; 27 class MenuItemView;
28 class TextButton;
28 } 29 }
29 30
30 // BookmarkBarView renders the BookmarkModel. Each starred entry on the 31 // BookmarkBarView renders the BookmarkModel. Each starred entry on the
31 // BookmarkBar is rendered as a MenuButton. An additional MenuButton aligned to 32 // BookmarkBar is rendered as a MenuButton. An additional MenuButton aligned to
32 // the right allows the user to quickly see recently starred entries. 33 // the right allows the user to quickly see recently starred entries.
33 // 34 //
34 // BookmarkBarView shows the bookmarks from a specific Profile. BookmarkBarView 35 // BookmarkBarView shows the bookmarks from a specific Profile. BookmarkBarView
35 // waits until the HistoryService for the profile has been loaded before 36 // waits until the HistoryService for the profile has been loaded before
36 // creating the BookmarkModel. 37 // creating the BookmarkModel.
37 class BookmarkBarView : public DetachableToolbarView, 38 class BookmarkBarView : public DetachableToolbarView,
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 void AnimationEnded(const Animation* animation); 167 void AnimationEnded(const Animation* animation);
167 168
168 // BookmarkMenuController::Observer 169 // BookmarkMenuController::Observer
169 virtual void BookmarkMenuDeleted(BookmarkMenuController* controller); 170 virtual void BookmarkMenuDeleted(BookmarkMenuController* controller);
170 171
171 // Returns the button at the specified index. 172 // Returns the button at the specified index.
172 views::TextButton* GetBookmarkButton(int index); 173 views::TextButton* GetBookmarkButton(int index);
173 174
174 // Returns the button responsible for showing bookmarks in the other bookmark 175 // Returns the button responsible for showing bookmarks in the other bookmark
175 // folder. 176 // folder.
176 views::TextButton* other_bookmarked_button() const { 177 views::MenuButton* other_bookmarked_button() const {
177 return other_bookmarked_button_; 178 return other_bookmarked_button_;
178 } 179 }
179 180
180 // Returns the active MenuItemView, or NULL if a menu isn't showing. 181 // Returns the active MenuItemView, or NULL if a menu isn't showing.
181 views::MenuItemView* GetMenu(); 182 views::MenuItemView* GetMenu();
182 183
183 // Returns the drop MenuItemView, or NULL if a menu isn't showing. 184 // Returns the drop MenuItemView, or NULL if a menu isn't showing.
184 views::MenuItemView* GetDropMenu(); 185 views::MenuItemView* GetDropMenu();
185 186
186 // Returns the context menu, or null if one isn't showing. 187 // Returns the context menu, or null if one isn't showing.
187 views::MenuItemView* GetContextMenu(); 188 views::MenuItemView* GetContextMenu();
188 189
189 // Returns the button used when not all the items on the bookmark bar fit. 190 // Returns the button used when not all the items on the bookmark bar fit.
190 views::TextButton* overflow_button() const { return overflow_button_; } 191 views::MenuButton* overflow_button() const { return overflow_button_; }
192
193 // If |loc| is over a bookmark button the node is returned corresponding
194 // to the button and |start_index| is set to 0. If a overflow button is
195 // showing and |loc| is over the overflow button, the bookmark bar node is
196 // returned and |start_index| is set to the index of the first node
197 // contained in the overflow menu.
198 const BookmarkNode* GetNodeForButtonAt(const gfx::Point& loc,
199 int* start_index);
200
201 // Returns the MenuButton for node.
202 views::MenuButton* GetMenuButtonForNode(const BookmarkNode* node);
203
204 // Returns the position to anchor the menu for |button| at, the index of the
205 // first child of the node to build the menu from.
206 void GetAnchorPositionAndStartIndexForButton(
207 views::MenuButton* button,
208 views::MenuItemView::AnchorPosition* anchor,
209 int* start_index);
191 210
192 // Maximum size of buttons on the bookmark bar. 211 // Maximum size of buttons on the bookmark bar.
193 static const int kMaxButtonWidth; 212 static const int kMaxButtonWidth;
194 213
195 // If true we're running tests. This short circuits a couple of animations. 214 // If true we're running tests. This short circuits a couple of animations.
196 static bool testing_; 215 static bool testing_;
197 216
198 // Constants used in Browser View, as well as here. 217 // Constants used in Browser View, as well as here.
199 // How inset the bookmarks bar is when displayed on the new tab page. 218 // How inset the bookmarks bar is when displayed on the new tab page.
200 static const int kNewtabHorizontalPadding; 219 static const int kNewtabHorizontalPadding;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 int press_x, 329 int press_x,
311 int press_y, 330 int press_y,
312 OSExchangeData* data); 331 OSExchangeData* data);
313 332
314 // Writes a BookmarkDragData for node to data. 333 // Writes a BookmarkDragData for node to data.
315 void WriteDragData(const BookmarkNode* node, OSExchangeData* data); 334 void WriteDragData(const BookmarkNode* node, OSExchangeData* data);
316 335
317 // Returns the drag operations for the specified button. 336 // Returns the drag operations for the specified button.
318 virtual int GetDragOperations(views::View* sender, int x, int y); 337 virtual int GetDragOperations(views::View* sender, int x, int y);
319 338
320 // ViewMenuDelegate method. 3 types of menus may be shown: 339 // ViewMenuDelegate method. Ends up creating a BookmarkMenuController to
321 // . the menu allowing the user to choose when the bookmark bar is visible. 340 // show the menu.
322 // . most recently bookmarked menu
323 // . menu for star groups.
324 // The latter two are handled by a MenuRunner, which builds the appropriate
325 // menu.
326 virtual void RunMenu(views::View* view, const gfx::Point& pt); 341 virtual void RunMenu(views::View* view, const gfx::Point& pt);
327 342
328 // Invoked when a star entry corresponding to a URL on the bookmark bar is 343 // Invoked when a star entry corresponding to a URL on the bookmark bar is
329 // pressed. Forwards to the PageNavigator to open the URL. 344 // pressed. Forwards to the PageNavigator to open the URL.
330 virtual void ButtonPressed(views::Button* sender, const views::Event& event); 345 virtual void ButtonPressed(views::Button* sender, const views::Event& event);
331 346
332 // Invoked for this View, one of the buttons or the 'other' button. Shows the 347 // Invoked for this View, one of the buttons or the 'other' button. Shows the
333 // appropriate context menu. 348 // appropriate context menu.
334 virtual void ShowContextMenu(views::View* source, 349 virtual void ShowContextMenu(views::View* source,
335 int x, 350 int x,
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 // Background for extension toolstrips. 492 // Background for extension toolstrips.
478 SkBitmap toolstrip_background_; 493 SkBitmap toolstrip_background_;
479 494
480 // Storage of strings needed for accessibility. 495 // Storage of strings needed for accessibility.
481 std::wstring accessible_name_; 496 std::wstring accessible_name_;
482 497
483 DISALLOW_COPY_AND_ASSIGN(BookmarkBarView); 498 DISALLOW_COPY_AND_ASSIGN(BookmarkBarView);
484 }; 499 };
485 500
486 #endif // CHROME_BROWSER_VIEWS_BOOKMARK_BAR_VIEW_H_ 501 #endif // CHROME_BROWSER_VIEWS_BOOKMARK_BAR_VIEW_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/views/bookmark_bar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698