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

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

Issue 455563002: Prefetch cache pt1 - MRU (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pfq-base
Patch Set: Review fixes. Created 6 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/autocomplete/answers_cache.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_ANSWERS_CACHE_H_
6 #define CHROME_BROWSER_AUTOCOMPLETE_ANSWERS_CACHE_H_
7
8 #include <list>
9
10 #include "base/basictypes.h"
11 #include "base/strings/string16.h"
12
13 struct AnswersQueryData {
14 AnswersQueryData();
15 AnswersQueryData(const base::string16& full_query_text,
16 const base::string16& query_type);
17 base::string16 full_query_text;
18 base::string16 query_type;
19 };
20
21 // Cache for the most-recently seen answer for Answers in Suggest.
22 class AnswersCache {
23 public:
24 explicit AnswersCache(size_t max_entries);
25 ~AnswersCache();
26
27 // Gets the top answer query completion for the query term. The query data
28 // will contain empty query text and type if no matching data was found.
29 AnswersQueryData GetTopAnswerEntry(const base::string16& query);
30
31 // Registers a query that received an answer suggestion.
32 void UpdateRecentAnswers(const base::string16& full_query_text,
33 const base::string16& query_type);
34
35 // Signals if cache is empty.
36 bool empty() { return cache_.empty(); }
Peter Kasting 2014/08/12 18:32:13 Nit: Can be const
groby-ooo-7-16 2014/08/12 19:53:32 Done.
37
38 private:
39 size_t max_entries_;
40 typedef std::list<AnswersQueryData> Cache;
41 Cache cache_;
42
43 DISALLOW_COPY_AND_ASSIGN(AnswersCache);
44 };
45
46 #endif // CHROME_BROWSER_AUTOCOMPLETE_ANSWERS_CACHE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autocomplete/answers_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698