OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 UI_APP_LIST_SEARCH_HISTORY_H_ | 5 #ifndef UI_APP_LIST_SEARCH_HISTORY_H_ |
6 #define UI_APP_LIST_SEARCH_HISTORY_H_ | 6 #define UI_APP_LIST_SEARCH_HISTORY_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 // History tracks the launch events of the search results and uses HistoryData | 28 // History tracks the launch events of the search results and uses HistoryData |
29 // to build user learning data out of these events. The learning data is stored | 29 // to build user learning data out of these events. The learning data is stored |
30 // as associations between user typed query and launched result id. There are | 30 // as associations between user typed query and launched result id. There are |
31 // primary and secondary associations. See HistoryData comments to see how | 31 // primary and secondary associations. See HistoryData comments to see how |
32 // they are built. The learning data is sent to the mixer to boost results that | 32 // they are built. The learning data is sent to the mixer to boost results that |
33 // have been launched before. | 33 // have been launched before. |
34 class APP_LIST_EXPORT History : public KeyedService, | 34 class APP_LIST_EXPORT History : public KeyedService, |
35 public HistoryDataObserver { | 35 public HistoryDataObserver { |
36 public: | 36 public: |
37 explicit History(scoped_refptr<HistoryDataStore> store); | 37 explicit History(scoped_refptr<HistoryDataStore> store); |
38 virtual ~History(); | 38 ~History() override; |
39 | 39 |
40 // Returns true if the service is ready. | 40 // Returns true if the service is ready. |
41 bool IsReady() const; | 41 bool IsReady() const; |
42 | 42 |
43 // Adds a launch event to the learning data. | 43 // Adds a launch event to the learning data. |
44 void AddLaunchEvent(const std::string& query, const std::string& result_id); | 44 void AddLaunchEvent(const std::string& query, const std::string& result_id); |
45 | 45 |
46 // Gets all known search results that were launched using the given |query| | 46 // Gets all known search results that were launched using the given |query| |
47 // or using queries that |query| is a prefix of. | 47 // or using queries that |query| is a prefix of. |
48 scoped_ptr<KnownResults> GetKnownResults(const std::string& query) const; | 48 scoped_ptr<KnownResults> GetKnownResults(const std::string& query) const; |
49 | 49 |
50 private: | 50 private: |
51 friend class app_list::test::SearchHistoryTest; | 51 friend class app_list::test::SearchHistoryTest; |
52 | 52 |
53 // HistoryDataObserver overrides: | 53 // HistoryDataObserver overrides: |
54 virtual void OnHistoryDataLoadedFromStore() override; | 54 void OnHistoryDataLoadedFromStore() override; |
55 | 55 |
56 scoped_ptr<HistoryData> data_; | 56 scoped_ptr<HistoryData> data_; |
57 scoped_refptr<HistoryDataStore> store_; | 57 scoped_refptr<HistoryDataStore> store_; |
58 bool data_loaded_; | 58 bool data_loaded_; |
59 | 59 |
60 DISALLOW_COPY_AND_ASSIGN(History); | 60 DISALLOW_COPY_AND_ASSIGN(History); |
61 }; | 61 }; |
62 | 62 |
63 } // namespace app_list | 63 } // namespace app_list |
64 | 64 |
65 #endif // UI_APP_LIST_SEARCH_HISTORY_H_ | 65 #endif // UI_APP_LIST_SEARCH_HISTORY_H_ |
OLD | NEW |