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

Unified Diff: chrome/browser/ui/app_list/search/search_controller.cc

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
« no previous file with comments | « chrome/browser/ui/app_list/search/search_controller.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/app_list/search/search_controller.cc
diff --git a/chrome/browser/ui/app_list/search/search_controller.cc b/chrome/browser/ui/app_list/search/search_controller.cc
index 758b94c9c810b327decf55fa40a72b628c65e217..5144a8ae71a3489fbcf6a164e84db9f866f7c6dd 100644
--- a/chrome/browser/ui/app_list/search/search_controller.cc
+++ b/chrome/browser/ui/app_list/search/search_controller.cc
@@ -11,8 +11,12 @@
#include "base/command_line.h"
#include "base/memory/scoped_ptr.h"
#include "base/string_util.h"
+#include "base/utf_string_conversions.h"
+#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/app_list/search/app_search_provider.h"
#include "chrome/browser/ui/app_list/search/chrome_search_result.h"
+#include "chrome/browser/ui/app_list/search/history.h"
+#include "chrome/browser/ui/app_list/search/history_factory.h"
#include "chrome/browser/ui/app_list/search/omnibox_provider.h"
#include "chrome/browser/ui/app_list/search/search_provider.h"
#include "chrome/browser/ui/app_list/search/webstore_provider.h"
@@ -33,7 +37,8 @@ SearchController::SearchController(Profile* profile,
search_box_(search_box),
list_controller_(list_controller),
dispatching_query_(false),
- mixer_(new Mixer(results)) {
+ mixer_(new Mixer(results)),
+ history_(HistoryFactory::GetForBrowserContext(profile)) {
Init();
}
@@ -93,8 +98,14 @@ void SearchController::OpenResult(SearchResult* result, int event_flags) {
// Count AppList.Search here because it is composed of search + action.
content::RecordAction(content::UserMetricsAction("AppList_Search"));
- // TODO(xiyuan): Hook up with user learning.
- static_cast<app_list::ChromeSearchResult*>(result)->Open(event_flags);
+ ChromeSearchResult* chrome_result =
+ static_cast<app_list::ChromeSearchResult*>(result);
+ chrome_result->Open(event_flags);
+
+ if (history_ && history_->IsReady()) {
+ history_->AddLaunchEvent(UTF16ToUTF8(search_box_->text()),
+ chrome_result->id());
+ }
}
void SearchController::InvokeResultAction(SearchResult* result,
@@ -118,7 +129,13 @@ void SearchController::OnResultsChanged() {
if (dispatching_query_)
return;
- mixer_->MixAndPublish();
+ KnownResults known_results;
+ if (history_ && history_->IsReady()) {
+ history_->GetKnownResults(UTF16ToUTF8(search_box_->text()))
+ ->swap(known_results);
+ }
+
+ mixer_->MixAndPublish(known_results);
}
} // namespace app_list
« no previous file with comments | « chrome/browser/ui/app_list/search/search_controller.h ('k') | chrome/chrome_browser_ui.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698