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

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

Issue 141333004: [SiteChip] Remove 50% width cap for site chip (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 10 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/ui/views/toolbar/site_chip_view.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 569 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 home_->SetVisible(false); 580 home_->SetVisible(false);
581 home_->SetBounds(next_element_x, child_y, 0, child_height); 581 home_->SetBounds(next_element_x, child_y, 0, child_height);
582 } 582 }
583 next_element_x = home_->bounds().right() + kStandardSpacing; 583 next_element_x = home_->bounds().right() + kStandardSpacing;
584 584
585 int browser_actions_width = browser_actions_->GetPreferredSize().width(); 585 int browser_actions_width = browser_actions_->GetPreferredSize().width();
586 int app_menu_width = app_menu_->GetPreferredSize().width(); 586 int app_menu_width = app_menu_->GetPreferredSize().width();
587 int available_width = std::max(0, width() - kRightEdgeSpacing - 587 int available_width = std::max(0, width() - kRightEdgeSpacing -
588 app_menu_width - browser_actions_width - next_element_x); 588 app_menu_width - browser_actions_width - next_element_x);
589 589
590 // Cap site chip width at 1/2 the size available to the location bar.
591 site_chip_view_->SetVisible(site_chip_view_->ShouldShow()); 590 site_chip_view_->SetVisible(site_chip_view_->ShouldShow());
592 int site_chip_width = site_chip_view_->GetPreferredSize().width(); 591 int site_chip_width = site_chip_view_->ElideDomainTarget(available_width/2);
593 site_chip_width = std::max(0, std::min(site_chip_width,
594 (available_width - kStandardSpacing) / 2));
595 if (site_chip_view_->visible()) 592 if (site_chip_view_->visible())
596 available_width -= site_chip_width + kStandardSpacing; 593 available_width -= site_chip_width + kStandardSpacing;
597 594
598 chrome::OriginChipPosition origin_chip_position = 595 chrome::OriginChipPosition origin_chip_position =
599 chrome::GetOriginChipPosition(); 596 chrome::GetOriginChipPosition();
600 if (origin_chip_position == chrome::ORIGIN_CHIP_LEADING_LOCATION_BAR) { 597 if (origin_chip_position == chrome::ORIGIN_CHIP_LEADING_LOCATION_BAR) {
601 site_chip_view_->SetBounds(next_element_x, child_y, 598 site_chip_view_->SetBounds(next_element_x, child_y,
602 site_chip_width, child_height); 599 site_chip_width, child_height);
603 next_element_x = site_chip_view_->bounds().right() + kStandardSpacing; 600 next_element_x = site_chip_view_->bounds().right() + kStandardSpacing;
604 } 601 }
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 828
832 void ToolbarView::OnShowHomeButtonChanged() { 829 void ToolbarView::OnShowHomeButtonChanged() {
833 Layout(); 830 Layout();
834 SchedulePaint(); 831 SchedulePaint();
835 } 832 }
836 833
837 int ToolbarView::content_shadow_height() const { 834 int ToolbarView::content_shadow_height() const {
838 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ? 835 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ?
839 kContentShadowHeightAsh : kContentShadowHeight; 836 kContentShadowHeightAsh : kContentShadowHeight;
840 } 837 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/toolbar/site_chip_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698