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

Side by Side Diff: chrome/browser/ui/webui/omnibox/omnibox_ui_handler.cc

Issue 1430313003: Change MojoWebUIController to use mojo::StrongBindingSet. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-geolocation-untangle
Patch Set: Created 5 years 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
« no previous file with comments | « chrome/browser/ui/webui/omnibox/omnibox_ui_handler.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "chrome/browser/ui/webui/omnibox/omnibox_ui_handler.h" 5 #include "chrome/browser/ui/webui/omnibox/omnibox_ui_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/strings/string16.h" 11 #include "base/strings/string16.h"
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "base/values.h" 15 #include "base/values.h"
16 #include "chrome/browser/autocomplete/chrome_autocomplete_provider_client.h" 16 #include "chrome/browser/autocomplete/chrome_autocomplete_provider_client.h"
17 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" 17 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h"
18 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 18 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
19 #include "chrome/browser/history/history_service_factory.h" 19 #include "chrome/browser/history/history_service_factory.h"
20 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/search/search.h" 21 #include "chrome/browser/search/search.h"
21 #include "chrome/browser/search_engines/template_url_service_factory.h" 22 #include "chrome/browser/search_engines/template_url_service_factory.h"
22 #include "components/bookmarks/browser/bookmark_model.h" 23 #include "components/bookmarks/browser/bookmark_model.h"
23 #include "components/history/core/browser/history_service.h" 24 #include "components/history/core/browser/history_service.h"
24 #include "components/history/core/browser/url_database.h" 25 #include "components/history/core/browser/url_database.h"
25 #include "components/metrics/proto/omnibox_event.pb.h" 26 #include "components/metrics/proto/omnibox_event.pb.h"
26 #include "components/omnibox/browser/autocomplete_classifier.h" 27 #include "components/omnibox/browser/autocomplete_classifier.h"
27 #include "components/omnibox/browser/autocomplete_controller.h" 28 #include "components/omnibox/browser/autocomplete_controller.h"
28 #include "components/omnibox/browser/autocomplete_match.h" 29 #include "components/omnibox/browser/autocomplete_match.h"
29 #include "components/omnibox/browser/autocomplete_provider.h" 30 #include "components/omnibox/browser/autocomplete_provider.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 AutocompleteResultsForProviderMojo::New()); 102 AutocompleteResultsForProviderMojo::New());
102 result->provider_name = input->GetName(); 103 result->provider_name = input->GetName();
103 result->results = 104 result->results =
104 mojo::Array<AutocompleteMatchMojoPtr>::From(input->matches()); 105 mojo::Array<AutocompleteMatchMojoPtr>::From(input->matches());
105 return result.Pass(); 106 return result.Pass();
106 } 107 }
107 }; 108 };
108 109
109 } // namespace mojo 110 } // namespace mojo
110 111
111 OmniboxUIHandler::OmniboxUIHandler( 112 OmniboxUIHandler::OmniboxUIHandler(content::WebUI* web_ui)
112 Profile* profile, 113 : profile_(Profile::FromWebUI(web_ui)) {
113 mojo::InterfaceRequest<OmniboxUIHandlerMojo> request)
114 : profile_(profile),
115 binding_(this, request.Pass()) {
116 ResetController(); 114 ResetController();
117 } 115 }
118 116
119 OmniboxUIHandler::~OmniboxUIHandler() { 117 OmniboxUIHandler::~OmniboxUIHandler() {
120 } 118 }
121 119
122 void OmniboxUIHandler::OnResultChanged(bool default_match_changed) { 120 void OmniboxUIHandler::OnResultChanged(bool default_match_changed) {
123 OmniboxResultMojoPtr result(OmniboxResultMojo::New()); 121 OmniboxResultMojoPtr result(OmniboxResultMojo::New());
124 result->done = controller_->done(); 122 result->done = controller_->done();
125 result->time_since_omnibox_started_ms = 123 result->time_since_omnibox_started_ms =
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 prevent_inline_autocomplete, prefer_keyword, true, true, false, 198 prevent_inline_autocomplete, prefer_keyword, true, true, false,
201 ChromeAutocompleteSchemeClassifier(profile_)); 199 ChromeAutocompleteSchemeClassifier(profile_));
202 controller_->Start(input_); 200 controller_->Start(input_);
203 } 201 }
204 202
205 void OmniboxUIHandler::ResetController() { 203 void OmniboxUIHandler::ResetController() {
206 controller_.reset(new AutocompleteController( 204 controller_.reset(new AutocompleteController(
207 make_scoped_ptr(new ChromeAutocompleteProviderClient(profile_)), this, 205 make_scoped_ptr(new ChromeAutocompleteProviderClient(profile_)), this,
208 AutocompleteClassifier::kDefaultOmniboxProviders)); 206 AutocompleteClassifier::kDefaultOmniboxProviders));
209 } 207 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/omnibox/omnibox_ui_handler.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698