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

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

Issue 677533003: Changes BookmarkBarView to only create buttons as needed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: done Created 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_
6 #define CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ 6 #define CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_
7 7
8 #include <set> 8 #include <set>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 // calculating the preferred height. 279 // calculating the preferred height.
280 void Init(); 280 void Init();
281 281
282 // NOTE: unless otherwise stated all methods that take an int for an index are 282 // NOTE: unless otherwise stated all methods that take an int for an index are
283 // in terms of the bookmark bar view. Typically the view index and model index 283 // in terms of the bookmark bar view. Typically the view index and model index
284 // are the same, but they may differ during animations or drag and drop. 284 // are the same, but they may differ during animations or drag and drop.
285 // 285 //
286 // It's easy to get the mapping wrong. For this reason all these methods are 286 // It's easy to get the mapping wrong. For this reason all these methods are
287 // private. 287 // private.
288 288
289 // Returns the number of buttons corresponding to starred urls/folders. This 289 // Returns the number of buttons corresponding to starred urls/folders. This
msw 2014/10/27 20:40:24 Consider revising this comment, it's no longer qui
sky 2014/10/27 21:48:18 Done.
290 // is equivalent to the number of children the bookmark bar node from the 290 // is equivalent to the number of children the bookmark bar node from the
291 // bookmark bar model has. 291 // bookmark bar model has.
292 int GetBookmarkButtonCount() const; 292 int GetBookmarkButtonCount() const;
293 293
294 // Returns the button at the specified index. 294 // Returns the button at the specified index.
295 views::LabelButton* GetBookmarkButton(int index); 295 views::LabelButton* GetBookmarkButton(int index);
296 296
297 // Returns BOOKMARK_LAUNCH_LOCATION_DETACHED_BAR or 297 // Returns BOOKMARK_LAUNCH_LOCATION_DETACHED_BAR or
298 // BOOKMARK_LAUNCH_LOCATION_ATTACHED_BAR based on detached state. 298 // BOOKMARK_LAUNCH_LOCATION_ATTACHED_BAR based on detached state.
299 BookmarkLaunchLocation GetBookmarkLaunchLocation() const; 299 BookmarkLaunchLocation GetBookmarkLaunchLocation() const;
(...skipping 14 matching lines...) Expand all
314 // Creates the button for rendering the specified bookmark node. 314 // Creates the button for rendering the specified bookmark node.
315 views::View* CreateBookmarkButton(const BookmarkNode* node); 315 views::View* CreateBookmarkButton(const BookmarkNode* node);
316 316
317 // Creates the button for rendering the apps page shortcut. 317 // Creates the button for rendering the apps page shortcut.
318 views::LabelButton* CreateAppsPageShortcutButton(); 318 views::LabelButton* CreateAppsPageShortcutButton();
319 319
320 // Configures the button from the specified node. This sets the text, 320 // Configures the button from the specified node. This sets the text,
321 // and icon. 321 // and icon.
322 void ConfigureButton(const BookmarkNode* node, views::LabelButton* button); 322 void ConfigureButton(const BookmarkNode* node, views::LabelButton* button);
323 323
324 // Creates and adds a button for the next node of the bookmark bar node. The
325 // next node corresponds to the node at index GetBookmarkButtonCount(). This
326 // does not layout/paint. It's assumed the call site does that.
msw 2014/10/27 20:40:24 nit: I think you can remove "This does not layout/
sky 2014/10/27 21:48:18 I nuked this function entirely.
327 void LoadNextBookmarkButton();
328
324 // Implementation for BookmarkNodeAddedImpl. Returns true if LayoutAndPaint() 329 // Implementation for BookmarkNodeAddedImpl. Returns true if LayoutAndPaint()
325 // is required. 330 // is required.
326 bool BookmarkNodeAddedImpl(BookmarkModel* model, 331 bool BookmarkNodeAddedImpl(BookmarkModel* model,
327 const BookmarkNode* parent, 332 const BookmarkNode* parent,
328 int index); 333 int index);
329 334
330 // Implementation for BookmarkNodeRemoved. Returns true if LayoutAndPaint() is 335 // Implementation for BookmarkNodeRemoved. Returns true if LayoutAndPaint() is
331 // required. 336 // required.
332 bool BookmarkNodeRemovedImpl(BookmarkModel* model, 337 bool BookmarkNodeRemovedImpl(BookmarkModel* model,
333 const BookmarkNode* parent, 338 const BookmarkNode* parent,
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 462
458 ObserverList<BookmarkBarViewObserver> observers_; 463 ObserverList<BookmarkBarViewObserver> observers_;
459 464
460 // Factory used to delay showing of the drop menu. 465 // Factory used to delay showing of the drop menu.
461 base::WeakPtrFactory<BookmarkBarView> show_folder_method_factory_; 466 base::WeakPtrFactory<BookmarkBarView> show_folder_method_factory_;
462 467
463 DISALLOW_COPY_AND_ASSIGN(BookmarkBarView); 468 DISALLOW_COPY_AND_ASSIGN(BookmarkBarView);
464 }; 469 };
465 470
466 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_ 471 #endif // CHROME_BROWSER_UI_VIEWS_BOOKMARKS_BOOKMARK_BAR_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698