Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(434)

Side by Side Diff: components/omnibox/browser/omnibox_controller.cc

Issue 2048693003: Misc. omnibox cleanup: (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resync Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "components/search/search.h" 15 #include "components/search/search.h"
16 #include "ui/gfx/geometry/rect.h" 16 #include "ui/gfx/geometry/rect.h"
17 17
18 OmniboxController::OmniboxController(OmniboxEditModel* omnibox_edit_model, 18 OmniboxController::OmniboxController(OmniboxEditModel* omnibox_edit_model,
19 OmniboxClient* client) 19 OmniboxClient* client)
20 : omnibox_edit_model_(omnibox_edit_model), 20 : omnibox_edit_model_(omnibox_edit_model),
21 client_(client), 21 client_(client),
22 popup_(NULL), 22 popup_(nullptr),
23 autocomplete_controller_(new AutocompleteController( 23 autocomplete_controller_(new AutocompleteController(
24 client_->CreateAutocompleteProviderClient(), 24 client_->CreateAutocompleteProviderClient(),
25 this, 25 this,
26 AutocompleteClassifier::kDefaultOmniboxProviders)), 26 AutocompleteClassifier::kDefaultOmniboxProviders)),
27 weak_ptr_factory_(this) {} 27 weak_ptr_factory_(this) {}
28 28
29 OmniboxController::~OmniboxController() { 29 OmniboxController::~OmniboxController() {
30 } 30 }
31 31
32 void OmniboxController::StartAutocomplete( 32 void OmniboxController::StartAutocomplete(
(...skipping 11 matching lines...) Expand all
44 if (default_match_changed) { 44 if (default_match_changed) {
45 // The default match has changed, we need to let the OmniboxEditModel know 45 // The default match has changed, we need to let the OmniboxEditModel know
46 // about new inline autocomplete text (blue highlight). 46 // about new inline autocomplete text (blue highlight).
47 const AutocompleteResult::const_iterator match(result().default_match()); 47 const AutocompleteResult::const_iterator match(result().default_match());
48 if (match != result().end()) { 48 if (match != result().end()) {
49 current_match_ = *match; 49 current_match_ = *match;
50 omnibox_edit_model_->OnCurrentMatchChanged(); 50 omnibox_edit_model_->OnCurrentMatchChanged();
51 } else { 51 } else {
52 InvalidateCurrentMatch(); 52 InvalidateCurrentMatch();
53 popup_->OnResultChanged(); 53 popup_->OnResultChanged();
54 omnibox_edit_model_->OnPopupDataChanged(base::string16(), NULL, 54 omnibox_edit_model_->OnPopupDataChanged(base::string16(), nullptr,
55 base::string16(), false); 55 base::string16(), false);
56 } 56 }
57 } else { 57 } else {
58 popup_->OnResultChanged(); 58 popup_->OnResultChanged();
59 } 59 }
60 60
61 if (!popup_->IsOpen() && was_open) { 61 if (!popup_->IsOpen() && was_open) {
62 // Accept the temporary text as the user text, because it makes little sense 62 // Accept the temporary text as the user text, because it makes little sense
63 // to have temporary text when the popup is closed. 63 // to have temporary text when the popup is closed.
64 omnibox_edit_model_->AcceptTemporaryTextAsUserText(); 64 omnibox_edit_model_->AcceptTemporaryTextAsUserText();
(...skipping 12 matching lines...) Expand all
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 }
OLDNEW
« no previous file with comments | « components/omnibox/browser/history_url_provider.cc ('k') | components/omnibox/browser/omnibox_edit_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698