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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 return (id == gfx::VectorIconId::OMNIBOX_HTTP) | 106 return (id == gfx::VectorIconId::OMNIBOX_HTTP) |
107 ? gfx::VectorIconId::LOCATION_BAR_HTTP | 107 ? gfx::VectorIconId::LOCATION_BAR_HTTP |
108 : id; | 108 : id; |
109 #else | 109 #else |
110 NOTIMPLEMENTED(); | 110 NOTIMPLEMENTED(); |
111 return gfx::VectorIconId::VECTOR_ICON_NONE; | 111 return gfx::VectorIconId::VECTOR_ICON_NONE; |
112 #endif | 112 #endif |
113 } | 113 } |
114 | 114 |
115 void OmniboxView::SetUserText(const base::string16& text) { | 115 void OmniboxView::SetUserText(const base::string16& text) { |
116 SetUserText(text, text, true); | 116 SetUserText(text, true); |
117 } | 117 } |
118 | 118 |
119 void OmniboxView::SetUserText(const base::string16& text, | 119 void OmniboxView::SetUserText(const base::string16& text, |
120 const base::string16& display_text, | |
121 bool update_popup) { | 120 bool update_popup) { |
122 if (model_.get()) | 121 if (model_.get()) |
123 model_->SetUserText(text); | 122 model_->SetUserText(text); |
124 SetWindowTextAndCaretPos(display_text, display_text.length(), update_popup, | 123 SetWindowTextAndCaretPos(text, text.length(), update_popup, true); |
125 true); | |
126 } | 124 } |
127 | 125 |
128 void OmniboxView::ShowURL() { | 126 void OmniboxView::ShowURL() { |
129 SetFocus(); | 127 SetFocus(); |
130 controller_->GetToolbarModel()->set_url_replacement_enabled(false); | 128 controller_->GetToolbarModel()->set_url_replacement_enabled(false); |
131 model_->UpdatePermanentText(); | 129 model_->UpdatePermanentText(); |
132 RevertWithoutResettingSearchTermReplacement(); | 130 RevertWithoutResettingSearchTermReplacement(); |
133 SelectAll(true); | 131 SelectAll(true); |
134 } | 132 } |
135 | 133 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 if (client) { | 180 if (client) { |
183 model_.reset(new OmniboxEditModel(this, controller, std::move(client))); | 181 model_.reset(new OmniboxEditModel(this, controller, std::move(client))); |
184 } | 182 } |
185 } | 183 } |
186 | 184 |
187 void OmniboxView::TextChanged() { | 185 void OmniboxView::TextChanged() { |
188 EmphasizeURLComponents(); | 186 EmphasizeURLComponents(); |
189 if (model_.get()) | 187 if (model_.get()) |
190 model_->OnChanged(); | 188 model_->OnChanged(); |
191 } | 189 } |
OLD | NEW |