diff options
author | mrossetti@chromium.org <mrossetti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-12 17:31:23 +0000 |
---|---|---|
committer | mrossetti@chromium.org <mrossetti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-12 17:31:23 +0000 |
commit | 497606bc48a31173166147910fdd225533aeca60 (patch) | |
tree | 543f2a9c9a918f7330588c27afe8fec263706113 /chrome/browser/autocomplete/history_url_provider.h | |
parent | b6842d34c371f7ff7d8e6d033524903ea7f64dc8 (diff) | |
download | chromium_src-497606bc48a31173166147910fdd225533aeca60.zip chromium_src-497606bc48a31173166147910fdd225533aeca60.tar.gz chromium_src-497606bc48a31173166147910fdd225533aeca60.tar.bz2 |
Final phase of the URL History Quick autocomplete provider integration. This phase hooks up the InMemoryURLIndex to the HistoryQuickProvider which is itself made active during the autocomplete process. A small amount of refactoring was done to liberate some common functionality from the history_url_provider.
Previous CL: http://codereview.chromium.org/3375002
BUG=23654,19736
TEST=Green bots. Start typing text which occurs in URLs which are in the history. Verify that those history items appear if they have been manually typed more than once or the have been visited more than three time or they have been visited within the last three days.
Review URL: http://codereview.chromium.org/3713003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62298 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete/history_url_provider.h')
-rw-r--r-- | chrome/browser/autocomplete/history_url_provider.h | 41 |
1 files changed, 9 insertions, 32 deletions
diff --git a/chrome/browser/autocomplete/history_url_provider.h b/chrome/browser/autocomplete/history_url_provider.h index 1a6c6f0..16b0346 100644 --- a/chrome/browser/autocomplete/history_url_provider.h +++ b/chrome/browser/autocomplete/history_url_provider.h @@ -6,7 +6,9 @@ #define CHROME_BROWSER_AUTOCOMPLETE_HISTORY_URL_PROVIDER_H_ #pragma once -#include "chrome/browser/autocomplete/autocomplete.h" +#include <string> + +#include "chrome/browser/autocomplete/history_provider.h" #include "chrome/browser/autocomplete/history_provider_util.h" class MessageLoop; @@ -83,7 +85,7 @@ class URLRow; struct HistoryURLProviderParams { HistoryURLProviderParams(const AutocompleteInput& input, bool trim_http, - const std::wstring& languages); + const std::string& languages); MessageLoop* message_loop; @@ -115,7 +117,7 @@ struct HistoryURLProviderParams { ACMatches matches; // Languages we should pass to gfx::GetCleanStringFromUrl. - std::wstring languages; + std::string languages; private: DISALLOW_COPY_AND_ASSIGN(HistoryURLProviderParams); @@ -131,15 +133,15 @@ struct HistoryURLProviderParams { // completes before the history thread, the message to delegate back to the // main thread will not run and the reference will leak. Therefore, don't do // anything on destruction. -class HistoryURLProvider : public AutocompleteProvider { +class HistoryURLProvider : public HistoryProvider { public: HistoryURLProvider(ACProviderListener* listener, Profile* profile); #ifdef UNIT_TEST HistoryURLProvider(ACProviderListener* listener, Profile* profile, - const std::wstring& languages) - : AutocompleteProvider(listener, profile, "History"), + const std::string& languages) + : HistoryProvider(listener, profile, "History"), prefixes_(GetPrefixes()), params_(NULL), languages_(languages) {} @@ -174,31 +176,6 @@ class HistoryURLProvider : public AutocompleteProvider { private: ~HistoryURLProvider() {} - - enum MatchType { - NORMAL, - WHAT_YOU_TYPED, - INLINE_AUTOCOMPLETE - }; - - // Fixes up user URL input to make it more possible to match against. Among - // many other things, this takes care of the following: - // * Prepending file:// to file URLs - // * Converting drive letters in file URLs to uppercase - // * Converting case-insensitive parts of URLs (like the scheme and domain) - // to lowercase - // * Convert spaces to %20s - // Note that we don't do this in AutocompleteInput's constructor, because if - // e.g. we convert a Unicode hostname to punycode, other providers will show - // output that surprises the user ("Search Google for xn--6ca.com"). - static std::wstring FixupUserInput(const AutocompleteInput& input); - - // Trims "http:" and up to two subsequent slashes from |url|. Returns the - // number of characters that were trimmed. - // NOTE: For a view-source: URL, this will trim from after "view-source:" and - // return 0. - static size_t TrimHttpPrefix(std::wstring* url); - // Returns the set of prefixes to use for prefixes_. static history::Prefixes GetPrefixes(); @@ -320,7 +297,7 @@ class HistoryURLProvider : public AutocompleteProvider { // Only used by unittests; if non-empty, overrides accept-languages in the // profile's pref system. - std::wstring languages_; + std::string languages_; }; #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_URL_PROVIDER_H_ |