| 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 29 matching lines...) Expand all Loading... |
| 40 #include "chrome/browser/ui/views/location_bar/action_box_button_view.h" | 40 #include "chrome/browser/ui/views/location_bar/action_box_button_view.h" |
| 41 #include "chrome/browser/ui/views/location_bar/content_setting_image_view.h" | 41 #include "chrome/browser/ui/views/location_bar/content_setting_image_view.h" |
| 42 #include "chrome/browser/ui/views/location_bar/ev_bubble_view.h" | 42 #include "chrome/browser/ui/views/location_bar/ev_bubble_view.h" |
| 43 #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h" | 43 #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h" |
| 44 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" | 44 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" |
| 45 #include "chrome/browser/ui/views/location_bar/open_pdf_in_reader_view.h" | 45 #include "chrome/browser/ui/views/location_bar/open_pdf_in_reader_view.h" |
| 46 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h" | 46 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h" |
| 47 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h" | 47 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h" |
| 48 #include "chrome/browser/ui/views/location_bar/selected_keyword_view.h" | 48 #include "chrome/browser/ui/views/location_bar/selected_keyword_view.h" |
| 49 #include "chrome/browser/ui/views/location_bar/star_view.h" | 49 #include "chrome/browser/ui/views/location_bar/star_view.h" |
| 50 #include "chrome/browser/ui/views/location_bar/suggested_text_view.h" | |
| 51 #include "chrome/browser/ui/views/location_bar/web_intents_button_view.h" | 50 #include "chrome/browser/ui/views/location_bar/web_intents_button_view.h" |
| 52 #include "chrome/browser/ui/views/location_bar/zoom_bubble_view.h" | 51 #include "chrome/browser/ui/views/location_bar/zoom_bubble_view.h" |
| 53 #include "chrome/browser/ui/views/location_bar/zoom_view.h" | 52 #include "chrome/browser/ui/views/location_bar/zoom_view.h" |
| 54 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" | 53 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" |
| 55 #include "chrome/browser/ui/views/omnibox/omnibox_views.h" | 54 #include "chrome/browser/ui/views/omnibox/omnibox_views.h" |
| 56 #include "chrome/browser/ui/webui/instant_ui.h" | 55 #include "chrome/browser/ui/webui/instant_ui.h" |
| 57 #include "chrome/browser/ui/zoom/zoom_controller.h" | 56 #include "chrome/browser/ui/zoom/zoom_controller.h" |
| 58 #include "chrome/common/chrome_notification_types.h" | 57 #include "chrome/common/chrome_notification_types.h" |
| 59 #include "chrome/common/extensions/feature_switch.h" | 58 #include "chrome/common/extensions/feature_switch.h" |
| 60 #include "chrome/common/pref_names.h" | 59 #include "chrome/common/pref_names.h" |
| (...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 gfx::Point origin(location_entry_view_->bounds().origin()); | 608 gfx::Point origin(location_entry_view_->bounds().origin()); |
| 610 // If the UI layout is RTL, the coordinate system is not transformed and | 609 // 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 | 610 // therefore we need to adjust the X coordinate so that bubble appears on the |
| 612 // right hand side of the location bar. | 611 // right hand side of the location bar. |
| 613 if (base::i18n::IsRTL()) | 612 if (base::i18n::IsRTL()) |
| 614 origin.set_x(width() - origin.x()); | 613 origin.set_x(width() - origin.x()); |
| 615 views::View::ConvertPointToScreen(this, &origin); | 614 views::View::ConvertPointToScreen(this, &origin); |
| 616 return origin; | 615 return origin; |
| 617 } | 616 } |
| 618 | 617 |
| 619 void LocationBarView::SetInstantSuggestion(const string16& text, | 618 void LocationBarView::SetInstantSuggestion(const string16& text) { |
| 620 bool animate_to_complete) { | |
| 621 // Don't show the suggested text if inline autocomplete is prevented. | 619 // Don't show the suggested text if inline autocomplete is prevented. |
| 622 if (!text.empty()) { | 620 if (!text.empty()) { |
| 623 if (!suggested_text_view_) { | 621 if (!suggested_text_view_) { |
| 624 suggested_text_view_ = new SuggestedTextView( | 622 suggested_text_view_ = new views::Label(); |
| 625 location_entry_->model(), instant_extended_api_enabled_); | 623 suggested_text_view_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
| 624 suggested_text_view_->SetAutoColorReadabilityEnabled(false); |
| 625 suggested_text_view_->SetEnabledColor(LocationBarView::GetColor( |
| 626 instant_extended_api_enabled_, ToolbarModel::NONE, |
| 627 LocationBarView::DEEMPHASIZED_TEXT)); |
| 626 suggested_text_view_->SetText(text); | 628 suggested_text_view_->SetText(text); |
| 627 suggested_text_view_->SetFont(location_entry_->GetFont()); | 629 suggested_text_view_->SetFont(location_entry_->GetFont()); |
| 628 AddChildView(suggested_text_view_); | 630 AddChildView(suggested_text_view_); |
| 629 } else if (suggested_text_view_->text() != text) { | 631 } else if (suggested_text_view_->text() != text) { |
| 630 suggested_text_view_->SetText(text); | 632 suggested_text_view_->SetText(text); |
| 631 } | 633 } |
| 632 if (animate_to_complete && !location_entry_->IsImeComposing()) | |
| 633 suggested_text_view_->StartAnimation(); | |
| 634 } else if (suggested_text_view_) { | 634 } else if (suggested_text_view_) { |
| 635 delete suggested_text_view_; | 635 delete suggested_text_view_; |
| 636 suggested_text_view_ = NULL; | 636 suggested_text_view_ = NULL; |
| 637 } else { | 637 } else { |
| 638 return; | 638 return; |
| 639 } | 639 } |
| 640 | 640 |
| 641 Layout(); | 641 Layout(); |
| 642 SchedulePaint(); | 642 SchedulePaint(); |
| 643 } | 643 } |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1148 location_icon_view_->SetImage( | 1148 location_icon_view_->SetImage( |
| 1149 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( | 1149 ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( |
| 1150 location_entry_->GetIcon())); | 1150 location_entry_->GetIcon())); |
| 1151 location_icon_view_->ShowTooltip(!GetLocationEntry()->IsEditingOrEmpty()); | 1151 location_icon_view_->ShowTooltip(!GetLocationEntry()->IsEditingOrEmpty()); |
| 1152 | 1152 |
| 1153 Layout(); | 1153 Layout(); |
| 1154 SchedulePaint(); | 1154 SchedulePaint(); |
| 1155 } | 1155 } |
| 1156 | 1156 |
| 1157 void LocationBarView::OnSelectionBoundsChanged() { | 1157 void LocationBarView::OnSelectionBoundsChanged() { |
| 1158 if (suggested_text_view_) | |
| 1159 suggested_text_view_->StopAnimation(); | |
| 1160 } | 1158 } |
| 1161 | 1159 |
| 1162 void LocationBarView::OnInputInProgress(bool in_progress) { | 1160 void LocationBarView::OnInputInProgress(bool in_progress) { |
| 1163 delegate_->OnInputInProgress(in_progress); | 1161 delegate_->OnInputInProgress(in_progress); |
| 1164 } | 1162 } |
| 1165 | 1163 |
| 1166 void LocationBarView::OnKillFocus() { | 1164 void LocationBarView::OnKillFocus() { |
| 1167 } | 1165 } |
| 1168 | 1166 |
| 1169 void LocationBarView::OnSetFocus() { | 1167 void LocationBarView::OnSetFocus() { |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1681 } | 1679 } |
| 1682 | 1680 |
| 1683 void LocationBarView::CleanupFadeAnimation() { | 1681 void LocationBarView::CleanupFadeAnimation() { |
| 1684 // Since we're no longer animating we don't need our layer. | 1682 // Since we're no longer animating we don't need our layer. |
| 1685 SetPaintToLayer(false); | 1683 SetPaintToLayer(false); |
| 1686 // Bubble labels don't need a transparent background anymore. | 1684 // Bubble labels don't need a transparent background anymore. |
| 1687 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE); | 1685 ev_bubble_view_->SetLabelBackgroundColor(SK_ColorWHITE); |
| 1688 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE); | 1686 selected_keyword_view_->SetLabelBackgroundColor(SK_ColorWHITE); |
| 1689 } | 1687 } |
| 1690 #endif // USE_AURA | 1688 #endif // USE_AURA |
| OLD | NEW |