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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 80 |
81 int OmniboxView::GetIcon() const { | 81 int OmniboxView::GetIcon() const { |
82 if (!IsEditingOrEmpty()) | 82 if (!IsEditingOrEmpty()) |
83 return controller_->GetToolbarModel()->GetIcon(); | 83 return controller_->GetToolbarModel()->GetIcon(); |
84 int id = AutocompleteMatch::TypeToIcon(model_.get() ? | 84 int id = AutocompleteMatch::TypeToIcon(model_.get() ? |
85 model_->CurrentTextType() : AutocompleteMatchType::URL_WHAT_YOU_TYPED); | 85 model_->CurrentTextType() : AutocompleteMatchType::URL_WHAT_YOU_TYPED); |
86 return (id == IDR_OMNIBOX_HTTP) ? IDR_LOCATION_BAR_HTTP : id; | 86 return (id == IDR_OMNIBOX_HTTP) ? IDR_LOCATION_BAR_HTTP : id; |
87 } | 87 } |
88 | 88 |
89 gfx::VectorIconId OmniboxView::GetVectorIcon(bool invert) const { | 89 gfx::VectorIconId OmniboxView::GetVectorIcon(bool invert) const { |
90 #if !defined(OS_ANDROID) && !defined(OS_MACOSX) && !defined(OS_IOS) | 90 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
91 if (!IsEditingOrEmpty()) { | 91 if (!IsEditingOrEmpty()) { |
92 gfx::VectorIconId id = controller_->GetToolbarModel()->GetVectorIcon(); | 92 gfx::VectorIconId id = controller_->GetToolbarModel()->GetVectorIcon(); |
93 if (invert) { | 93 if (invert) { |
94 if (id == gfx::VectorIconId::LOCATION_BAR_HTTPS_VALID) | 94 if (id == gfx::VectorIconId::LOCATION_BAR_HTTPS_VALID) |
95 return gfx::VectorIconId::LOCATION_BAR_HTTPS_VALID_INVERT; | 95 return gfx::VectorIconId::LOCATION_BAR_HTTPS_VALID_INVERT; |
96 if (id == gfx::VectorIconId::LOCATION_BAR_HTTPS_INVALID) | 96 if (id == gfx::VectorIconId::LOCATION_BAR_HTTPS_INVALID) |
97 return gfx::VectorIconId::LOCATION_BAR_HTTPS_INVALID_INVERT; | 97 return gfx::VectorIconId::LOCATION_BAR_HTTPS_INVALID_INVERT; |
98 } | 98 } |
99 return id; | 99 return id; |
100 } | 100 } |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 if (client) { | 182 if (client) { |
183 model_.reset(new OmniboxEditModel(this, controller, std::move(client))); | 183 model_.reset(new OmniboxEditModel(this, controller, std::move(client))); |
184 } | 184 } |
185 } | 185 } |
186 | 186 |
187 void OmniboxView::TextChanged() { | 187 void OmniboxView::TextChanged() { |
188 EmphasizeURLComponents(); | 188 EmphasizeURLComponents(); |
189 if (model_.get()) | 189 if (model_.get()) |
190 model_->OnChanged(); | 190 model_->OnChanged(); |
191 } | 191 } |
OLD | NEW |