| Index: chrome/browser/ui/views/location_bar/location_bar_view.cc
|
| diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc
|
| index c05c5bdc1f26bccffb5cf2179e9df6fe25adb83c..d0391f1b83106a16b63faebd5389e67fbc90472c 100644
|
| --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
|
| +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
|
| @@ -46,10 +46,8 @@
|
| #include "chrome/browser/ui/views/location_bar/location_bar_layout.h"
|
| #include "chrome/browser/ui/views/location_bar/location_icon_view.h"
|
| #include "chrome/browser/ui/views/location_bar/open_pdf_in_reader_view.h"
|
| -#include "chrome/browser/ui/views/location_bar/origin_chip_view.h"
|
| #include "chrome/browser/ui/views/location_bar/page_action_image_view.h"
|
| #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h"
|
| -#include "chrome/browser/ui/views/location_bar/search_button.h"
|
| #include "chrome/browser/ui/views/location_bar/selected_keyword_view.h"
|
| #include "chrome/browser/ui/views/location_bar/star_view.h"
|
| #include "chrome/browser/ui/views/location_bar/translate_icon_view.h"
|
| @@ -102,14 +100,6 @@ using views::View;
|
|
|
| namespace {
|
|
|
| -const gfx::Tween::Type kShowTweenType = gfx::Tween::LINEAR_OUT_SLOW_IN;
|
| -const gfx::Tween::Type kHideTweenType = gfx::Tween::FAST_OUT_LINEAR_IN;
|
| -
|
| -// The search button images are made to look as if they overlay the normal edge
|
| -// images, but to align things, the search button needs to be inset horizontally
|
| -// by 1 px.
|
| -const int kSearchButtonInset = 1;
|
| -
|
| int GetEditLeadingInternalSpace() {
|
| // The textfield has 1 px of whitespace before the text in the RTL case only.
|
| return base::i18n::IsRTL() ? 1 : 0;
|
| @@ -160,7 +150,6 @@ LocationBarView::LocationBarView(Browser* browser,
|
| browser_(browser),
|
| omnibox_view_(NULL),
|
| delegate_(delegate),
|
| - origin_chip_view_(NULL),
|
| location_icon_view_(NULL),
|
| ev_bubble_view_(NULL),
|
| ime_inline_autocomplete_view_(NULL),
|
| @@ -174,17 +163,10 @@ LocationBarView::LocationBarView(Browser* browser,
|
| manage_passwords_icon_view_(NULL),
|
| translate_icon_view_(NULL),
|
| star_view_(NULL),
|
| - search_button_(NULL),
|
| is_popup_mode_(is_popup_mode),
|
| show_focus_rect_(false),
|
| template_url_service_(NULL),
|
| - dropdown_animation_offset_(0),
|
| - starting_omnibox_offset_(0),
|
| - current_omnibox_offset_(0),
|
| - starting_omnibox_leading_inset_(0),
|
| - current_omnibox_leading_inset_(0),
|
| - current_omnibox_width_(0),
|
| - ending_omnibox_width_(0) {
|
| + dropdown_animation_offset_(0) {
|
| edit_bookmarks_enabled_.Init(
|
| bookmarks::prefs::kEditBookmarksEnabled, profile->GetPrefs(),
|
| base::Bind(&LocationBarView::Update, base::Unretained(this),
|
| @@ -274,11 +256,6 @@ void LocationBarView::Init() {
|
| ime_inline_autocomplete_view_->SetVisible(false);
|
| AddChildView(ime_inline_autocomplete_view_);
|
|
|
| - origin_chip_view_ = new OriginChipView(this, profile(), font_list);
|
| - origin_chip_view_->SetFocusable(false);
|
| - origin_chip_view_->set_drag_controller(this);
|
| - AddChildView(origin_chip_view_);
|
| -
|
| const SkColor text_color = GetColor(ToolbarModel::NONE, TEXT);
|
| selected_keyword_view_ = new SelectedKeywordView(
|
| bubble_font_list, text_color, background_color, profile());
|
| @@ -342,18 +319,6 @@ void LocationBarView::Init() {
|
| star_view_->SetVisible(false);
|
| AddChildView(star_view_);
|
|
|
| - search_button_ = new SearchButton(this);
|
| - search_button_->SetVisible(false);
|
| - AddChildView(search_button_);
|
| -
|
| - show_url_animation_.reset(new gfx::SlideAnimation(this));
|
| - show_url_animation_->SetTweenType(kShowTweenType);
|
| - show_url_animation_->SetSlideDuration(200);
|
| -
|
| - hide_url_animation_.reset(new gfx::SlideAnimation(this));
|
| - hide_url_animation_->SetTweenType(kHideTweenType);
|
| - hide_url_animation_->SetSlideDuration(175);
|
| -
|
| // Initialize the location entry. We do this to avoid a black flash which is
|
| // visible when the location entry has just been initialized.
|
| Update(NULL);
|
| @@ -471,7 +436,7 @@ void LocationBarView::SetTranslateIconToggled(bool on) {
|
|
|
| gfx::Point LocationBarView::GetOmniboxViewOrigin() const {
|
| gfx::Point origin(omnibox_view_->bounds().origin());
|
| - origin.set_x(GetMirroredXInView(origin.x() - current_omnibox_offset_));
|
| + origin.set_x(GetMirroredXInView(origin.x()));
|
| views::View::ConvertPointToScreen(this, &origin);
|
| return origin;
|
| }
|
| @@ -579,31 +544,23 @@ gfx::Size LocationBarView::GetPreferredSize() const {
|
| gfx::Size min_size(border_painter_->GetMinimumSize());
|
| if (!IsInitialized())
|
| return min_size;
|
| - gfx::Size search_button_min_size(search_button_->GetMinimumSize());
|
| - min_size.SetToMax(search_button_min_size);
|
|
|
| // Compute width of omnibox-leading content.
|
| const int horizontal_edge_thickness = GetHorizontalEdgeThickness();
|
| int leading_width = horizontal_edge_thickness;
|
| - // TODO(pkasting): Make the origin chip min width sane, and make the chip
|
| - // handle being shrunken down more gracefully; then uncomment this.
|
| - /*if (GetToolbarModel()->ShouldShowOriginChip())
|
| - leading_width += origin_chip_view_->GetMinimumSize().width();*/
|
| if (ShouldShowKeywordBubble()) {
|
| // The selected keyword view can collapse completely.
|
| } else if (ShouldShowEVBubble()) {
|
| leading_width += kBubblePadding +
|
| ev_bubble_view_->GetMinimumSizeForLabelText(
|
| GetToolbarModel()->GetEVCertName()).width();
|
| - } else if (!origin_chip_view_->visible()) {
|
| + } else {
|
| leading_width +=
|
| kItemPadding + location_icon_view_->GetMinimumSize().width();
|
| }
|
|
|
| // Compute width of omnibox-trailing content.
|
| - int trailing_width = search_button_->visible() ?
|
| - (search_button_->GetMinimumSize().width() + kSearchButtonInset) :
|
| - horizontal_edge_thickness;
|
| + int trailing_width = horizontal_edge_thickness;
|
| trailing_width += IncrementalMinimumWidth(star_view_) +
|
| IncrementalMinimumWidth(translate_icon_view_) +
|
| IncrementalMinimumWidth(open_pdf_in_reader_view_) +
|
| @@ -627,7 +584,6 @@ void LocationBarView::Layout() {
|
| if (!IsInitialized())
|
| return;
|
|
|
| - origin_chip_view_->SetVisible(GetToolbarModel()->ShouldShowOriginChip());
|
| selected_keyword_view_->SetVisible(false);
|
| location_icon_view_->SetVisible(false);
|
| ev_bubble_view_->SetVisible(false);
|
| @@ -641,16 +597,6 @@ void LocationBarView::Layout() {
|
| LocationBarLayout::RIGHT_EDGE,
|
| kItemPadding - omnibox_view_->GetInsets().right());
|
|
|
| - const int origin_chip_preferred_width =
|
| - origin_chip_view_->GetPreferredSize().width();
|
| - const int origin_chip_width =
|
| - origin_chip_view_->visible() ? origin_chip_preferred_width : 0;
|
| - // Always give the origin chip view its desired size and lay it out, even when
|
| - // it's not visible, so we can calculate the correct animation values below
|
| - // when switching to tabs that have the origin chip hidden.
|
| - origin_chip_view_->SetBounds(0, 0, origin_chip_preferred_width, height());
|
| - origin_chip_view_->Layout();
|
| -
|
| const int bubble_location_y = vertical_edge_thickness() + kBubblePadding;
|
| const base::string16 keyword(omnibox_view_->model()->keyword());
|
| // In some cases (e.g. fullscreen mode) we may have 0 height. We still want
|
| @@ -687,7 +633,7 @@ void LocationBarView::Layout() {
|
| leading_decorations.AddDecoration(bubble_location_y, bubble_height, false,
|
| kMaxBubbleFraction, kBubblePadding,
|
| kItemPadding, ev_bubble_view_);
|
| - } else if (!origin_chip_view_->visible()) {
|
| + } else {
|
| leading_decorations.AddDecoration(
|
| vertical_edge_thickness(), location_height,
|
| location_icon_view_);
|
| @@ -752,13 +698,9 @@ void LocationBarView::Layout() {
|
|
|
| // Perform layout.
|
| const int horizontal_edge_thickness = GetHorizontalEdgeThickness();
|
| - int full_width = width() - horizontal_edge_thickness - origin_chip_width;
|
| + int full_width = width() - horizontal_edge_thickness;
|
|
|
| - const gfx::Size search_button_size(search_button_->GetPreferredSize());
|
| - const int search_button_reserved_width =
|
| - search_button_size.width() + kSearchButtonInset;
|
| - full_width -= search_button_->visible() ?
|
| - search_button_reserved_width : horizontal_edge_thickness;
|
| + full_width -= horizontal_edge_thickness;
|
| int entry_width = full_width;
|
| leading_decorations.LayoutPass1(&entry_width);
|
| trailing_decorations.LayoutPass1(&entry_width);
|
| @@ -769,114 +711,11 @@ void LocationBarView::Layout() {
|
| int available_width = entry_width - location_needed_width;
|
| // The bounds must be wide enough for all the decorations to fit.
|
| gfx::Rect location_bounds(
|
| - origin_chip_width + horizontal_edge_thickness, vertical_edge_thickness(),
|
| + horizontal_edge_thickness, vertical_edge_thickness(),
|
| std::max(full_width, full_width - entry_width), location_height);
|
| leading_decorations.LayoutPass3(&location_bounds, &available_width);
|
| trailing_decorations.LayoutPass3(&location_bounds, &available_width);
|
|
|
| - // Calculate the animation parameters (see comments on these members in the
|
| - // header). We have to do this in Layout, after |origin_chip_view_| is laid
|
| - // out, because that may affect the host label offset in the origin chip.
|
| - const base::string16& chip_text(origin_chip_view_->host_label_text());
|
| - // If the chip is clicked, the omnibox text will become the toolbar model's
|
| - // formatted URL. We can't ask the omnibox for its current text, because
|
| - // while the chip is visible the current text is empty.
|
| - size_t prefix_end = 0;
|
| - const base::string16& omnibox_text(
|
| - GetToolbarModel()->GetFormattedURL(&prefix_end));
|
| - // Do a case-insensitive search to better match cases like
|
| - // "Settings" <-> "chrome://settings". Skip any pre-hostname text.
|
| - size_t chip_text_offset = std::search(
|
| - omnibox_text.begin() + prefix_end, omnibox_text.end(),
|
| - chip_text.begin(), chip_text.end(),
|
| - base::CaseInsensitiveCompare<base::char16>()) - omnibox_text.begin();
|
| - // If we couldn't find the chip text, try checking whether the omnibox text
|
| - // starts with it, as is true for e.g. file: URLs.
|
| - if ((chip_text_offset >= omnibox_text.length()) &&
|
| - StartsWith(omnibox_text, chip_text, true))
|
| - chip_text_offset = 0;
|
| - const gfx::FontList& font_list = omnibox_view_->GetFontList();
|
| - const int chip_text_width = gfx::GetStringWidth(chip_text, font_list);
|
| - const int old_starting_offset = starting_omnibox_offset_;
|
| - const int old_starting_leading_inset = starting_omnibox_leading_inset_;
|
| - const int old_ending_width = ending_omnibox_width_;
|
| - starting_omnibox_offset_ = current_omnibox_offset_ = 0;
|
| - starting_omnibox_leading_inset_ = current_omnibox_leading_inset_ = 0;
|
| - ending_omnibox_width_ = gfx::GetStringWidth(omnibox_text, font_list);
|
| - if (chip_text_offset < omnibox_text.length()) {
|
| - if (base::i18n::IsRTL())
|
| - chip_text_offset += chip_text.length();
|
| - base::string16 extra_omnibox_text(base::i18n::IsRTL() ?
|
| - omnibox_text.substr(chip_text_offset) :
|
| - omnibox_text.substr(0, chip_text_offset));
|
| - starting_omnibox_leading_inset_ =
|
| - gfx::GetStringWidth(extra_omnibox_text, font_list);
|
| - starting_omnibox_offset_ = origin_chip_view_->HostLabelOffset() -
|
| - starting_omnibox_leading_inset_;
|
| - current_omnibox_width_ = chip_text_width;
|
| - } else {
|
| - // If the chip text wasn't found in the omnibox text, then instead of
|
| - // starting the show animation clipped to the "hostname", we'll start with
|
| - // the entire omnibox text visible, clipped to the remaining chip width, and
|
| - // only animate any necessary expansion of that width, without moving the
|
| - // omnibox bounds.
|
| - current_omnibox_width_ = origin_chip_view_->WidthFromStartOfLabels();
|
| - }
|
| -
|
| - // End the animations immediately if the parameters have changed.
|
| - if ((starting_omnibox_offset_ != old_starting_offset) ||
|
| - (starting_omnibox_leading_inset_ != old_starting_leading_inset) ||
|
| - (ending_omnibox_width_ != old_ending_width))
|
| - EndOriginChipAnimations(true);
|
| -
|
| - // Also end the animations immediately if there's nothing to animate (but do
|
| - // allow the chip to fade back in).
|
| - const ui::NativeTheme* native_theme = GetNativeTheme();
|
| - const SkColor ending_selection_text_color = native_theme->GetSystemColor(
|
| - ui::NativeTheme::kColorId_TextfieldSelectionColor);
|
| - const SkColor ending_selection_background_color =
|
| - native_theme->GetSystemColor(
|
| - ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused);
|
| - if ((starting_omnibox_offset_ == 0) &&
|
| - (starting_omnibox_leading_inset_ == 0) &&
|
| - (ending_omnibox_width_ == chip_text_width) &&
|
| - (hide_url_animation_->is_animating() ||
|
| - ((ending_selection_text_color ==
|
| - origin_chip_view_->pressed_text_color()) &&
|
| - (ending_selection_background_color ==
|
| - origin_chip_view_->pressed_background_color()))))
|
| - EndOriginChipAnimations(false);
|
| -
|
| - if (show_url_animation_->is_animating()) {
|
| - omnibox_view_->SetSelectionTextColor(gfx::Tween::ColorValueBetween(
|
| - show_url_animation_->GetCurrentValue(),
|
| - origin_chip_view_->pressed_text_color(),
|
| - ending_selection_text_color));
|
| - omnibox_view_->SetSelectionBackgroundColor(gfx::Tween::ColorValueBetween(
|
| - show_url_animation_->GetCurrentValue(),
|
| - origin_chip_view_->pressed_background_color(),
|
| - ending_selection_background_color));
|
| - current_omnibox_offset_ =
|
| - show_url_animation_->CurrentValueBetween(starting_omnibox_offset_, 0);
|
| - current_omnibox_leading_inset_ = show_url_animation_->CurrentValueBetween(
|
| - starting_omnibox_leading_inset_, 0);
|
| - current_omnibox_width_ = show_url_animation_->CurrentValueBetween(
|
| - chip_text_width, ending_omnibox_width_);
|
| - } else if (hide_url_animation_->is_animating()) {
|
| - current_omnibox_offset_ =
|
| - hide_url_animation_->CurrentValueBetween(0, starting_omnibox_offset_);
|
| - current_omnibox_leading_inset_ = hide_url_animation_->CurrentValueBetween(
|
| - 0, starting_omnibox_leading_inset_);
|
| - current_omnibox_width_ = hide_url_animation_->CurrentValueBetween(
|
| - ending_omnibox_width_, chip_text_width);
|
| - }
|
| - // Contract |available_width| as necessary, but never expand it. This way,
|
| - // we'll never draw suggested text at first and then have it disappear
|
| - // midway through the animation.
|
| - if (current_omnibox_offset_ > 0)
|
| - available_width -= current_omnibox_offset_;
|
| - location_bounds.Inset(current_omnibox_offset_, 0, 0, 0);
|
| -
|
| // Layout out the suggested text view right aligned to the location
|
| // entry. Only show the suggested text if we can fit the text from one
|
| // character before the end of the selection to the end of the text and the
|
| @@ -955,10 +794,6 @@ void LocationBarView::Layout() {
|
| }
|
|
|
| omnibox_view_->SetBoundsRect(location_bounds);
|
| -
|
| - search_button_->SetBoundsRect(gfx::Rect(
|
| - gfx::Point(width() - search_button_reserved_width, 0),
|
| - search_button_size));
|
| }
|
|
|
| ////////////////////////////////////////////////////////////////////////////////
|
| @@ -994,37 +829,9 @@ void LocationBarView::ResetTabState(WebContents* contents) {
|
| }
|
|
|
| void LocationBarView::ShowURL() {
|
| - // Start the animation before calling ShowURL(), since the latter eventually
|
| - // calls back to Layout(), and if the animation is not marked as "running",
|
| - // we'll draw the omnibox in its final position briefly until the first
|
| - // animation callback reaches us.
|
| - if (chrome::ShouldDisplayOriginChip()) {
|
| - // If we're currently hiding, reverse the hide by swapping to the show
|
| - // animation, offset so that the text is in the same position.
|
| - if (hide_url_animation_->is_animating()) {
|
| - const double show_value = GetValueForAnimation(false);
|
| - hide_url_animation_->Reset();
|
| - show_url_animation_->Show();
|
| - // This must be done after calling Show() and is not equivalent to
|
| - // calling Reset(n) before Show(); Reset() would have caused the entire
|
| - // animation curve (and time) to run between this value and the final
|
| - // value, whereas Show() + SetCurrentValue() skips the animation forward
|
| - // to the supplied value.
|
| - show_url_animation_->SetCurrentValue(show_value);
|
| - } else {
|
| - show_url_animation_->Show();
|
| - }
|
| - }
|
| omnibox_view_->ShowURL();
|
| }
|
|
|
| -void LocationBarView::EndOriginChipAnimations(bool cancel_fade) {
|
| - show_url_animation_->End();
|
| - hide_url_animation_->End();
|
| - if (cancel_fade)
|
| - origin_chip_view_->CancelFade();
|
| -}
|
| -
|
| ToolbarModel* LocationBarView::GetToolbarModel() {
|
| return delegate_->GetToolbarModel();
|
| }
|
| @@ -1195,49 +1002,10 @@ bool LocationBarView::ShouldShowKeywordBubble() const {
|
| }
|
|
|
| bool LocationBarView::ShouldShowEVBubble() const {
|
| - return !chrome::ShouldDisplayOriginChip() &&
|
| + return
|
| (GetToolbarModel()->GetSecurityLevel(false) == ToolbarModel::EV_SECURE);
|
| }
|
|
|
| -double LocationBarView::GetValueForAnimation(bool hide) const {
|
| - int calculated_offset;
|
| - const gfx::Tween::Type tween_type = hide ? kHideTweenType : kShowTweenType;
|
| - int start_offset = starting_omnibox_offset_, end_offset = 0;
|
| - if (hide)
|
| - std::swap(start_offset, end_offset);
|
| - const int desired_offset = abs(current_omnibox_offset_);
|
| - // Binary-search the value space (0 <= value <= 1) to find the appropriate
|
| - // position. We only bother to iterate to within 1/64 of the desired value,
|
| - // because the longer of the two animations will only run for twelve frames
|
| - // anyway (200 ms * 60 Hz), so at this point we'll have a maximum error of
|
| - // less than a fifth of an animation frame, which the user isn't going to
|
| - // notice.
|
| - //
|
| - // We have to use this method because Tween::CalculateValue() is not
|
| - // necessarily easily invertible. Luckily, this only runs when the user
|
| - // reverses the animation (rare), and the limit on how many iterations we'll
|
| - // do ensures the cost is unnoticeable.
|
| - double value = 0.5;
|
| - double step = value / 2;
|
| - do {
|
| - calculated_offset = abs(gfx::Tween::IntValueBetween(
|
| - gfx::Tween::CalculateValue(tween_type, value), start_offset,
|
| - end_offset));
|
| - if (calculated_offset < desired_offset)
|
| - value += step;
|
| - else if (calculated_offset > desired_offset)
|
| - value -= step;
|
| - step /= 2;
|
| - } while ((calculated_offset != desired_offset) && (step >= (1.0 / 64)));
|
| - return value;
|
| -}
|
| -
|
| -void LocationBarView::ResetShowAnimationAndColors() {
|
| - show_url_animation_->Reset();
|
| - omnibox_view_->UseDefaultSelectionTextColor();
|
| - omnibox_view_->UseDefaultSelectionBackgroundColor();
|
| -}
|
| -
|
| ////////////////////////////////////////////////////////////////////////////////
|
| // LocationBarView, private LocationBar implementation:
|
|
|
| @@ -1335,11 +1103,6 @@ void LocationBarView::UpdateGeneratedCreditCardView() {
|
| }
|
|
|
| void LocationBarView::SaveStateToContents(WebContents* contents) {
|
| - // If we're about to switch tabs, complete any current animations, so that if
|
| - // the user is in the midst of hiding the URL, when he returns to this tab,
|
| - // the URL will be hidden rather than shown.
|
| - // NOTE: This must be called before SaveStateToTab().
|
| - EndOriginChipAnimations(true);
|
| omnibox_view_->SaveStateToTab(contents);
|
| }
|
|
|
| @@ -1459,25 +1222,15 @@ void LocationBarView::OnPaint(gfx::Canvas* canvas) {
|
| void LocationBarView::PaintChildren(gfx::Canvas* canvas,
|
| const views::CullSet& cull_set) {
|
| // Paint all the children except for the omnibox itself, which may need to be
|
| - // clipped if it's animating in, and the origin chip and the search button,
|
| - // which will be painted after the border.
|
| + // clipped if it's animating in.
|
| for (int i = 0, count = child_count(); i < count; ++i) {
|
| views::View* child = child_at(i);
|
| - if (!child->layer() && (child != omnibox_view_) &&
|
| - (child != origin_chip_view_) && (child != search_button_))
|
| + if (!child->layer() && (child != omnibox_view_))
|
| child->Paint(canvas, cull_set);
|
| }
|
|
|
| {
|
| gfx::ScopedCanvas scoped_canvas(canvas);
|
| - if (show_url_animation_->is_animating() ||
|
| - hide_url_animation_->is_animating()) {
|
| - gfx::Rect clip_rect(omnibox_view_->bounds());
|
| - clip_rect.Inset(current_omnibox_leading_inset_, 0, 0, 0);
|
| - clip_rect.set_width(current_omnibox_width_);
|
| - clip_rect.set_x(GetMirroredXForRect(clip_rect));
|
| - canvas->ClipRect(clip_rect);
|
| - }
|
| omnibox_view_->Paint(canvas, cull_set);
|
| }
|
|
|
| @@ -1494,11 +1247,6 @@ void LocationBarView::PaintChildren(gfx::Canvas* canvas,
|
| if (is_popup_mode_ && (GetHorizontalEdgeThickness() == 0))
|
| border_rect.Inset(-kPopupEdgeThickness, 0);
|
| views::Painter::PaintPainterAt(canvas, border_painter_.get(), border_rect);
|
| -
|
| - // The origin chip and the search button must be painted after the border so
|
| - // that the border shadow is not drawn over them.
|
| - origin_chip_view_->Paint(canvas, cull_set);
|
| - search_button_->Paint(canvas, cull_set);
|
| }
|
|
|
| ////////////////////////////////////////////////////////////////////////////////
|
| @@ -1506,15 +1254,8 @@ void LocationBarView::PaintChildren(gfx::Canvas* canvas,
|
|
|
| void LocationBarView::ButtonPressed(views::Button* sender,
|
| const ui::Event& event) {
|
| - if (sender == mic_search_view_) {
|
| - command_updater()->ExecuteCommand(IDC_TOGGLE_SPEECH_INPUT);
|
| - return;
|
| - }
|
| -
|
| - DCHECK_EQ(search_button_, sender);
|
| - // TODO(pkasting): When macourteau adds UMA stats for this, wire them up here.
|
| - omnibox_view_->model()->AcceptInput(
|
| - ui::DispositionFromEventFlags(event.flags()), false);
|
| + DCHECK_EQ(mic_search_view_, sender);
|
| + command_updater()->ExecuteCommand(IDC_TOGGLE_SPEECH_INPUT);
|
| }
|
|
|
| ////////////////////////////////////////////////////////////////////////////////
|
| @@ -1540,12 +1281,10 @@ void LocationBarView::WriteDragDataForView(views::View* sender,
|
|
|
| int LocationBarView::GetDragOperationsForView(views::View* sender,
|
| const gfx::Point& p) {
|
| - DCHECK((sender == location_icon_view_) || (sender == ev_bubble_view_) ||
|
| - (sender == origin_chip_view_));
|
| + DCHECK((sender == location_icon_view_) || (sender == ev_bubble_view_));
|
| WebContents* web_contents = delegate_->GetWebContents();
|
| return (web_contents && web_contents->GetURL().is_valid() &&
|
| - (!GetOmniboxView()->IsEditingOrEmpty() ||
|
| - sender == origin_chip_view_)) ?
|
| + (!GetOmniboxView()->IsEditingOrEmpty())) ?
|
| (ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK) :
|
| ui::DragDropTypes::DRAG_NONE;
|
| }
|
| @@ -1564,20 +1303,6 @@ void LocationBarView::OnChanged() {
|
| location_icon_view_->SetImage(GetThemeProvider()->GetImageSkiaNamed(icon_id));
|
| location_icon_view_->ShowTooltip(!GetOmniboxView()->IsEditingOrEmpty());
|
|
|
| - ToolbarModel* toolbar_model = GetToolbarModel();
|
| - chrome::DisplaySearchButtonConditions conditions =
|
| - chrome::GetDisplaySearchButtonConditions();
|
| - bool meets_conditions =
|
| - (conditions == chrome::DISPLAY_SEARCH_BUTTON_ALWAYS) ||
|
| - ((conditions != chrome::DISPLAY_SEARCH_BUTTON_NEVER) &&
|
| - (toolbar_model->WouldPerformSearchTermReplacement(true) ||
|
| - ((conditions == chrome::DISPLAY_SEARCH_BUTTON_FOR_STR_OR_IIP) &&
|
| - toolbar_model->input_in_progress())));
|
| - search_button_->SetVisible(!is_popup_mode_ && meets_conditions);
|
| - search_button_->UpdateIcon(icon_id == IDR_OMNIBOX_SEARCH);
|
| -
|
| - origin_chip_view_->OnChanged();
|
| -
|
| Layout();
|
| SchedulePaint();
|
| }
|
| @@ -1594,23 +1319,6 @@ const ToolbarModel* LocationBarView::GetToolbarModel() const {
|
| return delegate_->GetToolbarModel();
|
| }
|
|
|
| -void LocationBarView::HideURL() {
|
| - DCHECK(chrome::ShouldDisplayOriginChip());
|
| -
|
| - // If we're currently showing, reverse the hide by swapping to the hide
|
| - // animation, offset so that the text is in the same position.
|
| - if (show_url_animation_->is_animating()) {
|
| - const double hide_value = GetValueForAnimation(true);
|
| - ResetShowAnimationAndColors();
|
| - hide_url_animation_->Show();
|
| - // This must be done after calling Show() and is not equivalent to Reset(n);
|
| - // see comments in ShowURL().
|
| - hide_url_animation_->SetCurrentValue(hide_value);
|
| - } else {
|
| - hide_url_animation_->Show();
|
| - }
|
| -}
|
| -
|
| ////////////////////////////////////////////////////////////////////////////////
|
| // LocationBarView, private DropdownBarHostDelegate implementation:
|
|
|
| @@ -1623,29 +1331,6 @@ void LocationBarView::SetAnimationOffset(int offset) {
|
| }
|
|
|
| ////////////////////////////////////////////////////////////////////////////////
|
| -// LocationBarView, private gfx::AnimationDelegate implementation:
|
| -
|
| -void LocationBarView::AnimationProgressed(const gfx::Animation* animation) {
|
| - DCHECK((animation == show_url_animation_.get()) ||
|
| - (animation == hide_url_animation_.get()));
|
| - Layout();
|
| - SchedulePaint();
|
| -}
|
| -
|
| -void LocationBarView::AnimationEnded(const gfx::Animation* animation) {
|
| - if (animation == show_url_animation_.get()) {
|
| - ResetShowAnimationAndColors();
|
| - Layout();
|
| - SchedulePaint();
|
| - } else {
|
| - DCHECK(animation == hide_url_animation_.get());
|
| - hide_url_animation_->Reset();
|
| - origin_chip_view_->FadeIn();
|
| - omnibox_view_->HideURL(); // Calls OnChanged(), triggering layout.
|
| - }
|
| -}
|
| -
|
| -////////////////////////////////////////////////////////////////////////////////
|
| // LocationBarView, private TemplateURLServiceObserver implementation:
|
|
|
| void LocationBarView::OnTemplateURLServiceChanged() {
|
|
|