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

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

Issue 2149003: Relanding 48042... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 7 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
« no previous file with comments | « chrome/browser/profile.cc ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 // else case: we'll receive notification back from the BookmarkModel when done 453 // else case: we'll receive notification back from the BookmarkModel when done
455 // loading, then we'll populate the bar. 454 // loading, then we'll populate the bar.
456 } 455 }
457 456
458 void BookmarkBarView::SetPageNavigator(PageNavigator* navigator) { 457 void BookmarkBarView::SetPageNavigator(PageNavigator* navigator) {
459 page_navigator_ = navigator; 458 page_navigator_ = navigator;
460 } 459 }
461 460
462 gfx::Size BookmarkBarView::GetPreferredSize() { 461 gfx::Size BookmarkBarView::GetPreferredSize() {
463 // We don't want the bookmark bar view in the app launcher new tab page. 462 // We don't want the bookmark bar view in the app launcher new tab page.
464 static bool extension_apps = CommandLine::ForCurrentProcess()->HasSwitch( 463 bool hide_bookmark_bar =
465 switches::kEnableApps); 464 (Extension::AppsAreEnabled() && OnNewTabPage()) || OnAppsPage();
466 bool hide_bookmark_bar = (extension_apps && OnNewTabPage()) ||
467 OnAppsPage();
468 465
469 if (!hide_bookmark_bar) 466 if (!hide_bookmark_bar)
470 return LayoutItems(true); 467 return LayoutItems(true);
471 else 468 else
472 return gfx::Size(); 469 return gfx::Size();
473 } 470 }
474 471
475 gfx::Size BookmarkBarView::GetMinimumSize() { 472 gfx::Size BookmarkBarView::GetMinimumSize() {
476 // The minimum width of the bookmark bar should at least contain the overflow 473 // The minimum width of the bookmark bar should at least contain the overflow
477 // button, by which one can access all the Bookmark Bar items, and the "Other 474 // 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
1720 // The tooltip is the only way we have to display text explaining the error 1717 // The tooltip is the only way we have to display text explaining the error
1721 // to the user. 1718 // to the user.
1722 sync_error_button->SetTooltipText( 1719 sync_error_button->SetTooltipText(
1723 l10n_util::GetString(IDS_SYNC_BOOKMARK_BAR_ERROR_DESC)); 1720 l10n_util::GetString(IDS_SYNC_BOOKMARK_BAR_ERROR_DESC));
1724 sync_error_button->SetAccessibleName( 1721 sync_error_button->SetAccessibleName(
1725 l10n_util::GetString(IDS_ACCNAME_SYNC_ERROR_BUTTON)); 1722 l10n_util::GetString(IDS_ACCNAME_SYNC_ERROR_BUTTON));
1726 sync_error_button->SetIcon( 1723 sync_error_button->SetIcon(
1727 *ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING)); 1724 *ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING));
1728 return sync_error_button; 1725 return sync_error_button;
1729 } 1726 }
OLDNEW
« no previous file with comments | « chrome/browser/profile.cc ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698