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

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

Issue 319523005: Omnibox: Combine Two Input Type Enums into One (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 6 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 (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"
11 #include "chrome/browser/autocomplete/autocomplete_input.h" 11 #include "chrome/browser/autocomplete/autocomplete_input.h"
12 #include "chrome/browser/autocomplete/history_provider.h" 12 #include "chrome/browser/autocomplete/history_provider.h"
13 #include "chrome/common/net/url_fixer_upper.h" 13 #include "chrome/common/net/url_fixer_upper.h"
14 #include "chrome/common/url_constants.h" 14 #include "chrome/common/url_constants.h"
15 #include "components/metrics/proto/omnibox_input_type.pb.h"
15 16
16 namespace { 17 namespace {
17 18
18 #if !defined(OS_ANDROID) 19 #if !defined(OS_ANDROID)
19 // This list should be kept in sync with chrome/common/url_constants.h. 20 // This list should be kept in sync with chrome/common/url_constants.h.
20 // Only include useful sub-pages, confirmation alerts are not useful. 21 // Only include useful sub-pages, confirmation alerts are not useful.
21 const char* const kChromeSettingsSubPages[] = { 22 const char* const kChromeSettingsSubPages[] = {
22 chrome::kAutofillSubPage, 23 chrome::kAutofillSubPage,
23 chrome::kClearBrowserDataSubPage, 24 chrome::kClearBrowserDataSubPage,
24 chrome::kContentSettingsSubPage, 25 chrome::kContentSettingsSubPage,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 for (size_t i = 0; i < arraysize(kChromeSettingsSubPages); i++) { 58 for (size_t i = 0; i < arraysize(kChromeSettingsSubPages); i++) {
58 builtins_.push_back( 59 builtins_.push_back(
59 settings + base::ASCIIToUTF16(kChromeSettingsSubPages[i])); 60 settings + base::ASCIIToUTF16(kChromeSettingsSubPages[i]));
60 } 61 }
61 #endif 62 #endif
62 } 63 }
63 64
64 void BuiltinProvider::Start(const AutocompleteInput& input, 65 void BuiltinProvider::Start(const AutocompleteInput& input,
65 bool minimal_changes) { 66 bool minimal_changes) {
66 matches_.clear(); 67 matches_.clear();
67 if ((input.type() == AutocompleteInput::INVALID) || 68 if ((input.type() == metrics::OmniboxInputType::INVALID) ||
68 (input.type() == AutocompleteInput::FORCED_QUERY) || 69 (input.type() == metrics::OmniboxInputType::FORCED_QUERY) ||
69 (input.type() == AutocompleteInput::QUERY)) 70 (input.type() == metrics::OmniboxInputType::QUERY))
70 return; 71 return;
71 72
72 const size_t kAboutSchemeLength = strlen(content::kAboutScheme); 73 const size_t kAboutSchemeLength = strlen(content::kAboutScheme);
73 const base::string16 kAbout = base::ASCIIToUTF16(content::kAboutScheme) + 74 const base::string16 kAbout = base::ASCIIToUTF16(content::kAboutScheme) +
74 base::ASCIIToUTF16(url::kStandardSchemeSeparator); 75 base::ASCIIToUTF16(url::kStandardSchemeSeparator);
75 const base::string16 kChrome = base::ASCIIToUTF16(content::kChromeUIScheme) + 76 const base::string16 kChrome = base::ASCIIToUTF16(content::kChromeUIScheme) +
76 base::ASCIIToUTF16(url::kStandardSchemeSeparator); 77 base::ASCIIToUTF16(url::kStandardSchemeSeparator);
77 78
78 const int kUrl = ACMatchClassification::URL; 79 const int kUrl = ACMatchClassification::URL;
79 const int kMatch = kUrl | ACMatchClassification::MATCH; 80 const int kMatch = kUrl | ACMatchClassification::MATCH;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 const ACMatchClassifications& styles) { 161 const ACMatchClassifications& styles) {
161 AutocompleteMatch match(this, kRelevance, false, 162 AutocompleteMatch match(this, kRelevance, false,
162 AutocompleteMatchType::NAVSUGGEST); 163 AutocompleteMatchType::NAVSUGGEST);
163 match.fill_into_edit = match_string; 164 match.fill_into_edit = match_string;
164 match.inline_autocompletion = inline_completion; 165 match.inline_autocompletion = inline_completion;
165 match.destination_url = GURL(match_string); 166 match.destination_url = GURL(match_string);
166 match.contents = match_string; 167 match.contents = match_string;
167 match.contents_class = styles; 168 match.contents_class = styles;
168 matches_.push_back(match); 169 matches_.push_back(match);
169 } 170 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/bookmark_provider.cc ('k') | chrome/browser/autocomplete/extension_app_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698