Content settings: remove some plugin-related code/resources when... there are no...
[chromium-blink-merge.git] / components / omnibox / browser / answers_cache.h
blobe0be2381ed46e24e4cd6aaab4442ff1d3433245e
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.
5 #ifndef COMPONENTS_OMNIBOX_BROWSER_ANSWERS_CACHE_H_
6 #define COMPONENTS_OMNIBOX_BROWSER_ANSWERS_CACHE_H_
8 #include <list>
10 #include "base/basictypes.h"
11 #include "base/strings/string16.h"
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;
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();
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);
31 // Registers a query that received an answer suggestion.
32 void UpdateRecentAnswers(const base::string16& full_query_text,
33 const base::string16& query_type);
35 // Signals if cache is empty.
36 bool empty() const { return cache_.empty(); }
38 private:
39 size_t max_entries_;
40 typedef std::list<AnswersQueryData> Cache;
41 Cache cache_;
43 DISALLOW_COPY_AND_ASSIGN(AnswersCache);
46 #endif // COMPONENTS_OMNIBOX_BROWSER_ANSWERS_CACHE_H_