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

Side by Side Diff: chrome/browser/ui/webui/app_list/start_page_handler.cc

Issue 69813002: Adds the speech recognition button to the app-list searchbox. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
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( 67 web_ui()->RegisterMessageCallback(
68 "search", 68 "search",
69 base::Bind(&StartPageHandler::HandleSearch, base::Unretained(this))); 69 base::Bind(&StartPageHandler::HandleSearch, base::Unretained(this)));
70 web_ui()->RegisterMessageCallback(
71 "setSpeechRecognitionState",
72 base::Bind(&StartPageHandler::HandleSpeechRecognition,
73 base::Unretained(this)));
70 } 74 }
71 75
72 void StartPageHandler::OnRecommendedAppsChanged() { 76 void StartPageHandler::OnRecommendedAppsChanged() {
73 SendRecommendedApps(); 77 SendRecommendedApps();
74 } 78 }
75 79
76 void StartPageHandler::SendRecommendedApps() { 80 void StartPageHandler::SendRecommendedApps() {
77 const RecommendedApps::Apps& recommends = recommended_apps_->apps(); 81 const RecommendedApps::Apps& recommends = recommended_apps_->apps();
78 82
79 base::ListValue recommended_list; 83 base::ListValue recommended_list;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 ui::EF_NONE); 125 ui::EF_NONE);
122 } 126 }
123 127
124 void StartPageHandler::HandleSearch(const base::ListValue* args) { 128 void StartPageHandler::HandleSearch(const base::ListValue* args) {
125 base::string16 query; 129 base::string16 query;
126 CHECK(args->GetString(0, &query)); 130 CHECK(args->GetString(0, &query));
127 131
128 StartPageService::Get(Profile::FromWebUI(web_ui()))->OnSearch(query); 132 StartPageService::Get(Profile::FromWebUI(web_ui()))->OnSearch(query);
129 } 133 }
130 134
135 void StartPageHandler::HandleSpeechRecognition(const base::ListValue* args) {
136 bool recognizing;
137 CHECK(args->GetBoolean(0, &recognizing));
138
139 StartPageService* service =
140 StartPageService::Get(Profile::FromWebUI(web_ui()));
141 service->OnSpeechRecognitionStateChanged(recognizing);
142 }
143
131 } // namespace app_list 144 } // namespace app_list
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698