OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_CONTENTS_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_HISTORY_CONTENTS_PROVIDER_H_ |
6 #define CHROME_BROWSER_AUTOCOMPLETE_HISTORY_CONTENTS_PROVIDER_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_HISTORY_CONTENTS_PROVIDER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/browser/autocomplete/history_provider.h" | 9 #include "chrome/browser/autocomplete/history_provider.h" |
10 #include "chrome/browser/history/history.h" | 10 #include "chrome/browser/history/history.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 class HistoryContentsProvider : public HistoryProvider { | 23 class HistoryContentsProvider : public HistoryProvider { |
24 public: | 24 public: |
25 HistoryContentsProvider(ACProviderListener* listener, Profile* profile); | 25 HistoryContentsProvider(ACProviderListener* listener, Profile* profile); |
26 | 26 |
27 // As necessary asks the history service for the relevant results. When | 27 // As necessary asks the history service for the relevant results. When |
28 // done SetResults is invoked. | 28 // done SetResults is invoked. |
29 virtual void Start(const AutocompleteInput& input, | 29 virtual void Start(const AutocompleteInput& input, |
30 bool minimal_changes) OVERRIDE; | 30 bool minimal_changes) OVERRIDE; |
31 virtual void Stop() OVERRIDE; | 31 virtual void Stop() OVERRIDE; |
32 | 32 |
33 // Returns the total number of matches available in the database, up to | |
34 // kMaxMatchCount, whichever is smaller. | |
35 // Return value is incomplete if done() returns false. | |
36 size_t db_match_count() const { return results_.size(); } | |
37 | |
38 // The maximum match count we'll report. If the db_match_count is greater | |
39 // than this, it will be clamped to this result. | |
40 static const size_t kMaxMatchCount = 50; | |
41 | |
42 private: | 33 private: |
43 ~HistoryContentsProvider(); | 34 ~HistoryContentsProvider(); |
44 | 35 |
45 void QueryComplete(HistoryService::Handle handle, | 36 void QueryComplete(HistoryService::Handle handle, |
46 history::QueryResults* results); | 37 history::QueryResults* results); |
47 | 38 |
48 // Converts each MatchingPageResult in results_ to an AutocompleteMatch and | 39 // Converts each MatchingPageResult in results_ to an AutocompleteMatch and |
49 // adds it to matches_. | 40 // adds it to matches_. |
50 void ConvertResults(); | 41 void ConvertResults(); |
51 | 42 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 // Whether results_ is valid (so we can tell invalid apart from empty). | 83 // Whether results_ is valid (so we can tell invalid apart from empty). |
93 bool have_results_; | 84 bool have_results_; |
94 | 85 |
95 // Current query string. | 86 // Current query string. |
96 std::wstring query_; | 87 std::wstring query_; |
97 | 88 |
98 DISALLOW_COPY_AND_ASSIGN(HistoryContentsProvider); | 89 DISALLOW_COPY_AND_ASSIGN(HistoryContentsProvider); |
99 }; | 90 }; |
100 | 91 |
101 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_CONTENTS_PROVIDER_H_ | 92 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_CONTENTS_PROVIDER_H_ |
OLD | NEW |