| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/autocomplete/autocomplete_match.h" | 9 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| 10 #include "chrome/browser/browser_about_handler.h" | 10 #include "chrome/browser/browser_about_handler.h" |
| 11 #include "chrome/browser/net/url_fixer_upper.h" | 11 #include "chrome/browser/net/url_fixer_upper.h" |
| 12 | 12 |
| 13 const int BuiltinProvider::kRelevance = 575; | 13 const int BuiltinProvider::kRelevance = 575; |
| 14 | 14 |
| 15 BuiltinProvider::BuiltinProvider(ACProviderListener* listener, | 15 BuiltinProvider::BuiltinProvider(ACProviderListener* listener, |
| 16 Profile* profile) | 16 Profile* profile) |
| 17 : AutocompleteProvider(listener, profile, "Builtin") { | 17 : AutocompleteProvider(listener, profile, "Builtin") { |
| 18 std::vector<std::string> builtins(ChromePaths()); | 18 std::vector<std::string> builtins(AboutPaths()); |
| 19 for (std::vector<std::string>::iterator i(builtins.begin()); | 19 for (std::vector<std::string>::iterator i(builtins.begin()); |
| 20 i != builtins.end(); ++i) | 20 i != builtins.end(); ++i) |
| 21 builtins_.push_back(ASCIIToUTF16("about:") + ASCIIToUTF16(*i)); | 21 builtins_.push_back(ASCIIToUTF16("about:") + ASCIIToUTF16(*i)); |
| 22 } | 22 } |
| 23 | 23 |
| 24 BuiltinProvider::~BuiltinProvider() {} | 24 BuiltinProvider::~BuiltinProvider() {} |
| 25 | 25 |
| 26 void BuiltinProvider::Start(const AutocompleteInput& input, | 26 void BuiltinProvider::Start(const AutocompleteInput& input, |
| 27 bool minimal_changes) { | 27 bool minimal_changes) { |
| 28 matches_.clear(); | 28 matches_.clear(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 45 match.contents_class.push_back( | 45 match.contents_class.push_back( |
| 46 ACMatchClassification(input.text().length(), | 46 ACMatchClassification(input.text().length(), |
| 47 ACMatchClassification::URL)); | 47 ACMatchClassification::URL)); |
| 48 } | 48 } |
| 49 matches_.push_back(match); | 49 matches_.push_back(match); |
| 50 } | 50 } |
| 51 } | 51 } |
| 52 for (size_t i = 0; i < matches_.size(); ++i) | 52 for (size_t i = 0; i < matches_.size(); ++i) |
| 53 matches_[i].relevance = kRelevance + matches_.size() - (i + 1); | 53 matches_[i].relevance = kRelevance + matches_.size() - (i + 1); |
| 54 } | 54 } |
| OLD | NEW |