OLD | NEW |
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 "base/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/browser_about_handler.h" | 9 #include "chrome/browser/browser_about_handler.h" |
10 #include "chrome/browser/net/url_fixer_upper.h" | 10 #include "chrome/browser/net/url_fixer_upper.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 void BuiltinProvider::Start(const AutocompleteInput& input, | 49 void BuiltinProvider::Start(const AutocompleteInput& input, |
50 bool minimal_changes) { | 50 bool minimal_changes) { |
51 matches_.clear(); | 51 matches_.clear(); |
52 if ((input.type() == AutocompleteInput::INVALID) || | 52 if ((input.type() == AutocompleteInput::INVALID) || |
53 (input.type() == AutocompleteInput::FORCED_QUERY) || | 53 (input.type() == AutocompleteInput::FORCED_QUERY) || |
54 (input.type() == AutocompleteInput::QUERY) || | 54 (input.type() == AutocompleteInput::QUERY) || |
55 (input.matches_requested() == AutocompleteInput::BEST_MATCH)) | 55 (input.matches_requested() == AutocompleteInput::BEST_MATCH)) |
56 return; | 56 return; |
57 | 57 |
58 const string16 kAbout = ASCIIToUTF16(chrome::kAboutScheme) + | 58 const string16 kAbout = ASCIIToUTF16(chrome::kAboutScheme) + |
59 ASCIIToUTF16(chrome::kStandardSchemeSeparator); | 59 ASCIIToUTF16(content::kStandardSchemeSeparator); |
60 const string16 kChrome = ASCIIToUTF16(chrome::kChromeUIScheme) + | 60 const string16 kChrome = ASCIIToUTF16(chrome::kChromeUIScheme) + |
61 ASCIIToUTF16(chrome::kStandardSchemeSeparator); | 61 ASCIIToUTF16(content::kStandardSchemeSeparator); |
62 | 62 |
63 const int kUrl = ACMatchClassification::URL; | 63 const int kUrl = ACMatchClassification::URL; |
64 const int kMatch = kUrl | ACMatchClassification::MATCH; | 64 const int kMatch = kUrl | ACMatchClassification::MATCH; |
65 | 65 |
66 string16 text = input.text(); | 66 string16 text = input.text(); |
67 bool starting_chrome = StartsWith(kChrome, text, false); | 67 bool starting_chrome = StartsWith(kChrome, text, false); |
68 if (starting_chrome || StartsWith(kAbout, text, false)) { | 68 if (starting_chrome || StartsWith(kAbout, text, false)) { |
69 ACMatchClassifications styles; | 69 ACMatchClassifications styles; |
70 // Highlight the input portion matching "chrome://"; or if the user has | 70 // Highlight the input portion matching "chrome://"; or if the user has |
71 // input "about:" (with optional slashes), highlight the whole "chrome://". | 71 // input "about:" (with optional slashes), highlight the whole "chrome://". |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 void BuiltinProvider::AddMatch(const string16& match_string, | 111 void BuiltinProvider::AddMatch(const string16& match_string, |
112 const ACMatchClassifications& styles) { | 112 const ACMatchClassifications& styles) { |
113 AutocompleteMatch match(this, kRelevance, false, | 113 AutocompleteMatch match(this, kRelevance, false, |
114 AutocompleteMatch::NAVSUGGEST); | 114 AutocompleteMatch::NAVSUGGEST); |
115 match.fill_into_edit = match_string; | 115 match.fill_into_edit = match_string; |
116 match.destination_url = GURL(match_string); | 116 match.destination_url = GURL(match_string); |
117 match.contents = match_string; | 117 match.contents = match_string; |
118 match.contents_class = styles; | 118 match.contents_class = styles; |
119 matches_.push_back(match); | 119 matches_.push_back(match); |
120 } | 120 } |
OLD | NEW |