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

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

Issue 77453007: Omnibox: Make HistoryURL Highlight Titles like HistoryQuick Provider (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 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) 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/autocomplete_input.h" 12 #include "chrome/browser/autocomplete/autocomplete_input.h"
13 #include "chrome/browser/autocomplete/autocomplete_match.h" 13 #include "chrome/browser/autocomplete/autocomplete_match.h"
14 #include "chrome/browser/autocomplete/history_provider.h" 14 #include "chrome/browser/autocomplete/history_provider.h"
15 #include "chrome/browser/history/history_types.h" 15 #include "chrome/browser/history/history_types.h"
16 #include "chrome/browser/history/in_memory_url_index.h" 16 #include "chrome/browser/history/in_memory_url_index.h"
17 17
18 class Profile; 18 class Profile;
19 class TermMatches;
20 19
21 namespace history { 20 namespace history {
22 class ScoredHistoryMatch; 21 class ScoredHistoryMatch;
23 } // namespace history 22 } // namespace history
24 23
25 // This class is an autocomplete provider (a pseudo-internal component of 24 // This class is an autocomplete provider (a pseudo-internal component of
26 // the history system) which quickly (and synchronously) provides matching 25 // the history system) which quickly (and synchronously) provides matching
27 // results from recently or frequently visited sites in the profile's 26 // results from recently or frequently visited sites in the profile's
28 // history. 27 // history.
29 class HistoryQuickProvider : public HistoryProvider { 28 class HistoryQuickProvider : public HistoryProvider {
(...skipping 27 matching lines...) Expand all
57 56
58 // Creates an AutocompleteMatch from |history_match|, assigning it 57 // Creates an AutocompleteMatch from |history_match|, assigning it
59 // the score |score|. 58 // the score |score|.
60 AutocompleteMatch QuickMatchToACMatch( 59 AutocompleteMatch QuickMatchToACMatch(
61 const history::ScoredHistoryMatch& history_match, 60 const history::ScoredHistoryMatch& history_match,
62 int score); 61 int score);
63 62
64 // Returns the index that should be used for history lookups. 63 // Returns the index that should be used for history lookups.
65 history::InMemoryURLIndex* GetIndex(); 64 history::InMemoryURLIndex* GetIndex();
66 65
67 // Fill and return an ACMatchClassifications structure given the term
68 // matches (|matches|) to highlight where terms were found.
69 static ACMatchClassifications SpansFromTermMatch(
70 const history::TermMatches& matches,
71 size_t text_length,
72 bool is_url);
73
74 // Only for use in unittests. Takes ownership of |index|. 66 // Only for use in unittests. Takes ownership of |index|.
75 void set_index(history::InMemoryURLIndex* index) { 67 void set_index(history::InMemoryURLIndex* index) {
76 index_for_testing_.reset(index); 68 index_for_testing_.reset(index);
77 } 69 }
78 70
79 AutocompleteInput autocomplete_input_; 71 AutocompleteInput autocomplete_input_;
80 std::string languages_; 72 std::string languages_;
81 73
82 // Only used for testing. 74 // Only used for testing.
83 scoped_ptr<history::InMemoryURLIndex> index_for_testing_; 75 scoped_ptr<history::InMemoryURLIndex> index_for_testing_;
84 76
85 // This provider is disabled when true. 77 // This provider is disabled when true.
86 static bool disabled_; 78 static bool disabled_;
87 79
88 DISALLOW_COPY_AND_ASSIGN(HistoryQuickProvider); 80 DISALLOW_COPY_AND_ASSIGN(HistoryQuickProvider);
89 }; 81 };
90 82
91 #endif // CHROME_BROWSER_AUTOCOMPLETE_HISTORY_QUICK_PROVIDER_H_ 83 #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