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

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

Issue 10071036: RefCounted types should not have public destructors, chrome/browser/ part 6 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Implementation fixes Created 8 years, 8 months 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) 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 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "chrome/browser/autocomplete/autocomplete_match.h" 11 #include "chrome/browser/autocomplete/autocomplete_match.h"
12 #include "chrome/browser/autocomplete/history_provider.h" 12 #include "chrome/browser/autocomplete/history_provider.h"
13 #include "chrome/browser/history/history_types.h" 13 #include "chrome/browser/history/history_types.h"
14 #include "chrome/browser/history/in_memory_url_index.h" 14 #include "chrome/browser/history/in_memory_url_index.h"
15 15
16 class Profile; 16 class Profile;
17 class TermMatches; 17 class TermMatches;
18 18
19 // This class is an autocomplete provider (a pseudo-internal component of 19 // This class is an autocomplete provider (a pseudo-internal component of
20 // the history system) which quickly (and synchronously) provides matching 20 // the history system) which quickly (and synchronously) provides matching
21 // results from recently or frequently visited sites in the profile's 21 // results from recently or frequently visited sites in the profile's
22 // history. 22 // history.
23 class HistoryQuickProvider : public HistoryProvider { 23 class HistoryQuickProvider : public HistoryProvider {
24 public: 24 public:
25 HistoryQuickProvider(ACProviderListener* listener, Profile* profile); 25 HistoryQuickProvider(ACProviderListener* listener, Profile* profile);
26 26
27 virtual ~HistoryQuickProvider();
28
29 // AutocompleteProvider. |minimal_changes| is ignored since there 27 // AutocompleteProvider. |minimal_changes| is ignored since there
30 // is no asynch completion performed. 28 // is no asynch completion performed.
31 virtual void Start(const AutocompleteInput& input, 29 virtual void Start(const AutocompleteInput& input,
32 bool minimal_changes) OVERRIDE; 30 bool minimal_changes) OVERRIDE;
33 31
34 virtual void DeleteMatch(const AutocompleteMatch& match) OVERRIDE; 32 virtual void DeleteMatch(const AutocompleteMatch& match) OVERRIDE;
35 33
36 // Disable this provider. For unit testing purposes only. This is required 34 // Disable this provider. For unit testing purposes only. This is required
37 // because this provider is closely associated with the HistoryURLProvider 35 // because this provider is closely associated with the HistoryURLProvider
38 // and in order to properly test the latter the HistoryQuickProvider must 36 // and in order to properly test the latter the HistoryQuickProvider must
39 // be disabled. 37 // be disabled.
40 // TODO(mrossetti): Eliminate this once the HUP has been refactored. 38 // TODO(mrossetti): Eliminate this once the HUP has been refactored.
41 static void set_disabled(bool disabled) { disabled_ = disabled; } 39 static void set_disabled(bool disabled) { disabled_ = disabled; }
42 40
43 private: 41 private:
44 friend class HistoryQuickProviderTest; 42 friend class HistoryQuickProviderTest;
45 FRIEND_TEST_ALL_PREFIXES(HistoryQuickProviderTest, Spans); 43 FRIEND_TEST_ALL_PREFIXES(HistoryQuickProviderTest, Spans);
46 FRIEND_TEST_ALL_PREFIXES(HistoryQuickProviderTest, Relevance); 44 FRIEND_TEST_ALL_PREFIXES(HistoryQuickProviderTest, Relevance);
47 45
46 virtual ~HistoryQuickProvider();
47
48 // Performs the autocomplete matching and scoring. 48 // Performs the autocomplete matching and scoring.
49 void DoAutocomplete(); 49 void DoAutocomplete();
50 50
51 // Creates an AutocompleteMatch from |history_match|, assigning it 51 // Creates an AutocompleteMatch from |history_match|, assigning it
52 // the score |score|. 52 // the score |score|.
53 AutocompleteMatch QuickMatchToACMatch( 53 AutocompleteMatch QuickMatchToACMatch(
54 const history::ScoredHistoryMatch& history_match, 54 const history::ScoredHistoryMatch& history_match,
55 int score); 55 int score);
56 56
57 // Returns the index that should be used for history lookups. 57 // Returns the index that should be used for history lookups.
(...skipping 15 matching lines...) Expand all
73 std::string languages_; 73 std::string languages_;
74 74
75 // Only used for testing. 75 // Only used for testing.
76 scoped_ptr<history::InMemoryURLIndex> index_for_testing_; 76 scoped_ptr<history::InMemoryURLIndex> index_for_testing_;
77 77
78 // This provider is disabled when true. 78 // This provider is disabled when true.
79 static bool disabled_; 79 static bool disabled_;
80 }; 80 };
81 81
82 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_QUICK_PROVIDER_H_ 82 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_QUICK_PROVIDER_H_
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/history_provider.cc ('k') | chrome/browser/autocomplete/history_quick_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698