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

Side by Side Diff: chrome/browser/ui/app_list/search/history.h

Issue 518293002: App-list history cleanup. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test fix Created 6 years, 3 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/ui/app_list/search/history.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 CHROME_BROWSER_UI_APP_LIST_SEARCH_HISTORY_H_ 5 #ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_HISTORY_H_
6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_HISTORY_H_ 6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_HISTORY_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "chrome/browser/ui/app_list/search/history_data_observer.h" 14 #include "chrome/browser/ui/app_list/search/history_data_observer.h"
15 #include "chrome/browser/ui/app_list/search/history_types.h" 15 #include "chrome/browser/ui/app_list/search/history_types.h"
16 #include "components/keyed_service/core/keyed_service.h" 16 #include "components/keyed_service/core/keyed_service.h"
17 17
18 namespace content {
19 class BrowserContext;
20 }
21
22 namespace app_list { 18 namespace app_list {
23 19
24 class HistoryData; 20 class HistoryData;
25 class HistoryDataStore; 21 class HistoryDataStore;
26 22
27 namespace test { 23 namespace test {
28 class SearchHistoryTest; 24 class SearchHistoryTest;
29 } 25 }
30 26
31 // History tracks the launch events of the search results and uses HistoryData 27 // History tracks the launch events of the search results and uses HistoryData
32 // to build user learning data out of these events. The learning data is stored 28 // to build user learning data out of these events. The learning data is stored
33 // as associations between user typed query and launched result id. There are 29 // as associations between user typed query and launched result id. There are
34 // primary and secondary associations. See HistoryData comments to see how 30 // primary and secondary associations. See HistoryData comments to see how
35 // they are built. The learning data is sent to the mixer to boost results that 31 // they are built. The learning data is sent to the mixer to boost results that
36 // have been launched before. 32 // have been launched before.
37 class History : public KeyedService, public HistoryDataObserver { 33 class History : public KeyedService, public HistoryDataObserver {
38 public: 34 public:
39 explicit History(content::BrowserContext* context); 35 explicit History(scoped_refptr<HistoryDataStore> store);
40 virtual ~History(); 36 virtual ~History();
41 37
42 // Returns true if the service is ready. 38 // Returns true if the service is ready.
43 bool IsReady() const; 39 bool IsReady() const;
44 40
45 // Adds a launch event to the learning data. 41 // Adds a launch event to the learning data.
46 void AddLaunchEvent(const std::string& query, const std::string& result_id); 42 void AddLaunchEvent(const std::string& query, const std::string& result_id);
47 43
48 // Gets all known search results that were launched using the given |query| 44 // Gets all known search results that were launched using the given |query|
49 // or using queries that |query| is a prefix of. 45 // or using queries that |query| is a prefix of.
50 scoped_ptr<KnownResults> GetKnownResults(const std::string& query) const; 46 scoped_ptr<KnownResults> GetKnownResults(const std::string& query) const;
51 47
52 private: 48 private:
53 friend class app_list::test::SearchHistoryTest; 49 friend class app_list::test::SearchHistoryTest;
54 50
55 // HistoryDataObserver overrides: 51 // HistoryDataObserver overrides:
56 virtual void OnHistoryDataLoadedFromStore() OVERRIDE; 52 virtual void OnHistoryDataLoadedFromStore() OVERRIDE;
57 53
58 content::BrowserContext* browser_context_;
59 scoped_ptr<HistoryData> data_; 54 scoped_ptr<HistoryData> data_;
60 scoped_refptr<HistoryDataStore> store_; 55 scoped_refptr<HistoryDataStore> store_;
61 bool data_loaded_; 56 bool data_loaded_;
62 57
63 DISALLOW_COPY_AND_ASSIGN(History); 58 DISALLOW_COPY_AND_ASSIGN(History);
64 }; 59 };
65 60
66 } // namespace app_list 61 } // namespace app_list
67 62
68 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_HISTORY_H_ 63 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_HISTORY_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/app_list/search/history.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698