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 } | 106 } |
107 | 107 |
108 void OmniboxView::SetUserText(const base::string16& text, | 108 void OmniboxView::SetUserText(const base::string16& text, |
109 bool update_popup) { | 109 bool update_popup) { |
110 if (model_.get()) | 110 if (model_.get()) |
111 model_->SetUserText(text); | 111 model_->SetUserText(text); |
112 SetWindowTextAndCaretPos(text, text.length(), update_popup, true); | 112 SetWindowTextAndCaretPos(text, text.length(), update_popup, true); |
113 } | 113 } |
114 | 114 |
115 void OmniboxView::RevertAll() { | 115 void OmniboxView::RevertAll() { |
116 controller_->GetToolbarModel()->set_url_replacement_enabled(true); | |
117 RevertWithoutResettingSearchTermReplacement(); | |
118 } | |
119 | |
120 void OmniboxView::RevertWithoutResettingSearchTermReplacement() { | |
121 CloseOmniboxPopup(); | 116 CloseOmniboxPopup(); |
122 if (model_.get()) | 117 if (model_.get()) |
123 model_->Revert(); | 118 model_->Revert(); |
124 TextChanged(); | 119 TextChanged(); |
125 } | 120 } |
126 | 121 |
127 void OmniboxView::CloseOmniboxPopup() { | 122 void OmniboxView::CloseOmniboxPopup() { |
128 if (model_.get()) | 123 if (model_.get()) |
129 model_->StopAutocomplete(); | 124 model_->StopAutocomplete(); |
130 } | 125 } |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 if (client) { | 191 if (client) { |
197 model_.reset(new OmniboxEditModel(this, controller, std::move(client))); | 192 model_.reset(new OmniboxEditModel(this, controller, std::move(client))); |
198 } | 193 } |
199 } | 194 } |
200 | 195 |
201 void OmniboxView::TextChanged() { | 196 void OmniboxView::TextChanged() { |
202 EmphasizeURLComponents(); | 197 EmphasizeURLComponents(); |
203 if (model_.get()) | 198 if (model_.get()) |
204 model_->OnChanged(); | 199 model_->OnChanged(); |
205 } | 200 } |
OLD | NEW |