| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #include "chrome/browser/autocomplete/answers_cache.h" | 5 #include "components/omnibox/answers_cache.h" |
| 6 | 6 |
| 7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
| 8 | 8 |
| 9 AnswersQueryData::AnswersQueryData() { | 9 AnswersQueryData::AnswersQueryData() { |
| 10 } | 10 } |
| 11 AnswersQueryData::AnswersQueryData(const base::string16& text, | 11 AnswersQueryData::AnswersQueryData(const base::string16& text, |
| 12 const base::string16& type) | 12 const base::string16& type) |
| 13 : full_query_text(text), query_type(type) { | 13 : full_query_text(text), query_type(type) { |
| 14 } | 14 } |
| 15 | 15 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 42 return; | 42 return; |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 | 45 |
| 46 // Evict if cache size is exceeded. | 46 // Evict if cache size is exceeded. |
| 47 if (cache_.size() >= max_entries_) | 47 if (cache_.size() >= max_entries_) |
| 48 cache_.pop_back(); | 48 cache_.pop_back(); |
| 49 | 49 |
| 50 cache_.push_front(AnswersQueryData(full_query_text, query_type)); | 50 cache_.push_front(AnswersQueryData(full_query_text, query_type)); |
| 51 } | 51 } |
| OLD | NEW |