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

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

Issue 1185723002: Prepare HistoryProvider for componentization (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Response to review Created 5 years, 6 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
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_PROVIDER_H_ 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_HISTORY_PROVIDER_H_
6 #define CHROME_BROWSER_AUTOCOMPLETE_HISTORY_PROVIDER_H_ 6 #define CHROME_BROWSER_AUTOCOMPLETE_HISTORY_PROVIDER_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "components/omnibox/autocomplete_provider.h" 9 #include "components/omnibox/autocomplete_provider.h"
10 #include "components/omnibox/autocomplete_provider_client.h"
10 #include "components/omnibox/in_memory_url_index_types.h" 11 #include "components/omnibox/in_memory_url_index_types.h"
11 12
12 class AutocompleteInput; 13 class AutocompleteInput;
13 class Profile; 14 class Profile;
14 struct AutocompleteMatch; 15 struct AutocompleteMatch;
15 16
16 // This class is a base class for the history autocomplete providers and 17 // This class is a base class for the history autocomplete providers and
17 // provides functions useful to all derived classes. 18 // provides functions useful to all derived classes.
18 class HistoryProvider : public AutocompleteProvider { 19 class HistoryProvider : public AutocompleteProvider {
19 public: 20 public:
20 void DeleteMatch(const AutocompleteMatch& match) override; 21 void DeleteMatch(const AutocompleteMatch& match) override;
21 22
22 // Returns true if inline autocompletion should be prevented for URL-like 23 // Returns true if inline autocompletion should be prevented for URL-like
23 // input. This method returns true if input.prevent_inline_autocomplete() 24 // input. This method returns true if input.prevent_inline_autocomplete()
24 // is true or the input text contains trailing whitespace. 25 // is true or the input text contains trailing whitespace.
25 static bool PreventInlineAutocomplete(const AutocompleteInput& input); 26 static bool PreventInlineAutocomplete(const AutocompleteInput& input);
26 27
27 protected: 28 protected:
28 HistoryProvider(Profile* profile, AutocompleteProvider::Type type); 29 HistoryProvider(AutocompleteProvider::Type type,
30 AutocompleteProviderClient* client);
31
29 ~HistoryProvider() override; 32 ~HistoryProvider() override;
30 33
31 // Finds and removes the match from the current collection of matches and 34 // Finds and removes the match from the current collection of matches and
32 // backing data. 35 // backing data.
33 void DeleteMatchFromMatches(const AutocompleteMatch& match); 36 void DeleteMatchFromMatches(const AutocompleteMatch& match);
34 37
35 // Fill and return an ACMatchClassifications structure given the |matches| 38 // Fill and return an ACMatchClassifications structure given the |matches|
36 // to highlight. 39 // to highlight.
37 static ACMatchClassifications SpansFromTermMatch(const TermMatches& matches, 40 static ACMatchClassifications SpansFromTermMatch(const TermMatches& matches,
38 size_t text_length, 41 size_t text_length,
39 bool is_url); 42 bool is_url);
40 43
41 Profile* profile_; 44 AutocompleteProviderClient* client() { return client_; }
45
46 private:
47 AutocompleteProviderClient* client_;
48
49 DISALLOW_COPY_AND_ASSIGN(HistoryProvider);
42 }; 50 };
43 51
44 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_PROVIDER_H_ 52 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_PROVIDER_H_
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/chrome_autocomplete_provider_client.cc ('k') | chrome/browser/autocomplete/history_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698