Chromium Code Reviews| 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/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 206 ui::NativeTheme::kColorId_TextfieldSelectionColor)); | 206 ui::NativeTheme::kColorId_TextfieldSelectionColor)); |
| 207 ime_inline_autocomplete_view_->SetVisible(false); | 207 ime_inline_autocomplete_view_->SetVisible(false); |
| 208 AddChildView(ime_inline_autocomplete_view_); | 208 AddChildView(ime_inline_autocomplete_view_); |
| 209 | 209 |
| 210 selected_keyword_view_ = new SelectedKeywordView(font_list, profile()); | 210 selected_keyword_view_ = new SelectedKeywordView(font_list, profile()); |
| 211 AddChildView(selected_keyword_view_); | 211 AddChildView(selected_keyword_view_); |
| 212 | 212 |
| 213 gfx::FontList bubble_font_list = | 213 gfx::FontList bubble_font_list = |
| 214 font_list.DeriveWithHeightUpperBound(bubble_height); | 214 font_list.DeriveWithHeightUpperBound(bubble_height); |
| 215 keyword_hint_view_ = new KeywordHintView( | 215 keyword_hint_view_ = new KeywordHintView( |
| 216 profile(), font_list, bubble_font_list, location_height, | 216 this, profile(), font_list, bubble_font_list, location_height, |
| 217 GetColor(LocationBarView::DEEMPHASIZED_TEXT), background_color); | 217 GetColor(LocationBarView::DEEMPHASIZED_TEXT), background_color); |
| 218 AddChildView(keyword_hint_view_); | 218 AddChildView(keyword_hint_view_); |
| 219 | 219 |
| 220 std::vector<std::unique_ptr<ContentSettingImageModel>> models = | 220 std::vector<std::unique_ptr<ContentSettingImageModel>> models = |
| 221 ContentSettingImageModel::GenerateContentSettingImageModels(); | 221 ContentSettingImageModel::GenerateContentSettingImageModels(); |
| 222 for (auto& model : models) { | 222 for (auto& model : models) { |
| 223 ContentSettingImageView* image_view = | 223 ContentSettingImageView* image_view = |
| 224 new ContentSettingImageView(std::move(model), this, font_list); | 224 new ContentSettingImageView(std::move(model), this, font_list); |
| 225 content_setting_views_.push_back(image_view); | 225 content_setting_views_.push_back(image_view); |
| 226 image_view->SetVisible(false); | 226 image_view->SetVisible(false); |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 702 zoom_view_->Update(zoom::ZoomController::FromWebContents(web_contents)); | 702 zoom_view_->Update(zoom::ZoomController::FromWebContents(web_contents)); |
| 703 if (!zoom_view_->visible()) | 703 if (!zoom_view_->visible()) |
| 704 ZoomBubbleView::CloseCurrentBubble(); | 704 ZoomBubbleView::CloseCurrentBubble(); |
| 705 return was_visible != zoom_view_->visible(); | 705 return was_visible != zoom_view_->visible(); |
| 706 } | 706 } |
| 707 | 707 |
| 708 void LocationBarView::OnDefaultZoomLevelChanged() { | 708 void LocationBarView::OnDefaultZoomLevelChanged() { |
| 709 RefreshZoomView(); | 709 RefreshZoomView(); |
| 710 } | 710 } |
| 711 | 711 |
| 712 void LocationBarView::ButtonPressed(views::Button* sender, | |
| 713 const ui::Event& event) { | |
| 714 DCHECK_EQ(keyword_hint_view_, sender); | |
| 715 DCHECK(event.IsMouseEvent() || event.IsGestureEvent()); | |
| 716 omnibox_view_->model()->AcceptKeyword( | |
|
Peter Kasting
2017/04/05 23:09:43
We should probably only do this on IsOnlyLeftMouse
Evan Stade
2017/04/06 00:05:41
correct, NotifyClick/ButtonPressed is already only
| |
| 717 event.IsMouseEvent() ? KeywordModeEntryMethod::CLICK_ON_VIEW | |
| 718 : KeywordModeEntryMethod::TAP_ON_VIEW); | |
| 719 } | |
| 720 | |
| 712 bool LocationBarView::RefreshSaveCreditCardIconView() { | 721 bool LocationBarView::RefreshSaveCreditCardIconView() { |
| 713 WebContents* web_contents = GetWebContents(); | 722 WebContents* web_contents = GetWebContents(); |
| 714 if (!web_contents) | 723 if (!web_contents) |
| 715 return false; | 724 return false; |
| 716 | 725 |
| 717 const bool was_visible = save_credit_card_icon_view_->visible(); | 726 const bool was_visible = save_credit_card_icon_view_->visible(); |
| 718 // |controller| may be nullptr due to lazy initialization. | 727 // |controller| may be nullptr due to lazy initialization. |
| 719 autofill::SaveCardBubbleControllerImpl* controller = | 728 autofill::SaveCardBubbleControllerImpl* controller = |
| 720 autofill::SaveCardBubbleControllerImpl::FromWebContents(web_contents); | 729 autofill::SaveCardBubbleControllerImpl::FromWebContents(web_contents); |
| 721 bool enabled = controller && controller->IsIconVisible(); | 730 bool enabled = controller && controller->IsIconVisible(); |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1031 // LocationBarView, private TemplateURLServiceObserver implementation: | 1040 // LocationBarView, private TemplateURLServiceObserver implementation: |
| 1032 | 1041 |
| 1033 void LocationBarView::OnTemplateURLServiceChanged() { | 1042 void LocationBarView::OnTemplateURLServiceChanged() { |
| 1034 template_url_service_->RemoveObserver(this); | 1043 template_url_service_->RemoveObserver(this); |
| 1035 template_url_service_ = nullptr; | 1044 template_url_service_ = nullptr; |
| 1036 // If the browser is no longer active, let's not show the info bubble, as this | 1045 // If the browser is no longer active, let's not show the info bubble, as this |
| 1037 // would make the browser the active window again. | 1046 // would make the browser the active window again. |
| 1038 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) | 1047 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) |
| 1039 ShowFirstRunBubble(); | 1048 ShowFirstRunBubble(); |
| 1040 } | 1049 } |
| OLD | NEW |