OLD | NEW |
---|---|
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 Loading... | |
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 Loading... | |
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) { | |
koz (OOO until 15th September)
2013/05/30 04:08:40
Remove function declaration
calamity
2013/05/31 01:15:22
Done.
| |
1879 // Disregard |app_launcher_enabled|, use apps::WasAppLauncherEnable instead. | |
1880 OnAppsPageShortcutVisibilityPrefChanged(); | |
1881 } | |
OLD | NEW |