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_HISTORY_QUICK_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_HISTORY_QUICK_PROVIDER_H_ |
6 #define CHROME_BROWSER_AUTOCOMPLETE_HISTORY_QUICK_PROVIDER_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_HISTORY_QUICK_PROVIDER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "chrome/browser/autocomplete/history_provider.h" | 12 #include "chrome/browser/autocomplete/history_provider.h" |
13 #include "chrome/browser/history/in_memory_url_index.h" | 13 #include "chrome/browser/history/in_memory_url_index.h" |
14 #include "components/history/core/browser/history_types.h" | 14 #include "components/history/core/browser/history_types.h" |
15 #include "components/omnibox/autocomplete_input.h" | 15 #include "components/omnibox/autocomplete_input.h" |
16 #include "components/omnibox/autocomplete_match.h" | 16 #include "components/omnibox/autocomplete_match.h" |
17 | 17 |
18 class Profile; | 18 class Profile; |
19 | 19 |
20 namespace history { | 20 namespace history { |
21 class ScoredHistoryMatch; | 21 class ScoredHistoryMatch; |
| 22 class ScoredHistoryMatchClient; |
22 } // namespace history | 23 } // namespace history |
23 | 24 |
24 // This class is an autocomplete provider (a pseudo-internal component of | 25 // This class is an autocomplete provider (a pseudo-internal component of |
25 // the history system) which quickly (and synchronously) provides matching | 26 // the history system) which quickly (and synchronously) provides matching |
26 // results from recently or frequently visited sites in the profile's | 27 // results from recently or frequently visited sites in the profile's |
27 // history. | 28 // history. |
28 class HistoryQuickProvider : public HistoryProvider { | 29 class HistoryQuickProvider : public HistoryProvider { |
29 public: | 30 public: |
30 explicit HistoryQuickProvider(Profile* profile); | 31 explicit HistoryQuickProvider(Profile* profile); |
31 | 32 |
(...skipping 27 matching lines...) Expand all Loading... |
59 int score); | 60 int score); |
60 | 61 |
61 // Returns the index that should be used for history lookups. | 62 // Returns the index that should be used for history lookups. |
62 history::InMemoryURLIndex* GetIndex(); | 63 history::InMemoryURLIndex* GetIndex(); |
63 | 64 |
64 // Only for use in unittests. Takes ownership of |index|. | 65 // Only for use in unittests. Takes ownership of |index|. |
65 void set_index(history::InMemoryURLIndex* index) { | 66 void set_index(history::InMemoryURLIndex* index) { |
66 index_for_testing_.reset(index); | 67 index_for_testing_.reset(index); |
67 } | 68 } |
68 | 69 |
| 70 // Returns the ScoredHistoryMatchClient, lazily constructing it if necessary. |
| 71 const history::ScoredHistoryMatchClient* GetScoredHistoryMatchClient(); |
| 72 |
69 AutocompleteInput autocomplete_input_; | 73 AutocompleteInput autocomplete_input_; |
70 std::string languages_; | 74 std::string languages_; |
71 | 75 |
| 76 // Used for computing ScoredHistoryMatches. |
| 77 scoped_ptr<history::ScoredHistoryMatchClient> scored_history_match_client_; |
| 78 |
72 // Only used for testing. | 79 // Only used for testing. |
73 scoped_ptr<history::InMemoryURLIndex> index_for_testing_; | 80 scoped_ptr<history::InMemoryURLIndex> index_for_testing_; |
74 | 81 |
75 // This provider is disabled when true. | 82 // This provider is disabled when true. |
76 static bool disabled_; | 83 static bool disabled_; |
77 | 84 |
78 DISALLOW_COPY_AND_ASSIGN(HistoryQuickProvider); | 85 DISALLOW_COPY_AND_ASSIGN(HistoryQuickProvider); |
79 }; | 86 }; |
80 | 87 |
81 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_QUICK_PROVIDER_H_ | 88 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_QUICK_PROVIDER_H_ |
OLD | NEW |