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

Side by Side Diff: chrome/browser/autocomplete/builtin_provider.cc

Issue 836213002: Assume all providers may give zero suggest responses. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation issue in athena Created 5 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/autocomplete/builtin_provider.h" 5 #include "chrome/browser/autocomplete/builtin_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 base::string16 settings(base::ASCIIToUTF16(chrome::kChromeUISettingsHost) + 54 base::string16 settings(base::ASCIIToUTF16(chrome::kChromeUISettingsHost) +
55 base::ASCIIToUTF16("/")); 55 base::ASCIIToUTF16("/"));
56 for (size_t i = 0; i < arraysize(kChromeSettingsSubPages); i++) { 56 for (size_t i = 0; i < arraysize(kChromeSettingsSubPages); i++) {
57 builtins_.push_back( 57 builtins_.push_back(
58 settings + base::ASCIIToUTF16(kChromeSettingsSubPages[i])); 58 settings + base::ASCIIToUTF16(kChromeSettingsSubPages[i]));
59 } 59 }
60 #endif 60 #endif
61 } 61 }
62 62
63 void BuiltinProvider::Start(const AutocompleteInput& input, 63 void BuiltinProvider::Start(const AutocompleteInput& input,
64 bool minimal_changes) { 64 bool minimal_changes,
65 bool called_due_to_focus) {
65 matches_.clear(); 66 matches_.clear();
66 if ((input.type() == metrics::OmniboxInputType::INVALID) || 67 if (called_due_to_focus ||
68 (input.type() == metrics::OmniboxInputType::INVALID) ||
67 (input.type() == metrics::OmniboxInputType::FORCED_QUERY) || 69 (input.type() == metrics::OmniboxInputType::FORCED_QUERY) ||
68 (input.type() == metrics::OmniboxInputType::QUERY)) 70 (input.type() == metrics::OmniboxInputType::QUERY))
69 return; 71 return;
70 72
71 const size_t kAboutSchemeLength = strlen(url::kAboutScheme); 73 const size_t kAboutSchemeLength = strlen(url::kAboutScheme);
72 const base::string16 kAbout = 74 const base::string16 kAbout =
73 base::ASCIIToUTF16(url::kAboutScheme) + 75 base::ASCIIToUTF16(url::kAboutScheme) +
74 base::ASCIIToUTF16(url::kStandardSchemeSeparator); 76 base::ASCIIToUTF16(url::kStandardSchemeSeparator);
75 const base::string16 kChrome = base::ASCIIToUTF16(content::kChromeUIScheme) + 77 const base::string16 kChrome = base::ASCIIToUTF16(content::kChromeUIScheme) +
76 base::ASCIIToUTF16(url::kStandardSchemeSeparator); 78 base::ASCIIToUTF16(url::kStandardSchemeSeparator);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 const ACMatchClassifications& styles) { 162 const ACMatchClassifications& styles) {
161 AutocompleteMatch match(this, kRelevance, false, 163 AutocompleteMatch match(this, kRelevance, false,
162 AutocompleteMatchType::NAVSUGGEST); 164 AutocompleteMatchType::NAVSUGGEST);
163 match.fill_into_edit = match_string; 165 match.fill_into_edit = match_string;
164 match.inline_autocompletion = inline_completion; 166 match.inline_autocompletion = inline_completion;
165 match.destination_url = GURL(match_string); 167 match.destination_url = GURL(match_string);
166 match.contents = match_string; 168 match.contents = match_string;
167 match.contents_class = styles; 169 match.contents_class = styles;
168 matches_.push_back(match); 170 matches_.push_back(match);
169 } 171 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/builtin_provider.h ('k') | chrome/browser/autocomplete/builtin_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698