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

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

Issue 1568073002: Reduce string copies in GURL creation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 (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 <stddef.h> 7 #include <stddef.h>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 } 144 }
145 result->results_by_provider = 145 result->results_by_provider =
146 mojo::Array<AutocompleteResultsForProviderMojoPtr>::From( 146 mojo::Array<AutocompleteResultsForProviderMojoPtr>::From(
147 controller_->providers()); 147 controller_->providers());
148 148
149 // Fill AutocompleteMatchMojo::starred. 149 // Fill AutocompleteMatchMojo::starred.
150 BookmarkModel* bookmark_model = BookmarkModelFactory::GetForProfile(profile_); 150 BookmarkModel* bookmark_model = BookmarkModelFactory::GetForProfile(profile_);
151 if (bookmark_model) { 151 if (bookmark_model) {
152 for (size_t i = 0; i < result->combined_results.size(); ++i) { 152 for (size_t i = 0; i < result->combined_results.size(); ++i) {
153 result->combined_results[i]->starred = bookmark_model->IsBookmarked( 153 result->combined_results[i]->starred = bookmark_model->IsBookmarked(
154 GURL(result->combined_results[i]->destination_url)); 154 GURL(result->combined_results[i]->destination_url.get()));
155 } 155 }
156 for (size_t i = 0; i < result->results_by_provider.size(); ++i) { 156 for (size_t i = 0; i < result->results_by_provider.size(); ++i) {
157 const AutocompleteResultsForProviderMojo& result_by_provider = 157 const AutocompleteResultsForProviderMojo& result_by_provider =
158 *result->results_by_provider[i]; 158 *result->results_by_provider[i];
159 for (size_t j = 0; j < result_by_provider.results.size(); ++j) { 159 for (size_t j = 0; j < result_by_provider.results.size(); ++j) {
160 result_by_provider.results[j]->starred = bookmark_model->IsBookmarked( 160 result_by_provider.results[j]->starred = bookmark_model->IsBookmarked(
161 GURL(result_by_provider.results[j]->destination_url)); 161 GURL(result_by_provider.results[j]->destination_url.get()));
162 } 162 }
163 } 163 }
164 } 164 }
165 165
166 page_->HandleNewAutocompleteResult(std::move(result)); 166 page_->HandleNewAutocompleteResult(std::move(result));
167 } 167 }
168 168
169 bool OmniboxUIHandler::LookupIsTypedHost(const base::string16& host, 169 bool OmniboxUIHandler::LookupIsTypedHost(const base::string16& host,
170 bool* is_typed_host) const { 170 bool* is_typed_host) const {
171 history::HistoryService* const history_service = 171 history::HistoryService* const history_service =
(...skipping 29 matching lines...) Expand all
201 prevent_inline_autocomplete, prefer_keyword, true, true, false, 201 prevent_inline_autocomplete, prefer_keyword, true, true, false,
202 ChromeAutocompleteSchemeClassifier(profile_)); 202 ChromeAutocompleteSchemeClassifier(profile_));
203 controller_->Start(input_); 203 controller_->Start(input_);
204 } 204 }
205 205
206 void OmniboxUIHandler::ResetController() { 206 void OmniboxUIHandler::ResetController() {
207 controller_.reset(new AutocompleteController( 207 controller_.reset(new AutocompleteController(
208 make_scoped_ptr(new ChromeAutocompleteProviderClient(profile_)), this, 208 make_scoped_ptr(new ChromeAutocompleteProviderClient(profile_)), this,
209 AutocompleteClassifier::kDefaultOmniboxProviders)); 209 AutocompleteClassifier::kDefaultOmniboxProviders));
210 } 210 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/engagement/site_engagement_ui.cc ('k') | chrome/renderer/chrome_content_renderer_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698