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

Unified Diff: chrome/browser/ui/app_list/speech_recognizer.cc

Issue 797493002: Eliminate the launcher speech recognizer's dependency on the start page WebContents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years 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 | « no previous file | chrome/browser/ui/app_list/speech_recognizer_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/app_list/speech_recognizer.cc
diff --git a/chrome/browser/ui/app_list/speech_recognizer.cc b/chrome/browser/ui/app_list/speech_recognizer.cc
index 198481a39a83298706e7a9607e3eeb19e1b74b84..9fafe2878dae94d145e60fba5626d11298b74a3b 100644
--- a/chrome/browser/ui/app_list/speech_recognizer.cc
+++ b/chrome/browser/ui/app_list/speech_recognizer.cc
@@ -15,7 +15,7 @@
#include "content/public/browser/speech_recognition_event_listener.h"
#include "content/public/browser/speech_recognition_manager.h"
#include "content/public/browser/speech_recognition_session_config.h"
-#include "content/public/browser/web_contents.h"
+#include "content/public/common/child_process_host.h"
#include "content/public/common/speech_recognition_error.h"
#include "net/url_request/url_request_context_getter.h"
#include "ui/app_list/speech_ui_model_observer.h"
@@ -43,8 +43,7 @@ class SpeechRecognizer::EventListener
net::URLRequestContextGetter* url_request_context_getter,
const std::string& locale);
- void StartOnIOThread(int render_process_id,
- const std::string& auth_scope,
+ void StartOnIOThread(const std::string& auth_scope,
const std::string& auth_token);
void StopOnIOThread();
@@ -107,7 +106,6 @@ SpeechRecognizer::EventListener::~EventListener() {
}
void SpeechRecognizer::EventListener::StartOnIOThread(
- int render_process_id,
const std::string& auth_scope,
const std::string& auth_token) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
@@ -123,7 +121,10 @@ void SpeechRecognizer::EventListener::StartOnIOThread(
config.filter_profanities = true;
config.url_request_context_getter = url_request_context_getter_;
config.event_listener = weak_factory_.GetWeakPtr();
- config.initial_context.render_process_id = render_process_id;
+ // kInvalidUniqueID is not a valid render process, so the speech permission
+ // check allows the request through.
+ config.initial_context.render_process_id =
+ content::ChildProcessHost::kInvalidUniqueID;
config.auth_scope = auth_scope;
config.auth_token = auth_token;
@@ -269,15 +270,6 @@ SpeechRecognizer::~SpeechRecognizer() {
void SpeechRecognizer::Start() {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- // The speech recognizer checks to see if the request is allowed by looking
- // up the renderer process. A renderer containing the app-list is hard-coded
- // to be allowed.
- if (!delegate_)
- return;
- content::WebContents* contents = delegate_->GetSpeechContents();
- if (!contents)
- return;
-
std::string auth_scope;
std::string auth_token;
delegate_->GetSpeechAuthParameters(&auth_scope, &auth_token);
@@ -287,7 +279,6 @@ void SpeechRecognizer::Start() {
FROM_HERE,
base::Bind(&SpeechRecognizer::EventListener::StartOnIOThread,
speech_event_listener_,
- contents->GetRenderProcessHost()->GetID(),
auth_scope,
auth_token));
}
« no previous file with comments | « no previous file | chrome/browser/ui/app_list/speech_recognizer_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698