| 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 <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 Loading... |
| 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 on_focus) { |
| 65 matches_.clear(); | 66 matches_.clear(); |
| 66 if ((input.type() == metrics::OmniboxInputType::INVALID) || | 67 if (on_focus || (input.type() == metrics::OmniboxInputType::INVALID) || |
| 67 (input.type() == metrics::OmniboxInputType::FORCED_QUERY) || | 68 (input.type() == metrics::OmniboxInputType::FORCED_QUERY) || |
| 68 (input.type() == metrics::OmniboxInputType::QUERY)) | 69 (input.type() == metrics::OmniboxInputType::QUERY)) |
| 69 return; | 70 return; |
| 70 | 71 |
| 71 const size_t kAboutSchemeLength = strlen(url::kAboutScheme); | 72 const size_t kAboutSchemeLength = strlen(url::kAboutScheme); |
| 72 const base::string16 kAbout = | 73 const base::string16 kAbout = |
| 73 base::ASCIIToUTF16(url::kAboutScheme) + | 74 base::ASCIIToUTF16(url::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); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } |
| OLD | NEW |