| 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> |
| 11 |
| 10 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 11 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 13 #include "build/build_config.h" | 15 #include "build/build_config.h" |
| 14 #include "components/omnibox/browser/autocomplete_match.h" | 16 #include "components/omnibox/browser/autocomplete_match.h" |
| 15 #include "components/omnibox/browser/omnibox_client.h" | 17 #include "components/omnibox/browser/omnibox_client.h" |
| 16 #include "components/omnibox/browser/omnibox_edit_controller.h" | 18 #include "components/omnibox/browser/omnibox_edit_controller.h" |
| 17 #include "components/toolbar/toolbar_model.h" | 19 #include "components/toolbar/toolbar_model.h" |
| 18 #include "grit/components_scaled_resources.h" | 20 #include "grit/components_scaled_resources.h" |
| 19 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 } | 171 } |
| 170 | 172 |
| 171 void OmniboxView::OnMatchOpened(const AutocompleteMatch& match) { | 173 void OmniboxView::OnMatchOpened(const AutocompleteMatch& match) { |
| 172 } | 174 } |
| 173 | 175 |
| 174 OmniboxView::OmniboxView(OmniboxEditController* controller, | 176 OmniboxView::OmniboxView(OmniboxEditController* controller, |
| 175 scoped_ptr<OmniboxClient> client) | 177 scoped_ptr<OmniboxClient> client) |
| 176 : controller_(controller) { | 178 : controller_(controller) { |
| 177 // |client| can be null in tests. | 179 // |client| can be null in tests. |
| 178 if (client) { | 180 if (client) { |
| 179 model_.reset( | 181 model_.reset(new OmniboxEditModel(this, controller, std::move(client))); |
| 180 new OmniboxEditModel(this, controller, client.Pass())); | |
| 181 } | 182 } |
| 182 } | 183 } |
| 183 | 184 |
| 184 void OmniboxView::TextChanged() { | 185 void OmniboxView::TextChanged() { |
| 185 EmphasizeURLComponents(); | 186 EmphasizeURLComponents(); |
| 186 if (model_.get()) | 187 if (model_.get()) |
| 187 model_->OnChanged(); | 188 model_->OnChanged(); |
| 188 } | 189 } |
| OLD | NEW |