Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(289)

Side by Side Diff: chrome/browser/autocomplete/history_contents_provider.h

Issue 5774004: Make HistoryContentsProvider results deletable (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Revising a couple checks & DCHECKS Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/autocomplete.h" 9 #include "chrome/browser/autocomplete/autocomplete.h"
10 #include "chrome/browser/history/history.h" 10 #include "chrome/browser/history/history.h"
11 11
12 namespace bookmark_utils { 12 namespace bookmark_utils {
13 struct TitleMatch; 13 struct TitleMatch;
14 } 14 }
15 15
16 // HistoryContentsProvider is an AutocompleteProvider that provides results from 16 // HistoryContentsProvider is an AutocompleteProvider that provides results from
17 // the contents (body and/or title) of previously visited pages. 17 // the contents (body and/or title) of previously visited pages.
18 // HistoryContentsProvider gets results from two sources: 18 // HistoryContentsProvider gets results from two sources:
19 // . HistoryService: this provides results for matches in the body/title of 19 // . HistoryService: this provides results for matches in the body/title of
20 // previously viewed pages. This is asynchronous. 20 // previously viewed pages. This is asynchronous.
21 // . BookmarkModel: provides results for matches in the titles of bookmarks. 21 // . BookmarkModel: provides results for matches in the titles of bookmarks.
22 // This is synchronous. 22 // This is synchronous.
23 class HistoryContentsProvider : public AutocompleteProvider { 23 class HistoryContentsProvider : public AutocompleteProvider {
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); 30 bool minimal_changes) OVERRIDE;
31 31
32 virtual void Stop(); 32 virtual void Stop() OVERRIDE;
33
34 virtual void DeleteMatch(const AutocompleteMatch& match) OVERRIDE;
33 35
34 // Returns the total number of matches available in the database, up to 36 // Returns the total number of matches available in the database, up to
35 // kMaxMatchCount, whichever is smaller. 37 // kMaxMatchCount, whichever is smaller.
36 // Return value is incomplete if done() returns false. 38 // Return value is incomplete if done() returns false.
37 size_t db_match_count() const { return results_.size(); } 39 size_t db_match_count() const { return results_.size(); }
38 40
39 // The maximum match count we'll report. If the db_match_count is greater 41 // The maximum match count we'll report. If the db_match_count is greater
40 // than this, it will be clamped to this result. 42 // than this, it will be clamped to this result.
41 static const size_t kMaxMatchCount = 50; 43 static const size_t kMaxMatchCount = 50;
42 44
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 // Whether results_ is valid (so we can tell invalid apart from empty). 95 // Whether results_ is valid (so we can tell invalid apart from empty).
94 bool have_results_; 96 bool have_results_;
95 97
96 // Current query string. 98 // Current query string.
97 std::wstring query_; 99 std::wstring query_;
98 100
99 DISALLOW_COPY_AND_ASSIGN(HistoryContentsProvider); 101 DISALLOW_COPY_AND_ASSIGN(HistoryContentsProvider);
100 }; 102 };
101 103
102 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_CONTENTS_PROVIDER_H_ 104 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_CONTENTS_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698