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

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

Issue 8776025: Makes views show the 'mobile' bookmark folder where appropriate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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
OLDNEW
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 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h" 5 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 bookmark_menu_ = NULL; 826 bookmark_menu_ = NULL;
827 else if (controller == bookmark_drop_menu_) 827 else if (controller == bookmark_drop_menu_)
828 bookmark_drop_menu_ = NULL; 828 bookmark_drop_menu_ = NULL;
829 } 829 }
830 830
831 void BookmarkBarView::ShowImportDialog() { 831 void BookmarkBarView::ShowImportDialog() {
832 browser_->OpenImportSettingsDialog(); 832 browser_->OpenImportSettingsDialog();
833 } 833 }
834 834
835 void BookmarkBarView::Loaded(BookmarkModel* model, bool ids_reassigned) { 835 void BookmarkBarView::Loaded(BookmarkModel* model, bool ids_reassigned) {
836 volatile int button_count = GetBookmarkButtonCount(); 836 // There should be no buttons. If non-zero it means Load was invoked more than
837 DCHECK(button_count == 0); // If non-zero it means Load was invoked more than 837 // once, or we didn't properly clear things. Either of which shouldn't happen.
838 // once, or we didn't properly clear things. 838 DCHECK_EQ(0, GetBookmarkButtonCount());
839 // Either of which shouldn't happen
840 const BookmarkNode* node = model_->bookmark_bar_node(); 839 const BookmarkNode* node = model_->bookmark_bar_node();
841 DCHECK(node && model_->other_node()); 840 DCHECK(node);
842 // Create a button for each of the children on the bookmark bar. 841 // Create a button for each of the children on the bookmark bar.
843 for (int i = 0, child_count = node->child_count(); i < child_count; ++i) 842 for (int i = 0, child_count = node->child_count(); i < child_count; ++i)
844 AddChildViewAt(CreateBookmarkButton(node->GetChild(i)), i); 843 AddChildViewAt(CreateBookmarkButton(node->GetChild(i)), i);
844 DCHECK(model_->other_node());
845 other_bookmarked_button_->SetAccessibleName(model_->other_node()->GetTitle());
846 other_bookmarked_button_->SetText(model_->other_node()->GetTitle());
845 UpdateColors(); 847 UpdateColors();
846 UpdateOtherBookmarksVisibility(); 848 UpdateOtherBookmarksVisibility();
847 other_bookmarked_button_->SetEnabled(true); 849 other_bookmarked_button_->SetEnabled(true);
848 850
849 Layout(); 851 Layout();
850 SchedulePaint(); 852 SchedulePaint();
851 } 853 }
852 854
853 void BookmarkBarView::BookmarkModelBeingDeleted(BookmarkModel* model) { 855 void BookmarkBarView::BookmarkModelBeingDeleted(BookmarkModel* model) {
854 // In normal shutdown The bookmark model should never be deleted before us. 856 // In normal shutdown The bookmark model should never be deleted before us.
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
1160 int BookmarkBarView::GetFirstHiddenNodeIndex() { 1162 int BookmarkBarView::GetFirstHiddenNodeIndex() {
1161 const int bb_count = GetBookmarkButtonCount(); 1163 const int bb_count = GetBookmarkButtonCount();
1162 for (int i = 0; i < bb_count; ++i) { 1164 for (int i = 0; i < bb_count; ++i) {
1163 if (!GetBookmarkButton(i)->IsVisible()) 1165 if (!GetBookmarkButton(i)->IsVisible())
1164 return i; 1166 return i;
1165 } 1167 }
1166 return bb_count; 1168 return bb_count;
1167 } 1169 }
1168 1170
1169 MenuButton* BookmarkBarView::CreateOtherBookmarkedButton() { 1171 MenuButton* BookmarkBarView::CreateOtherBookmarkedButton() {
1170 MenuButton* button = new BookmarkFolderButton( 1172 // Title is set in Loaded.
1171 this, 1173 MenuButton* button = new BookmarkFolderButton(this, string16(), this, false);
1172 l10n_util::GetStringUTF16(IDS_BOOKMARK_BAR_OTHER_BOOKMARKED),
1173 this,
1174 false);
1175 button->set_id(VIEW_ID_OTHER_BOOKMARKS); 1174 button->set_id(VIEW_ID_OTHER_BOOKMARKS);
1176 button->SetIcon(GetFolderIcon()); 1175 button->SetIcon(GetFolderIcon());
1177 button->set_context_menu_controller(this); 1176 button->set_context_menu_controller(this);
1178 button->set_tag(kOtherFolderButtonTag); 1177 button->set_tag(kOtherFolderButtonTag);
1179 button->SetAccessibleName(
1180 l10n_util::GetStringUTF16(IDS_BOOKMARK_BAR_OTHER_BOOKMARKED));
1181 return button; 1178 return button;
1182 } 1179 }
1183 1180
1184 MenuButton* BookmarkBarView::CreateOverflowButton() { 1181 MenuButton* BookmarkBarView::CreateOverflowButton() {
1185 MenuButton* button = new OverFlowButton(this); 1182 MenuButton* button = new OverFlowButton(this);
1186 button->SetIcon(*ResourceBundle::GetSharedInstance(). 1183 button->SetIcon(*ResourceBundle::GetSharedInstance().
1187 GetBitmapNamed(IDR_BOOKMARK_BAR_CHEVRONS)); 1184 GetBitmapNamed(IDR_BOOKMARK_BAR_CHEVRONS));
1188 1185
1189 // The overflow button's image contains an arrow and therefore it is a 1186 // The overflow button's image contains an arrow and therefore it is a
1190 // direction sensitive image and we need to flip it if the UI layout is 1187 // direction sensitive image and we need to flip it if the UI layout is
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
1659 (1 - size_animation_->GetCurrentValue()))); 1656 (1 - size_animation_->GetCurrentValue())));
1660 } else { 1657 } else {
1661 prefsize.set_height( 1658 prefsize.set_height(
1662 static_cast<int>( 1659 static_cast<int>(
1663 browser_defaults::kBookmarkBarHeight * 1660 browser_defaults::kBookmarkBarHeight *
1664 size_animation_->GetCurrentValue())); 1661 size_animation_->GetCurrentValue()));
1665 } 1662 }
1666 } 1663 }
1667 return prefsize; 1664 return prefsize;
1668 } 1665 }
OLDNEW
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/ui/views/bookmarks/bookmark_menu_controller_views.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698