| 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 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_PROVIDER_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_PROVIDER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 11 #include "chrome/browser/autocomplete/autocomplete_match.h" | 11 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| 12 #include "components/metrics/proto/omnibox_event.pb.h" | 12 #include "components/metrics/proto/omnibox_event.pb.h" |
| 13 | 13 |
| 14 class AutocompleteInput; | 14 class AutocompleteInput; |
| 15 class BookmarkModel; | |
| 16 | 15 |
| 17 typedef std::vector<metrics::OmniboxEventProto_ProviderInfo> ProvidersInfo; | 16 typedef std::vector<metrics::OmniboxEventProto_ProviderInfo> ProvidersInfo; |
| 18 | 17 |
| 19 // The AutocompleteProviders each return different kinds of matches, | 18 // The AutocompleteProviders each return different kinds of matches, |
| 20 // such as history or search matches. These matches are given | 19 // such as history or search matches. These matches are given |
| 21 // "relevance" scores. Higher scores are better matches than lower | 20 // "relevance" scores. Higher scores are better matches than lower |
| 22 // scores. The relevance scores and classes providing the respective | 21 // scores. The relevance scores and classes providing the respective |
| 23 // matches are as listed below. | 22 // matches are as listed below. |
| 24 // | 23 // |
| 25 // IMPORTANT CAVEAT: The tables below are NOT COMPLETE. Developers | 24 // IMPORTANT CAVEAT: The tables below are NOT COMPLETE. Developers |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 static const size_t kMaxMatches; | 207 static const size_t kMaxMatches; |
| 209 | 208 |
| 210 protected: | 209 protected: |
| 211 friend class base::RefCountedThreadSafe<AutocompleteProvider>; | 210 friend class base::RefCountedThreadSafe<AutocompleteProvider>; |
| 212 FRIEND_TEST_ALL_PREFIXES(BookmarkProviderTest, InlineAutocompletion); | 211 FRIEND_TEST_ALL_PREFIXES(BookmarkProviderTest, InlineAutocompletion); |
| 213 | 212 |
| 214 typedef std::pair<bool, base::string16> FixupReturn; | 213 typedef std::pair<bool, base::string16> FixupReturn; |
| 215 | 214 |
| 216 virtual ~AutocompleteProvider(); | 215 virtual ~AutocompleteProvider(); |
| 217 | 216 |
| 218 // Updates the starred state of each of the matches in matches_ from the | |
| 219 // bookmark bar model. Does nothing when |bookmark_model| is NULL. | |
| 220 void UpdateStarredStateOfMatches(BookmarkModel* bookmark_model); | |
| 221 | |
| 222 // Fixes up user URL input to make it more possible to match against. Among | 217 // Fixes up user URL input to make it more possible to match against. Among |
| 223 // many other things, this takes care of the following: | 218 // many other things, this takes care of the following: |
| 224 // * Prepending file:// to file URLs | 219 // * Prepending file:// to file URLs |
| 225 // * Converting drive letters in file URLs to uppercase | 220 // * Converting drive letters in file URLs to uppercase |
| 226 // * Converting case-insensitive parts of URLs (like the scheme and domain) | 221 // * Converting case-insensitive parts of URLs (like the scheme and domain) |
| 227 // to lowercase | 222 // to lowercase |
| 228 // * Convert spaces to %20s | 223 // * Convert spaces to %20s |
| 229 // Note that we don't do this in AutocompleteInput's constructor, because if | 224 // Note that we don't do this in AutocompleteInput's constructor, because if |
| 230 // e.g. we convert a Unicode hostname to punycode, other providers will show | 225 // e.g. we convert a Unicode hostname to punycode, other providers will show |
| 231 // output that surprises the user ("Search Google for xn--6ca.com"). | 226 // output that surprises the user ("Search Google for xn--6ca.com"). |
| (...skipping 12 matching lines...) Expand all Loading... |
| 244 ACMatches matches_; | 239 ACMatches matches_; |
| 245 bool done_; | 240 bool done_; |
| 246 | 241 |
| 247 Type type_; | 242 Type type_; |
| 248 | 243 |
| 249 private: | 244 private: |
| 250 DISALLOW_COPY_AND_ASSIGN(AutocompleteProvider); | 245 DISALLOW_COPY_AND_ASSIGN(AutocompleteProvider); |
| 251 }; | 246 }; |
| 252 | 247 |
| 253 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_PROVIDER_H_ | 248 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_PROVIDER_H_ |
| OLD | NEW |