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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/app_list/search/history.h
diff --git a/chrome/browser/ui/app_list/search/history.h b/chrome/browser/ui/app_list/search/history.h
new file mode 100644
index 0000000000000000000000000000000000000000..0464461550f7048c18325c26d54e401464cd9764
--- /dev/null
+++ b/chrome/browser/ui/app_list/search/history.h
@@ -0,0 +1,69 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_UI_APP_LIST_SEARCH_HISTORY_H_
+#define CHROME_BROWSER_UI_APP_LIST_SEARCH_HISTORY_H_
+
+#include <map>
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/ui/app_list/search/history_data_observer.h"
+#include "chrome/browser/ui/app_list/search/history_types.h"
+#include "components/browser_context_keyed_service/browser_context_keyed_service.h"
+
+namespace content {
+class BrowserContext;
+}
+
+namespace app_list {
+
+class HistoryData;
+class HistoryDataStore;
+
+namespace test {
+class SearchHistoryTest;
+}
+
+// History tracks the launch events of the search results and uses HistoryData
+// to build user learning data out of these events. The learning data is stored
+// as associations between user typed query and launched result id. There are
+// primary and secondary associations. See HistoryData comments to see how
+// they are built. The learning data is sent to the mixer to boost results that
+// have been launched before.
+class History : public BrowserContextKeyedService,
+ public HistoryDataObserver {
+ public:
+ explicit History(content::BrowserContext* context);
+ virtual ~History();
+
+ // Returns true if the service is ready.
+ bool IsReady() const;
+
+ // Adds a launch event to the learning data.
+ void AddLaunchEvent(const std::string& query, const std::string& result_id);
+
+ // Gets all known search results that were launched using the given |query|
+ // or using queries that |query| is a prefix of.
+ scoped_ptr<KnownResults> GetKnownResults(const std::string& query) const;
+
+ private:
+ friend class app_list::test::SearchHistoryTest;
+
+ // HistoryDataObserver overrides:
+ virtual void OnHistoryDataLoadedFromStore() OVERRIDE;
+
+ content::BrowserContext* browser_context_;
+ scoped_ptr<HistoryData> data_;
+ scoped_refptr<HistoryDataStore> store_;
+ bool data_loaded_;
+
+ DISALLOW_COPY_AND_ASSIGN(History);
+};
+
+} // namespace app_list
+
+#endif // CHROME_BROWSER_UI_APP_LIST_SEARCH_HISTORY_H_
« 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