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

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

Issue 16172005: Clean up async app launcher enabled checks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test Created 7 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
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 <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after
1291 size_animation_.reset(new ui::SlideAnimation(this)); 1291 size_animation_.reset(new ui::SlideAnimation(this));
1292 1292
1293 model_ = BookmarkModelFactory::GetForProfile(browser_->profile()); 1293 model_ = BookmarkModelFactory::GetForProfile(browser_->profile());
1294 if (model_) { 1294 if (model_) {
1295 model_->AddObserver(this); 1295 model_->AddObserver(this);
1296 if (model_->loaded()) 1296 if (model_->loaded())
1297 Loaded(model_, false); 1297 Loaded(model_, false);
1298 // else case: we'll receive notification back from the BookmarkModel when 1298 // else case: we'll receive notification back from the BookmarkModel when
1299 // done loading, then we'll populate the bar. 1299 // done loading, then we'll populate the bar.
1300 } 1300 }
1301
1302 // The first check for the app launcher is asynchronous, run it now.
1303 apps::GetIsAppLauncherEnabled(
1304 base::Bind(&BookmarkBarView::OnAppLauncherEnabledCompleted,
1305 base::Unretained(this)));
1306 } 1301 }
1307 1302
1308 int BookmarkBarView::GetBookmarkButtonCount() { 1303 int BookmarkBarView::GetBookmarkButtonCount() {
1309 // We contain four non-bookmark button views: other bookmarks, bookmarks 1304 // We contain four non-bookmark button views: other bookmarks, bookmarks
1310 // separator, chevrons (for overflow), apps page, and the instruction label. 1305 // separator, chevrons (for overflow), apps page, and the instruction label.
1311 return child_count() - 5; 1306 return child_count() - 5;
1312 } 1307 }
1313 1308
1314 views::TextButton* BookmarkBarView::GetBookmarkButton(int index) { 1309 views::TextButton* BookmarkBarView::GetBookmarkButton(int index) {
1315 DCHECK(index >= 0 && index < GetBookmarkButtonCount()); 1310 DCHECK(index >= 0 && index < GetBookmarkButtonCount());
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after
1867 DCHECK(apps_page_shortcut_); 1862 DCHECK(apps_page_shortcut_);
1868 // Only perform layout if required. 1863 // Only perform layout if required.
1869 bool visible = chrome::ShouldShowAppsShortcutInBookmarkBar( 1864 bool visible = chrome::ShouldShowAppsShortcutInBookmarkBar(
1870 browser_->profile()); 1865 browser_->profile());
1871 if (apps_page_shortcut_->visible() == visible) 1866 if (apps_page_shortcut_->visible() == visible)
1872 return; 1867 return;
1873 apps_page_shortcut_->SetVisible(visible); 1868 apps_page_shortcut_->SetVisible(visible);
1874 UpdateBookmarksSeparatorVisibility(); 1869 UpdateBookmarksSeparatorVisibility();
1875 Layout(); 1870 Layout();
1876 } 1871 }
1877
1878 void BookmarkBarView::OnAppLauncherEnabledCompleted(bool app_launcher_enabled) {
1879 // Disregard |app_launcher_enabled|, use apps::WasAppLauncherEnable instead.
1880 OnAppsPageShortcutVisibilityPrefChanged();
1881 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_bar_view.h ('k') | chrome/browser/ui/views/bookmarks/bookmark_bar_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698