| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "components/omnibox/browser/omnibox_controller.h" | 5 #include "components/omnibox/browser/omnibox_controller.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
| 8 #include "components/omnibox/browser/autocomplete_classifier.h" | 8 #include "components/omnibox/browser/autocomplete_classifier.h" |
| 9 #include "components/omnibox/browser/autocomplete_match.h" | 9 #include "components/omnibox/browser/autocomplete_match.h" |
| 10 #include "components/omnibox/browser/omnibox_client.h" | 10 #include "components/omnibox/browser/omnibox_client.h" |
| 11 #include "components/omnibox/browser/omnibox_edit_controller.h" | 11 #include "components/omnibox/browser/omnibox_edit_controller.h" |
| 12 #include "components/omnibox/browser/omnibox_edit_model.h" | 12 #include "components/omnibox/browser/omnibox_edit_model.h" |
| 13 #include "components/omnibox/browser/omnibox_popup_model.h" | 13 #include "components/omnibox/browser/omnibox_popup_model.h" |
| 14 #include "components/omnibox/browser/omnibox_popup_view.h" | 14 #include "components/omnibox/browser/omnibox_popup_view.h" |
| 15 #include "ui/gfx/geometry/rect.h" | 15 #include "ui/gfx/geometry/rect.h" |
| 16 | 16 |
| 17 OmniboxController::OmniboxController(OmniboxEditModel* omnibox_edit_model, | 17 OmniboxController::OmniboxController(OmniboxEditModel* omnibox_edit_model, |
| 18 OmniboxClient* client) | 18 OmniboxClient* client) |
| 19 : omnibox_edit_model_(omnibox_edit_model), | 19 : omnibox_edit_model_(omnibox_edit_model), |
| 20 client_(client), | 20 client_(client), |
| 21 popup_(nullptr), | 21 popup_(nullptr), |
| 22 autocomplete_controller_(new AutocompleteController( | 22 autocomplete_controller_(new AutocompleteController( |
| 23 client_->CreateAutocompleteProviderClient(), | 23 client_->CreateAutocompleteProviderClient(), |
| 24 this, | 24 this, |
| 25 AutocompleteClassifier::kDefaultOmniboxProviders)), | 25 AutocompleteClassifier::DefaultOmniboxProviders())), |
| 26 weak_ptr_factory_(this) {} | 26 weak_ptr_factory_(this) {} |
| 27 | 27 |
| 28 OmniboxController::~OmniboxController() { | 28 OmniboxController::~OmniboxController() { |
| 29 } | 29 } |
| 30 | 30 |
| 31 void OmniboxController::StartAutocomplete( | 31 void OmniboxController::StartAutocomplete( |
| 32 const AutocompleteInput& input) const { | 32 const AutocompleteInput& input) const { |
| 33 ClearPopupKeywordMode(); | 33 ClearPopupKeywordMode(); |
| 34 popup_->SetHoveredLine(OmniboxPopupModel::kNoMatch); | 34 popup_->SetHoveredLine(OmniboxPopupModel::kNoMatch); |
| 35 | 35 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 77 |
| 78 void OmniboxController::ClearPopupKeywordMode() const { | 78 void OmniboxController::ClearPopupKeywordMode() const { |
| 79 if (popup_->IsOpen() && | 79 if (popup_->IsOpen() && |
| 80 popup_->selected_line_state() == OmniboxPopupModel::KEYWORD) | 80 popup_->selected_line_state() == OmniboxPopupModel::KEYWORD) |
| 81 popup_->SetSelectedLineState(OmniboxPopupModel::NORMAL); | 81 popup_->SetSelectedLineState(OmniboxPopupModel::NORMAL); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void OmniboxController::SetAnswerBitmap(const SkBitmap& bitmap) { | 84 void OmniboxController::SetAnswerBitmap(const SkBitmap& bitmap) { |
| 85 popup_->SetAnswerBitmap(bitmap); | 85 popup_->SetAnswerBitmap(bitmap); |
| 86 } | 86 } |
| OLD | NEW |