| 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 "chrome/browser/ui/omnibox/omnibox_view.h" | 8 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
| 9 | 9 |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 } | 171 } |
| 172 | 172 |
| 173 void OmniboxView::HideURL() { | 173 void OmniboxView::HideURL() { |
| 174 controller_->GetToolbarModel()->set_origin_chip_enabled(true); | 174 controller_->GetToolbarModel()->set_origin_chip_enabled(true); |
| 175 controller_->GetToolbarModel()->set_url_replacement_enabled(true); | 175 controller_->GetToolbarModel()->set_url_replacement_enabled(true); |
| 176 model_->UpdatePermanentText(); | 176 model_->UpdatePermanentText(); |
| 177 RevertWithoutResettingSearchTermReplacement(); | 177 RevertWithoutResettingSearchTermReplacement(); |
| 178 } | 178 } |
| 179 | 179 |
| 180 void OmniboxView::RevertAll() { | 180 void OmniboxView::RevertAll() { |
| 181 controller_->GetToolbarModel()->set_origin_chip_enabled(true); |
| 181 controller_->GetToolbarModel()->set_url_replacement_enabled(true); | 182 controller_->GetToolbarModel()->set_url_replacement_enabled(true); |
| 182 RevertWithoutResettingSearchTermReplacement(); | 183 RevertWithoutResettingSearchTermReplacement(); |
| 183 } | 184 } |
| 184 | 185 |
| 185 void OmniboxView::RevertWithoutResettingSearchTermReplacement() { | 186 void OmniboxView::RevertWithoutResettingSearchTermReplacement() { |
| 186 CloseOmniboxPopup(); | 187 CloseOmniboxPopup(); |
| 187 if (model_.get()) | 188 if (model_.get()) |
| 188 model_->Revert(); | 189 model_->Revert(); |
| 189 TextChanged(); | 190 TextChanged(); |
| 190 } | 191 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 // |profile| can be NULL in tests. | 223 // |profile| can be NULL in tests. |
| 223 if (profile) | 224 if (profile) |
| 224 model_.reset(new OmniboxEditModel(this, controller, profile)); | 225 model_.reset(new OmniboxEditModel(this, controller, profile)); |
| 225 } | 226 } |
| 226 | 227 |
| 227 void OmniboxView::TextChanged() { | 228 void OmniboxView::TextChanged() { |
| 228 EmphasizeURLComponents(); | 229 EmphasizeURLComponents(); |
| 229 if (model_.get()) | 230 if (model_.get()) |
| 230 model_->OnChanged(); | 231 model_->OnChanged(); |
| 231 } | 232 } |
| OLD | NEW |