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

Side by Side Diff: chrome/browser/ui/views/toolbar/toolbar_view.cc

Issue 273223002: views: Make view::Views::GetPreferredSize() const. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More compile fix for ToT Created 6 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/toolbar/toolbar_view.h" 5 #include "chrome/browser/ui/views/toolbar/toolbar_view.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/i18n/number_formatting.h" 9 #include "base/i18n/number_formatting.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 // ToolbarView, ui::AcceleratorProvider implementation: 531 // ToolbarView, ui::AcceleratorProvider implementation:
532 532
533 bool ToolbarView::GetAcceleratorForCommandId(int command_id, 533 bool ToolbarView::GetAcceleratorForCommandId(int command_id,
534 ui::Accelerator* accelerator) { 534 ui::Accelerator* accelerator) {
535 return GetWidget()->GetAccelerator(command_id, accelerator); 535 return GetWidget()->GetAccelerator(command_id, accelerator);
536 } 536 }
537 537
538 //////////////////////////////////////////////////////////////////////////////// 538 ////////////////////////////////////////////////////////////////////////////////
539 // ToolbarView, views::View overrides: 539 // ToolbarView, views::View overrides:
540 540
541 gfx::Size ToolbarView::GetPreferredSize() { 541 gfx::Size ToolbarView::GetPreferredSize() const {
542 gfx::Size size(location_bar_->GetPreferredSize()); 542 gfx::Size size(location_bar_->GetPreferredSize());
543 if (is_display_mode_normal()) { 543 if (is_display_mode_normal()) {
544 int content_width = kLeftEdgeSpacing + back_->GetPreferredSize().width() + 544 int content_width = kLeftEdgeSpacing + back_->GetPreferredSize().width() +
545 forward_->GetPreferredSize().width() + 545 forward_->GetPreferredSize().width() +
546 reload_->GetPreferredSize().width() + 546 reload_->GetPreferredSize().width() +
547 (show_home_button_.GetValue() ? home_->GetPreferredSize().width() : 0) + 547 (show_home_button_.GetValue() ? home_->GetPreferredSize().width() : 0) +
548 kStandardSpacing + browser_actions_->GetPreferredSize().width() + 548 kStandardSpacing + browser_actions_->GetPreferredSize().width() +
549 app_menu_->GetPreferredSize().width() + kRightEdgeSpacing; 549 app_menu_->GetPreferredSize().width() + kRightEdgeSpacing;
550 content_width += origin_chip_view_->visible() ? 550 content_width += origin_chip_view_->visible() ?
551 (origin_chip_view_->GetPreferredSize().width() + kStandardSpacing) : 0; 551 (origin_chip_view_->GetPreferredSize().width() + kStandardSpacing) : 0;
552 size.Enlarge(content_width, 0); 552 size.Enlarge(content_width, 0);
553 } 553 }
554 return SizeForContentSize(size); 554 return SizeForContentSize(size);
555 } 555 }
556 556
557 gfx::Size ToolbarView::GetMinimumSize() { 557 gfx::Size ToolbarView::GetMinimumSize() const {
558 gfx::Size size(location_bar_->GetMinimumSize()); 558 gfx::Size size(location_bar_->GetMinimumSize());
559 if (is_display_mode_normal()) { 559 if (is_display_mode_normal()) {
560 int content_width = kLeftEdgeSpacing + back_->GetMinimumSize().width() + 560 int content_width = kLeftEdgeSpacing + back_->GetMinimumSize().width() +
561 forward_->GetMinimumSize().width() + reload_->GetMinimumSize().width() + 561 forward_->GetMinimumSize().width() + reload_->GetMinimumSize().width() +
562 (show_home_button_.GetValue() ? home_->GetMinimumSize().width() : 0) + 562 (show_home_button_.GetValue() ? home_->GetMinimumSize().width() : 0) +
563 kStandardSpacing + browser_actions_->GetMinimumSize().width() + 563 kStandardSpacing + browser_actions_->GetMinimumSize().width() +
564 app_menu_->GetMinimumSize().width() + kRightEdgeSpacing; 564 app_menu_->GetMinimumSize().width() + kRightEdgeSpacing;
565 content_width += origin_chip_view_->visible() ? 565 content_width += origin_chip_view_->visible() ?
566 (origin_chip_view_->GetMinimumSize().width() + kStandardSpacing) : 0; 566 (origin_chip_view_->GetMinimumSize().width() + kStandardSpacing) : 0;
567 size.Enlarge(content_width, 0); 567 size.Enlarge(content_width, 0);
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 893
894 void ToolbarView::OnShowHomeButtonChanged() { 894 void ToolbarView::OnShowHomeButtonChanged() {
895 Layout(); 895 Layout();
896 SchedulePaint(); 896 SchedulePaint();
897 } 897 }
898 898
899 int ToolbarView::content_shadow_height() const { 899 int ToolbarView::content_shadow_height() const {
900 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ? 900 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ?
901 kContentShadowHeightAsh : kContentShadowHeight; 901 kContentShadowHeightAsh : kContentShadowHeight;
902 } 902 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/toolbar/toolbar_view.h ('k') | chrome/browser/ui/views/toolbar/wrench_menu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698