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

Side by Side Diff: chrome/browser/ui/omnibox/omnibox_controller.cc

Issue 17426004: Minor cosmetic changes to OmniboxEditModel and OmniboxController. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Answered Peter Created 7 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 | Annotate | Revision Log
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 "chrome/browser/ui/omnibox/omnibox_controller.h" 5 #include "chrome/browser/ui/omnibox/omnibox_controller.h"
6 6
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "chrome/browser/autocomplete/autocomplete_classifier.h" 8 #include "chrome/browser/autocomplete/autocomplete_classifier.h"
9 #include "chrome/browser/autocomplete/autocomplete_match.h" 9 #include "chrome/browser/autocomplete/autocomplete_match.h"
10 #include "chrome/browser/autocomplete/search_provider.h" 10 #include "chrome/browser/autocomplete/search_provider.h"
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 omnibox_edit_model_->OnCurrentMatchChanged(true); 246 omnibox_edit_model_->OnCurrentMatchChanged(true);
247 return; 247 return;
248 } 248 }
249 #endif 249 #endif
250 } 250 }
251 251
252 void OmniboxController::InvalidateCurrentMatch() { 252 void OmniboxController::InvalidateCurrentMatch() {
253 current_match_ = AutocompleteMatch(); 253 current_match_ = AutocompleteMatch();
254 } 254 }
255 255
256 const AutocompleteMatch& OmniboxController::CurrentMatch(
257 GURL* alternate_nav_url) const {
258 if (alternate_nav_url && current_match_.destination_url.is_valid()) {
259 *alternate_nav_url = AutocompleteResult::ComputeAlternateNavUrl(
260 autocomplete_controller_->input(), current_match_);
261 }
262
263 return current_match_;
264 }
265
266
267 void OmniboxController::ClearPopupKeywordMode() const { 256 void OmniboxController::ClearPopupKeywordMode() const {
268 if (popup_->IsOpen() && 257 if (popup_->IsOpen() &&
269 popup_->selected_line_state() == OmniboxPopupModel::KEYWORD) 258 popup_->selected_line_state() == OmniboxPopupModel::KEYWORD)
270 popup_->SetSelectedLineState(OmniboxPopupModel::NORMAL); 259 popup_->SetSelectedLineState(OmniboxPopupModel::NORMAL);
271 } 260 }
272 261
273 void OmniboxController::DoPreconnect(const AutocompleteMatch& match) { 262 void OmniboxController::DoPreconnect(const AutocompleteMatch& match) {
274 if (!match.destination_url.SchemeIs(extensions::kExtensionScheme)) { 263 if (!match.destination_url.SchemeIs(extensions::kExtensionScheme)) {
275 // Warm up DNS Prefetch cache, or preconnect to a search service. 264 // Warm up DNS Prefetch cache, or preconnect to a search service.
276 UMA_HISTOGRAM_ENUMERATION("Autocomplete.MatchType", match.type, 265 UMA_HISTOGRAM_ENUMERATION("Autocomplete.MatchType", match.type,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 string16 input_text, 310 string16 input_text,
322 AutocompleteMatchType::Type match_type) { 311 AutocompleteMatchType::Type match_type) {
323 string16 keyword = GetDefaultSearchProviderKeyword(profile_); 312 string16 keyword = GetDefaultSearchProviderKeyword(profile_);
324 if (keyword.empty()) 313 if (keyword.empty())
325 return; // CreateSearchSuggestion needs a keyword. 314 return; // CreateSearchSuggestion needs a keyword.
326 315
327 current_match_ = SearchProvider::CreateSearchSuggestion( 316 current_match_ = SearchProvider::CreateSearchSuggestion(
328 profile_, NULL, AutocompleteInput(), query_string, input_text, 0, 317 profile_, NULL, AutocompleteInput(), query_string, input_text, 0,
329 match_type, 0, false, keyword, -1); 318 match_type, 0, false, keyword, -1);
330 } 319 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/omnibox/omnibox_controller.h ('k') | chrome/browser/ui/omnibox/omnibox_edit_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698