OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/views/bookmark_bar_view.h" | 5 #include "chrome/browser/views/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 15 matching lines...) Expand all Loading... |
26 #include "chrome/browser/renderer_host/render_view_host.h" | 26 #include "chrome/browser/renderer_host/render_view_host.h" |
27 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 27 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
28 #include "chrome/browser/sync/sync_ui_util.h" | 28 #include "chrome/browser/sync/sync_ui_util.h" |
29 #include "chrome/browser/tab_contents/page_navigator.h" | 29 #include "chrome/browser/tab_contents/page_navigator.h" |
30 #include "chrome/browser/tab_contents/tab_contents.h" | 30 #include "chrome/browser/tab_contents/tab_contents.h" |
31 #include "chrome/browser/view_ids.h" | 31 #include "chrome/browser/view_ids.h" |
32 #include "chrome/browser/views/bookmark_context_menu.h" | 32 #include "chrome/browser/views/bookmark_context_menu.h" |
33 #include "chrome/browser/views/event_utils.h" | 33 #include "chrome/browser/views/event_utils.h" |
34 #include "chrome/browser/views/frame/browser_view.h" | 34 #include "chrome/browser/views/frame/browser_view.h" |
35 #include "chrome/browser/views/location_bar/location_bar_view.h" | 35 #include "chrome/browser/views/location_bar/location_bar_view.h" |
36 #include "chrome/common/chrome_switches.h" | |
37 #include "chrome/common/notification_service.h" | 36 #include "chrome/common/notification_service.h" |
38 #include "chrome/common/page_transition_types.h" | 37 #include "chrome/common/page_transition_types.h" |
39 #include "chrome/common/pref_names.h" | 38 #include "chrome/common/pref_names.h" |
40 #include "gfx/canvas.h" | 39 #include "gfx/canvas.h" |
41 #include "grit/app_resources.h" | 40 #include "grit/app_resources.h" |
42 #include "grit/generated_resources.h" | 41 #include "grit/generated_resources.h" |
43 #include "grit/theme_resources.h" | 42 #include "grit/theme_resources.h" |
44 #include "views/controls/button/menu_button.h" | 43 #include "views/controls/button/menu_button.h" |
45 #include "views/controls/label.h" | 44 #include "views/controls/label.h" |
46 #include "views/controls/menu/menu_item_view.h" | 45 #include "views/controls/menu/menu_item_view.h" |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 // else case: we'll receive notification back from the BookmarkModel when done | 454 // else case: we'll receive notification back from the BookmarkModel when done |
456 // loading, then we'll populate the bar. | 455 // loading, then we'll populate the bar. |
457 } | 456 } |
458 | 457 |
459 void BookmarkBarView::SetPageNavigator(PageNavigator* navigator) { | 458 void BookmarkBarView::SetPageNavigator(PageNavigator* navigator) { |
460 page_navigator_ = navigator; | 459 page_navigator_ = navigator; |
461 } | 460 } |
462 | 461 |
463 gfx::Size BookmarkBarView::GetPreferredSize() { | 462 gfx::Size BookmarkBarView::GetPreferredSize() { |
464 // We don't want the bookmark bar view in the app launcher new tab page. | 463 // We don't want the bookmark bar view in the app launcher new tab page. |
465 static bool extension_apps = CommandLine::ForCurrentProcess()->HasSwitch( | 464 bool hide_bookmark_bar = |
466 switches::kEnableApps); | 465 (Extension::AppsAreEnabled() && OnNewTabPage()) || OnAppsPage(); |
467 bool hide_bookmark_bar = (extension_apps && OnNewTabPage()) || | |
468 OnAppsPage(); | |
469 | 466 |
470 if (!hide_bookmark_bar) | 467 if (!hide_bookmark_bar) |
471 return LayoutItems(true); | 468 return LayoutItems(true); |
472 else | 469 else |
473 return gfx::Size(); | 470 return gfx::Size(); |
474 } | 471 } |
475 | 472 |
476 gfx::Size BookmarkBarView::GetMinimumSize() { | 473 gfx::Size BookmarkBarView::GetMinimumSize() { |
477 // The minimum width of the bookmark bar should at least contain the overflow | 474 // The minimum width of the bookmark bar should at least contain the overflow |
478 // button, by which one can access all the Bookmark Bar items, and the "Other | 475 // button, by which one can access all the Bookmark Bar items, and the "Other |
(...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1721 // The tooltip is the only way we have to display text explaining the error | 1718 // The tooltip is the only way we have to display text explaining the error |
1722 // to the user. | 1719 // to the user. |
1723 sync_error_button->SetTooltipText( | 1720 sync_error_button->SetTooltipText( |
1724 l10n_util::GetString(IDS_SYNC_BOOKMARK_BAR_ERROR_DESC)); | 1721 l10n_util::GetString(IDS_SYNC_BOOKMARK_BAR_ERROR_DESC)); |
1725 sync_error_button->SetAccessibleName( | 1722 sync_error_button->SetAccessibleName( |
1726 l10n_util::GetString(IDS_ACCNAME_SYNC_ERROR_BUTTON)); | 1723 l10n_util::GetString(IDS_ACCNAME_SYNC_ERROR_BUTTON)); |
1727 sync_error_button->SetIcon( | 1724 sync_error_button->SetIcon( |
1728 *ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING)); | 1725 *ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING)); |
1729 return sync_error_button; | 1726 return sync_error_button; |
1730 } | 1727 } |
OLD | NEW |