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

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

Issue 2822010: Fixes bug in bookmark bar view if profile changed. If the profile (Closed)
Patch Set: Created 10 years, 6 months 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
« 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <set> 8 #include <set>
9 9
10 #include "app/slide_animation.h" 10 #include "app/slide_animation.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 public views::ButtonListener, 43 public views::ButtonListener,
44 public NotificationObserver, 44 public NotificationObserver,
45 public views::ContextMenuController, 45 public views::ContextMenuController,
46 public views::DragController, 46 public views::DragController,
47 public AnimationDelegate, 47 public AnimationDelegate,
48 public BookmarkMenuController::Observer, 48 public BookmarkMenuController::Observer,
49 public BookmarkBarInstructionsView::Delegate { 49 public BookmarkBarInstructionsView::Delegate {
50 friend class ShowFolderMenuTask; 50 friend class ShowFolderMenuTask;
51 51
52 public: 52 public:
53 // Constants used in Browser View, as well as here.
54 // How inset the bookmarks bar is when displayed on the new tab page.
55 static const int kNewtabHorizontalPadding;
56 static const int kNewtabVerticalPadding;
57
58 // Maximum size of buttons on the bookmark bar.
59 static const int kMaxButtonWidth;
60
53 // Interface implemented by controllers/views that need to be notified any 61 // Interface implemented by controllers/views that need to be notified any
54 // time the model changes, typically to cancel an operation that is showing 62 // time the model changes, typically to cancel an operation that is showing
55 // data from the model such as a menu. This isn't intended as a general 63 // data from the model such as a menu. This isn't intended as a general
56 // way to be notified of changes, rather for cases where a controller/view is 64 // way to be notified of changes, rather for cases where a controller/view is
57 // showing data from the model in a modal like setting and needs to cleanly 65 // showing data from the model in a modal like setting and needs to cleanly
58 // exit the modal loop if the model changes out from under it. 66 // exit the modal loop if the model changes out from under it.
59 // 67 //
60 // A controller/view that needs this notification should install itself as the 68 // A controller/view that needs this notification should install itself as the
61 // ModelChangeListener via the SetModelChangedListener method when shown and 69 // ModelChangeListener via the SetModelChangedListener method when shown and
62 // reset the ModelChangeListener of the BookmarkBarView when it closes by way 70 // reset the ModelChangeListener of the BookmarkBarView when it closes by way
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 // Returns the position to anchor the menu for |button| at, the index of the 214 // Returns the position to anchor the menu for |button| at, the index of the
207 // first child of the node to build the menu from. 215 // first child of the node to build the menu from.
208 void GetAnchorPositionAndStartIndexForButton( 216 void GetAnchorPositionAndStartIndexForButton(
209 views::MenuButton* button, 217 views::MenuButton* button,
210 views::MenuItemView::AnchorPosition* anchor, 218 views::MenuItemView::AnchorPosition* anchor,
211 int* start_index); 219 int* start_index);
212 220
213 // BookmarkBarInstructionsView::Delegate. 221 // BookmarkBarInstructionsView::Delegate.
214 virtual void ShowImportDialog(); 222 virtual void ShowImportDialog();
215 223
216 // Maximum size of buttons on the bookmark bar.
217 static const int kMaxButtonWidth;
218
219 // If a button is currently throbbing, it is stopped. If immediate is true 224 // If a button is currently throbbing, it is stopped. If immediate is true
220 // the throb stops immediately, otherwise it stops after a couple more 225 // the throb stops immediately, otherwise it stops after a couple more
221 // throbs. 226 // throbs.
222 void StopThrobbing(bool immediate); 227 void StopThrobbing(bool immediate);
223 228
229 // Returns the number of buttons corresponding to starred urls/groups. This
230 // is equivalent to the number of children the bookmark bar node from the
231 // bookmark bar model has.
232 int GetBookmarkButtonCount();
233
224 // If true we're running tests. This short circuits a couple of animations. 234 // If true we're running tests. This short circuits a couple of animations.
225 static bool testing_; 235 static bool testing_;
226 236
227 // Constants used in Browser View, as well as here.
228 // How inset the bookmarks bar is when displayed on the new tab page.
229 static const int kNewtabHorizontalPadding;
230 static const int kNewtabVerticalPadding;
231
232 private: 237 private:
233 class ButtonSeparatorView; 238 class ButtonSeparatorView;
234 struct DropInfo; 239 struct DropInfo;
235 240
236 // Task that invokes ShowDropFolderForNode when run. ShowFolderDropMenuTask 241 // Task that invokes ShowDropFolderForNode when run. ShowFolderDropMenuTask
237 // deletes itself once run. 242 // deletes itself once run.
238 class ShowFolderDropMenuTask : public Task { 243 class ShowFolderDropMenuTask : public Task {
239 public: 244 public:
240 ShowFolderDropMenuTask(BookmarkBarView* view, const BookmarkNode* node) 245 ShowFolderDropMenuTask(BookmarkBarView* view, const BookmarkNode* node)
241 : view_(view), 246 : view_(view),
(...skipping 23 matching lines...) Expand all
265 // Creates recent bookmark button and when visible button as well as 270 // Creates recent bookmark button and when visible button as well as
266 // calculating the preferred height. 271 // calculating the preferred height.
267 void Init(); 272 void Init();
268 273
269 // Creates the button showing the other bookmarked items. 274 // Creates the button showing the other bookmarked items.
270 views::MenuButton* CreateOtherBookmarkedButton(); 275 views::MenuButton* CreateOtherBookmarkedButton();
271 276
272 // Creates the button used when not all bookmark buttons fit. 277 // Creates the button used when not all bookmark buttons fit.
273 views::MenuButton* CreateOverflowButton(); 278 views::MenuButton* CreateOverflowButton();
274 279
275 // Returns the number of buttons corresponding to starred urls/groups. This
276 // is equivalent to the number of children the bookmark bar node from the
277 // bookmark bar model has.
278 int GetBookmarkButtonCount();
279
280 // Invoked when the bookmark bar model has finished loading. Creates a button 280 // Invoked when the bookmark bar model has finished loading. Creates a button
281 // for each of the children of the root node from the model. 281 // for each of the children of the root node from the model.
282 virtual void Loaded(BookmarkModel* model); 282 virtual void Loaded(BookmarkModel* model);
283 283
284 // Invoked when the model is being deleted. 284 // Invoked when the model is being deleted.
285 virtual void BookmarkModelBeingDeleted(BookmarkModel* model); 285 virtual void BookmarkModelBeingDeleted(BookmarkModel* model);
286 286
287 // Invokes added followed by removed. 287 // Invokes added followed by removed.
288 virtual void BookmarkNodeMoved(BookmarkModel* model, 288 virtual void BookmarkNodeMoved(BookmarkModel* model,
289 const BookmarkNode* old_parent, 289 const BookmarkNode* old_parent,
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 // overflow_button_ or a button on the bar. 492 // overflow_button_ or a button on the bar.
493 views::CustomButton* throbbing_view_; 493 views::CustomButton* throbbing_view_;
494 494
495 // Background for extension toolstrips. 495 // Background for extension toolstrips.
496 SkBitmap toolstrip_background_; 496 SkBitmap toolstrip_background_;
497 497
498 DISALLOW_COPY_AND_ASSIGN(BookmarkBarView); 498 DISALLOW_COPY_AND_ASSIGN(BookmarkBarView);
499 }; 499 };
500 500
501 #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