| 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 #include "chrome/browser/ui/webui/app_list/start_page_handler.h" | 5 #include "chrome/browser/ui/webui/app_list/start_page_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 recommended_apps_->RemoveObserver(this); | 57 recommended_apps_->RemoveObserver(this); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void StartPageHandler::RegisterMessages() { | 60 void StartPageHandler::RegisterMessages() { |
| 61 web_ui()->RegisterMessageCallback( | 61 web_ui()->RegisterMessageCallback( |
| 62 "initialize", | 62 "initialize", |
| 63 base::Bind(&StartPageHandler::HandleInitialize, base::Unretained(this))); | 63 base::Bind(&StartPageHandler::HandleInitialize, base::Unretained(this))); |
| 64 web_ui()->RegisterMessageCallback( | 64 web_ui()->RegisterMessageCallback( |
| 65 "launchApp", | 65 "launchApp", |
| 66 base::Bind(&StartPageHandler::HandleLaunchApp, base::Unretained(this))); | 66 base::Bind(&StartPageHandler::HandleLaunchApp, base::Unretained(this))); |
| 67 web_ui()->RegisterMessageCallback( |
| 68 "search", |
| 69 base::Bind(&StartPageHandler::HandleSearch, base::Unretained(this))); |
| 67 } | 70 } |
| 68 | 71 |
| 69 void StartPageHandler::OnRecommendedAppsChanged() { | 72 void StartPageHandler::OnRecommendedAppsChanged() { |
| 70 SendRecommendedApps(); | 73 SendRecommendedApps(); |
| 71 } | 74 } |
| 72 | 75 |
| 73 void StartPageHandler::SendRecommendedApps() { | 76 void StartPageHandler::SendRecommendedApps() { |
| 74 const RecommendedApps::Apps& recommends = recommended_apps_->apps(); | 77 const RecommendedApps::Apps& recommends = recommended_apps_->apps(); |
| 75 | 78 |
| 76 base::ListValue recommended_list; | 79 base::ListValue recommended_list; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 chrome::GetHostDesktopTypeForNativeView( | 114 chrome::GetHostDesktopTypeForNativeView( |
| 112 web_ui()->GetWebContents()->GetView()->GetNativeView())); | 115 web_ui()->GetWebContents()->GetView()->GetNativeView())); |
| 113 scoped_ptr<AppListControllerDelegate> controller( | 116 scoped_ptr<AppListControllerDelegate> controller( |
| 114 app_list_service->CreateControllerDelegate()); | 117 app_list_service->CreateControllerDelegate()); |
| 115 controller->ActivateApp(profile, | 118 controller->ActivateApp(profile, |
| 116 app, | 119 app, |
| 117 AppListControllerDelegate::LAUNCH_FROM_APP_LIST, | 120 AppListControllerDelegate::LAUNCH_FROM_APP_LIST, |
| 118 ui::EF_NONE); | 121 ui::EF_NONE); |
| 119 } | 122 } |
| 120 | 123 |
| 124 void StartPageHandler::HandleSearch(const base::ListValue* args) { |
| 125 base::string16 query; |
| 126 CHECK(args->GetString(0, &query)); |
| 127 |
| 128 StartPageService::Get(Profile::FromWebUI(web_ui()))->OnSearch(query); |
| 129 } |
| 130 |
| 121 } // namespace app_list | 131 } // namespace app_list |
| OLD | NEW |