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

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

Issue 1855423003: Interpret '?' and Ctrl-K or Ctrl-E as putting omnibox in keyword search mode for Default Search Pro… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add includes for mac tests 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 (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 "components/omnibox/browser/bookmark_provider.h" 5 #include "components/omnibox/browser/bookmark_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 client_(client), 59 client_(client),
60 bookmark_model_(client ? client_->GetBookmarkModel() : nullptr) {} 60 bookmark_model_(client ? client_->GetBookmarkModel() : nullptr) {}
61 61
62 void BookmarkProvider::Start(const AutocompleteInput& input, 62 void BookmarkProvider::Start(const AutocompleteInput& input,
63 bool minimal_changes) { 63 bool minimal_changes) {
64 TRACE_EVENT0("omnibox", "BookmarkProvider::Start"); 64 TRACE_EVENT0("omnibox", "BookmarkProvider::Start");
65 if (minimal_changes) 65 if (minimal_changes)
66 return; 66 return;
67 matches_.clear(); 67 matches_.clear();
68 68
69 if (input.from_omnibox_focus() || input.text().empty() || 69 if (input.from_omnibox_focus() || input.text().empty())
70 (input.type() == metrics::OmniboxInputType::FORCED_QUERY))
71 return; 70 return;
72 71
73 DoAutocomplete(input); 72 DoAutocomplete(input);
74 } 73 }
75 74
76 BookmarkProvider::~BookmarkProvider() {} 75 BookmarkProvider::~BookmarkProvider() {}
77 76
78 void BookmarkProvider::DoAutocomplete(const AutocompleteInput& input) { 77 void BookmarkProvider::DoAutocomplete(const AutocompleteInput& input) {
79 // We may not have a bookmark model for some unit tests. 78 // We may not have a bookmark model for some unit tests.
80 if (!bookmark_model_) 79 if (!bookmark_model_)
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 i != positions.end(); 333 i != positions.end();
335 ++i) { 334 ++i) {
336 AutocompleteMatch::ACMatchClassifications new_class; 335 AutocompleteMatch::ACMatchClassifications new_class;
337 AutocompleteMatch::ClassifyLocationInString(i->first, i->second - i->first, 336 AutocompleteMatch::ClassifyLocationInString(i->first, i->second - i->first,
338 text_length, url_style, &new_class); 337 text_length, url_style, &new_class);
339 classifications = AutocompleteMatch::MergeClassifications( 338 classifications = AutocompleteMatch::MergeClassifications(
340 classifications, new_class); 339 classifications, new_class);
341 } 340 }
342 return classifications; 341 return classifications;
343 } 342 }
OLDNEW
« no previous file with comments | « components/omnibox/browser/base_search_provider.cc ('k') | components/omnibox/browser/builtin_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698