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

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

Issue 15875007: app_list: Search result launch history and boost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win7_aura unit_test Created 7 years, 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_HISTORY_H_
6 #define CHROME_BROWSER_UI_APP_LIST_SEARCH_HISTORY_H_
7
8 #include <map>
9 #include <string>
10
11 #include "base/basictypes.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "chrome/browser/ui/app_list/search/history_data_observer.h"
15 #include "chrome/browser/ui/app_list/search/history_types.h"
16 #include "components/browser_context_keyed_service/browser_context_keyed_service .h"
17
18 namespace content {
19 class BrowserContext;
20 }
21
22 namespace app_list {
23
24 class HistoryData;
25 class HistoryDataStore;
26
27 namespace test {
28 class SearchHistoryTest;
29 }
30
31 // 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
33 // as associations between user typed query and launched result id. There are
34 // 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
36 // have been launched before.
37 class History : public BrowserContextKeyedService,
38 public HistoryDataObserver {
39 public:
40 explicit History(content::BrowserContext* context);
41 virtual ~History();
42
43 // Returns true if the service is ready.
44 bool IsReady() const;
45
46 // Adds a launch event to the learning data.
47 void AddLaunchEvent(const std::string& query, const std::string& result_id);
48
49 // Gets all known search results that were launched using the given |query|
50 // or using queries that |query| is a prefix of.
51 scoped_ptr<KnownResults> GetKnownResults(const std::string& query) const;
52
53 private:
54 friend class app_list::test::SearchHistoryTest;
55
56 // HistoryDataObserver overrides:
57 virtual void OnHistoryDataLoadedFromStore() OVERRIDE;
58
59 content::BrowserContext* browser_context_;
60 scoped_ptr<HistoryData> data_;
61 scoped_refptr<HistoryDataStore> store_;
62 bool data_loaded_;
63
64 DISALLOW_COPY_AND_ASSIGN(History);
65 };
66
67 } // namespace app_list
68
69 #endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_HISTORY_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/search/app_search_provider.cc ('k') | chrome/browser/ui/app_list/search/history.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698