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 // This file defines helper functions shared by the various implementations | 5 // This file defines helper functions shared by the various implementations |
6 // of OmniboxView. | 6 // of OmniboxView. |
7 | 7 |
8 #include "components/omnibox/browser/omnibox_view.h" | 8 #include "components/omnibox/browser/omnibox_view.h" |
9 | 9 |
10 #include <utility> | 10 #include <utility> |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 int id = AutocompleteMatch::TypeToIcon(model_.get() ? | 85 int id = AutocompleteMatch::TypeToIcon(model_.get() ? |
86 model_->CurrentTextType() : AutocompleteMatchType::URL_WHAT_YOU_TYPED); | 86 model_->CurrentTextType() : AutocompleteMatchType::URL_WHAT_YOU_TYPED); |
87 return (id == IDR_OMNIBOX_HTTP) ? IDR_LOCATION_BAR_HTTP : id; | 87 return (id == IDR_OMNIBOX_HTTP) ? IDR_LOCATION_BAR_HTTP : id; |
88 } | 88 } |
89 | 89 |
90 gfx::VectorIconId OmniboxView::GetVectorIcon() const { | 90 gfx::VectorIconId OmniboxView::GetVectorIcon() const { |
91 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 91 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
92 if (!IsEditingOrEmpty()) | 92 if (!IsEditingOrEmpty()) |
93 return controller_->GetToolbarModel()->GetVectorIcon(); | 93 return controller_->GetToolbarModel()->GetVectorIcon(); |
94 | 94 |
95 // Reuse the dropdown icons... | 95 return AutocompleteMatch::TypeToVectorIcon( |
96 gfx::VectorIconId id = AutocompleteMatch::TypeToVectorIcon( | |
97 model_ ? model_->CurrentTextType() | 96 model_ ? model_->CurrentTextType() |
98 : AutocompleteMatchType::URL_WHAT_YOU_TYPED); | 97 : AutocompleteMatchType::URL_WHAT_YOU_TYPED); |
Peter Kasting
2016/07/18 19:31:25
Make sure this change doesn't change the omnibox i
| |
99 // but use a different version for the HTTP icon. | |
100 return (id == gfx::VectorIconId::OMNIBOX_HTTP) | |
101 ? gfx::VectorIconId::LOCATION_BAR_HTTP | |
102 : id; | |
103 #else | 98 #else |
104 NOTIMPLEMENTED(); | 99 NOTIMPLEMENTED(); |
105 return gfx::VectorIconId::VECTOR_ICON_NONE; | 100 return gfx::VectorIconId::VECTOR_ICON_NONE; |
106 #endif | 101 #endif |
107 } | 102 } |
108 | 103 |
109 void OmniboxView::SetUserText(const base::string16& text) { | 104 void OmniboxView::SetUserText(const base::string16& text) { |
110 SetUserText(text, true); | 105 SetUserText(text, true); |
111 } | 106 } |
112 | 107 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
215 if (client) { | 210 if (client) { |
216 model_.reset(new OmniboxEditModel(this, controller, std::move(client))); | 211 model_.reset(new OmniboxEditModel(this, controller, std::move(client))); |
217 } | 212 } |
218 } | 213 } |
219 | 214 |
220 void OmniboxView::TextChanged() { | 215 void OmniboxView::TextChanged() { |
221 EmphasizeURLComponents(); | 216 EmphasizeURLComponents(); |
222 if (model_.get()) | 217 if (model_.get()) |
223 model_->OnChanged(); | 218 model_->OnChanged(); |
224 } | 219 } |
OLD | NEW |