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

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

Issue 110893004: [SiteChip] Add UMA, finish wiring site chip experiment up to the omnibox. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years 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 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 int location_x = home_->x() + home_->width() + kStandardSpacing; 577 int location_x = home_->x() + home_->width() + kStandardSpacing;
578 int available_width = std::max(0, width() - kRightEdgeSpacing - 578 int available_width = std::max(0, width() - kRightEdgeSpacing -
579 app_menu_width - browser_actions_width - location_x); 579 app_menu_width - browser_actions_width - location_x);
580 580
581 // Cap site chip width at 1/2 the size available to the location bar. 581 // Cap site chip width at 1/2 the size available to the location bar.
582 site_chip_view_->SetVisible(site_chip_view_->ShouldShow()); 582 site_chip_view_->SetVisible(site_chip_view_->ShouldShow());
583 int site_chip_width = site_chip_view_->GetPreferredSize().width(); 583 int site_chip_width = site_chip_view_->GetPreferredSize().width();
584 site_chip_width = std::max(0, std::min(site_chip_width, 584 site_chip_width = std::max(0, std::min(site_chip_width,
585 (available_width - kStandardSpacing) / 2)); 585 (available_width - kStandardSpacing) / 2));
586 if (site_chip_view_->visible()) 586 if (site_chip_view_->visible())
587 available_width -= site_chip_width; 587 available_width -= site_chip_width + kStandardSpacing;
588 588
589 int location_height = location_bar_->GetPreferredSize().height(); 589 int location_height = location_bar_->GetPreferredSize().height();
590 int location_y = (height() - location_height + 1) / 2; 590 int location_y = (height() - location_height + 1) / 2;
591 location_bar_->SetBounds(location_x, location_y, std::max(available_width, 0), 591 location_bar_->SetBounds(location_x, location_y, std::max(available_width, 0),
592 location_height); 592 location_height);
593 int browser_actions_x = location_bar_->bounds().right(); 593 int browser_actions_x = location_bar_->bounds().right();
594 594
595 if (site_chip_view_->visible()) { 595 if (site_chip_view_->visible()) {
596 site_chip_view_->SetBounds(browser_actions_x + kStandardSpacing, 596 site_chip_view_->SetBounds(browser_actions_x + kStandardSpacing,
597 child_y, 597 child_y,
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 838
839 void ToolbarView::OnShowHomeButtonChanged() { 839 void ToolbarView::OnShowHomeButtonChanged() {
840 Layout(); 840 Layout();
841 SchedulePaint(); 841 SchedulePaint();
842 } 842 }
843 843
844 int ToolbarView::content_shadow_height() const { 844 int ToolbarView::content_shadow_height() const {
845 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ? 845 return browser_->host_desktop_type() == chrome::HOST_DESKTOP_TYPE_ASH ?
846 kContentShadowHeightAsh : kContentShadowHeight; 846 kContentShadowHeightAsh : kContentShadowHeight;
847 } 847 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698