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

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

Issue 328363003: Use the managed bookmarks icon for its folder in views. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 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 | Annotate | Revision Log
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 #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 <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after
1302 // Child views are traversed in the order they are added. Make sure the order 1302 // Child views are traversed in the order they are added. Make sure the order
1303 // they are added matches the visual order. 1303 // they are added matches the visual order.
1304 overflow_button_ = CreateOverflowButton(); 1304 overflow_button_ = CreateOverflowButton();
1305 AddChildView(overflow_button_); 1305 AddChildView(overflow_button_);
1306 1306
1307 other_bookmarked_button_ = CreateOtherBookmarkedButton(); 1307 other_bookmarked_button_ = CreateOtherBookmarkedButton();
1308 // We'll re-enable when the model is loaded. 1308 // We'll re-enable when the model is loaded.
1309 other_bookmarked_button_->SetEnabled(false); 1309 other_bookmarked_button_->SetEnabled(false);
1310 AddChildView(other_bookmarked_button_); 1310 AddChildView(other_bookmarked_button_);
1311 1311
1312 managed_bookmarks_button_ = CreateOtherBookmarkedButton(); 1312 managed_bookmarks_button_ = CreateManagedBookmarksButton();
1313 // Also re-enabled when the model is loaded. 1313 // Also re-enabled when the model is loaded.
1314 managed_bookmarks_button_->SetEnabled(false); 1314 managed_bookmarks_button_->SetEnabled(false);
1315 AddChildView(managed_bookmarks_button_); 1315 AddChildView(managed_bookmarks_button_);
1316 1316
1317 apps_page_shortcut_ = CreateAppsPageShortcutButton(); 1317 apps_page_shortcut_ = CreateAppsPageShortcutButton();
1318 AddChildView(apps_page_shortcut_); 1318 AddChildView(apps_page_shortcut_);
1319 profile_pref_registrar_.Init(browser_->profile()->GetPrefs()); 1319 profile_pref_registrar_.Init(browser_->profile()->GetPrefs());
1320 profile_pref_registrar_.Add( 1320 profile_pref_registrar_.Add(
1321 prefs::kShowAppsShortcutInBookmarkBar, 1321 prefs::kShowAppsShortcutInBookmarkBar,
1322 base::Bind(&BookmarkBarView::OnAppsPageShortcutVisibilityPrefChanged, 1322 base::Bind(&BookmarkBarView::OnAppsPageShortcutVisibilityPrefChanged,
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1386 button->set_context_menu_controller(this); 1386 button->set_context_menu_controller(this);
1387 button->set_tag(kOtherFolderButtonTag); 1387 button->set_tag(kOtherFolderButtonTag);
1388 return button; 1388 return button;
1389 } 1389 }
1390 1390
1391 MenuButton* BookmarkBarView::CreateManagedBookmarksButton() { 1391 MenuButton* BookmarkBarView::CreateManagedBookmarksButton() {
1392 // Title is set in Loaded. 1392 // Title is set in Loaded.
1393 MenuButton* button = 1393 MenuButton* button =
1394 new BookmarkFolderButton(this, base::string16(), this, false); 1394 new BookmarkFolderButton(this, base::string16(), this, false);
1395 button->set_id(VIEW_ID_MANAGED_BOOKMARKS); 1395 button->set_id(VIEW_ID_MANAGED_BOOKMARKS);
1396 // TODO(joaodasilva): replace with a "managed folder" icon. 1396 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance();
1397 // http://crbug.com/49598 1397 gfx::ImageSkia* image =
1398 button->SetIcon(GetFolderIcon()); 1398 rb->GetImageSkiaNamed(IDR_BOOKMARK_BAR_FOLDER_MANAGED);
1399 button->SetIcon(*image);
1399 button->set_context_menu_controller(this); 1400 button->set_context_menu_controller(this);
1400 button->set_tag(kManagedFolderButtonTag); 1401 button->set_tag(kManagedFolderButtonTag);
1401 return button; 1402 return button;
1402 } 1403 }
1403 1404
1404 MenuButton* BookmarkBarView::CreateOverflowButton() { 1405 MenuButton* BookmarkBarView::CreateOverflowButton() {
1405 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); 1406 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance();
1406 MenuButton* button = new OverFlowButton(this); 1407 MenuButton* button = new OverFlowButton(this);
1407 button->SetIcon(*rb->GetImageSkiaNamed(IDR_BOOKMARK_BAR_CHEVRONS)); 1408 button->SetIcon(*rb->GetImageSkiaNamed(IDR_BOOKMARK_BAR_CHEVRONS));
1408 1409
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
1918 DCHECK(apps_page_shortcut_); 1919 DCHECK(apps_page_shortcut_);
1919 // Only perform layout if required. 1920 // Only perform layout if required.
1920 bool visible = chrome::ShouldShowAppsShortcutInBookmarkBar( 1921 bool visible = chrome::ShouldShowAppsShortcutInBookmarkBar(
1921 browser_->profile(), browser_->host_desktop_type()); 1922 browser_->profile(), browser_->host_desktop_type());
1922 if (apps_page_shortcut_->visible() == visible) 1923 if (apps_page_shortcut_->visible() == visible)
1923 return; 1924 return;
1924 apps_page_shortcut_->SetVisible(visible); 1925 apps_page_shortcut_->SetVisible(visible);
1925 UpdateBookmarksSeparatorVisibility(); 1926 UpdateBookmarksSeparatorVisibility();
1926 Layout(); 1927 Layout();
1927 } 1928 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698