| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/location_bar/location_bar_view.h" | 5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 gfx::Point origin(location_entry_view_->bounds().origin()); | 609 gfx::Point origin(location_entry_view_->bounds().origin()); |
| 610 // If the UI layout is RTL, the coordinate system is not transformed and | 610 // If the UI layout is RTL, the coordinate system is not transformed and |
| 611 // therefore we need to adjust the X coordinate so that bubble appears on the | 611 // therefore we need to adjust the X coordinate so that bubble appears on the |
| 612 // right hand side of the location bar. | 612 // right hand side of the location bar. |
| 613 if (base::i18n::IsRTL()) | 613 if (base::i18n::IsRTL()) |
| 614 origin.set_x(width() - origin.x()); | 614 origin.set_x(width() - origin.x()); |
| 615 views::View::ConvertPointToScreen(this, &origin); | 615 views::View::ConvertPointToScreen(this, &origin); |
| 616 return origin; | 616 return origin; |
| 617 } | 617 } |
| 618 | 618 |
| 619 void LocationBarView::SetInstantSuggestion(const string16& text, | 619 void LocationBarView::SetInstantSuggestion(const string16& text) { |
| 620 bool animate_to_complete) { | |
| 621 // Don't show the suggested text if inline autocomplete is prevented. | 620 // Don't show the suggested text if inline autocomplete is prevented. |
| 622 if (!text.empty()) { | 621 if (!text.empty()) { |
| 623 if (!suggested_text_view_) { | 622 if (!suggested_text_view_) { |
| 624 suggested_text_view_ = new SuggestedTextView( | 623 suggested_text_view_ = new SuggestedTextView( |
| 625 location_entry_->model(), instant_extended_api_enabled_); | 624 instant_extended_api_enabled_); |
| 626 suggested_text_view_->SetText(text); | 625 suggested_text_view_->SetText(text); |
| 627 suggested_text_view_->SetFont(location_entry_->GetFont()); | 626 suggested_text_view_->SetFont(location_entry_->GetFont()); |
| 628 AddChildView(suggested_text_view_); | 627 AddChildView(suggested_text_view_); |
| 629 } else if (suggested_text_view_->text() != text) { | 628 } else if (suggested_text_view_->text() != text) { |
| 630 suggested_text_view_->SetText(text); | 629 suggested_text_view_->SetText(text); |
| 631 } | 630 } |
| 632 if (animate_to_complete && !location_entry_->IsImeComposing()) | |
| 633 suggested_text_view_->StartAnimation(); | |
| 634 } else if (suggested_text_view_) { | 631 } else if (suggested_text_view_) { |
| 635 delete suggested_text_view_; | 632 delete suggested_text_view_; |
| 636 suggested_text_view_ = NULL; | 633 suggested_text_view_ = NULL; |
| 637 } else { | 634 } else { |
| 638 return; | 635 return; |
| 639 } | 636 } |
| 640 | 637 |
| 641 Layout(); | 638 Layout(); |
| 642 SchedulePaint(); | 639 SchedulePaint(); |
| 643 } | 640 } |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1148 location_icon_view_->SetImage( | 1145 location_icon_view_->SetImage( |
| 1149 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 1146 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| 1150 location_entry_->GetIcon())); | 1147 location_entry_->GetIcon())); |
| 1151 location_icon_view_->ShowTooltip(!GetLocationEntry()->IsEditingOrEmpty()); | 1148 location_icon_view_->ShowTooltip(!GetLocationEntry()->IsEditingOrEmpty()); |
| 1152 | 1149 |
| 1153 Layout(); | 1150 Layout(); |
| 1154 SchedulePaint(); | 1151 SchedulePaint(); |
| 1155 } | 1152 } |
| 1156 | 1153 |
| 1157 void LocationBarView::OnSelectionBoundsChanged() { | 1154 void LocationBarView::OnSelectionBoundsChanged() { |
| 1158 if (suggested_text_view_) | |
| 1159 suggested_text_view_->StopAnimation(); | |
| 1160 } | 1155 } |
| 1161 | 1156 |
| 1162 void LocationBarView::OnInputInProgress(bool in_progress) { | 1157 void LocationBarView::OnInputInProgress(bool in_progress) { |
| 1163 delegate_->OnInputInProgress(in_progress); | 1158 delegate_->OnInputInProgress(in_progress); |
| 1164 } | 1159 } |
| 1165 | 1160 |
| 1166 void LocationBarView::OnKillFocus() { | 1161 void LocationBarView::OnKillFocus() { |
| 1167 } | 1162 } |
| 1168 | 1163 |
| 1169 void LocationBarView::OnSetFocus() { | 1164 void LocationBarView::OnSetFocus() { |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1681 } | 1676 } |
| 1682 | 1677 |
| 1683 void LocationBarView::CleanupFadeAnimation() { | 1678 void LocationBarView::CleanupFadeAnimation() { |
| 1684 // Since we're no longer animating we don't need our layer. | 1679 // Since we're no longer animating we don't need our layer. |
| 1685 SetPaintToLayer(false); | 1680 SetPaintToLayer(false); |
| 1686 // Bubble labels don't need a transparent background anymore. | 1681 // Bubble labels don't need a transparent background anymore. |
| 1687 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE); | 1682 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE); |
| 1688 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE); | 1683 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE); |
| 1689 } | 1684 } |
| 1690 #endif // USE_AURA | 1685 #endif // USE_AURA |
| OLD | NEW |