Chromium Code Reviews| Index: content/browser/speech/speech_recognition_engine.cc |
| diff --git a/content/browser/speech/speech_recognition_engine.cc b/content/browser/speech/speech_recognition_engine.cc |
| index efa13f470e73e6a26b8280ea2410f66c53d2ab26..cd887b13b33576fa1c1870a7df39d932f8f83b32 100644 |
| --- a/content/browser/speech/speech_recognition_engine.cc |
| +++ b/content/browser/speech/speech_recognition_engine.cc |
| @@ -21,6 +21,7 @@ |
| #include "google_apis/google_api_keys.h" |
| #include "net/base/escape.h" |
| #include "net/base/load_flags.h" |
| +#include "net/traffic_annotation/network_traffic_annotation.h" |
| #include "net/url_request/http_user_agent_settings.h" |
| #include "net/url_request/url_fetcher.h" |
| #include "net/url_request/url_request_context.h" |
| @@ -337,8 +338,37 @@ SpeechRecognitionEngine::ConnectBothStreams(const FSMEventArgs&) { |
| std::string(kDownstreamUrl) + |
| base::JoinString(downstream_args, "&")); |
| - downstream_fetcher_ = URLFetcher::Create( |
| - kDownstreamUrlFetcherIdForTesting, downstream_url, URLFetcher::GET, this); |
| + net::NetworkTrafficAnnotationTag downstream_traffic_annotation = |
| + net::DefineNetworkTrafficAnnotation("speech_recognition_downstream", R"( |
| + semantics { |
| + sender: "Speech Recognition" |
| + description: |
| + "Chrome provides translation from speech audio recorded with a " |
| + "microphone to text, by using the Google speech recognition web " |
| + "service. Audio is sent to Google's servers (upstream) and text is " |
| + "returned (downstream). This network request (downstream) sends an " |
| + "id for getting the text response. Then the (upstream) request " |
| + "sends the audio data along with the id. When the server has " |
| + "finished processing the audio data and produced a text response, " |
| + "it replies to this request." |
| + trigger: |
| + "The user chooses to start the recognition by clicking the " |
| + "microphone icon in the Google search field." |
| + data: "A unique random id for this speech recognition request." |
| + destination: GOOGLE_OWNED_SERVICE |
| + } |
| + policy { |
| + cookies_allowed: false |
| + setting: |
| + "The user must allow the browser to access the microphone in a " |
| + "popup notification. This is set per site (hostname pattern). In " |
| + "the content settings, microphone access can be turned off for all " |
| + "sites and site specific settings can be changed." |
| + policy_exception_justification: "Not implemented." |
| + })"); |
| + downstream_fetcher_ = |
| + URLFetcher::Create(kDownstreamUrlFetcherIdForTesting, downstream_url, |
| + URLFetcher::GET, this, downstream_traffic_annotation); |
| downstream_fetcher_->SetRequestContext(url_context_.get()); |
| downstream_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | |
| net::LOAD_DO_NOT_SEND_COOKIES | |
| @@ -393,8 +423,33 @@ SpeechRecognitionEngine::ConnectBothStreams(const FSMEventArgs&) { |
| std::string(kUpstreamUrl) + |
| base::JoinString(upstream_args, "&")); |
| - upstream_fetcher_ = URLFetcher::Create(kUpstreamUrlFetcherIdForTesting, |
| - upstream_url, URLFetcher::POST, this); |
| + net::NetworkTrafficAnnotationTag upstream_traffic_annotation = |
| + net::DefineNetworkTrafficAnnotation("speech_recognition_upstream", R"( |
| + semantics { |
| + sender: "Speech Recognition" |
| + description: |
| + "Chrome provides translation from speech audio recorded with a " |
| + "microphone to text, by using the Google speech recognition web " |
| + "service. Audio is sent to Google's servers (upstream) and text is " |
| + "returned (downstream)." |
| + trigger: |
| + "The user chooses to start the recognition by clicking the " |
| + "microphone icon in the Google search field." |
| + data: "Audio recorded with the microphone." |
|
Henrik Grunell
2017/05/11 08:22:35
Perhaps add that the id is sent here as well?
Ramin Halavati
2017/05/11 08:38:06
Done.
|
| + destination: GOOGLE_OWNED_SERVICE |
| + } |
| + policy { |
| + cookies_allowed: false |
| + setting: |
| + "The user must allow the browser to access the microphone in a " |
| + "popup notification. This is set per site (hostname pattern). In " |
| + "the content settings, microphone access can be turned off for all " |
| + "sites and site specific settings can be changed." |
| + policy_exception_justification: "Not implemented." |
| + })"); |
| + upstream_fetcher_ = |
| + URLFetcher::Create(kUpstreamUrlFetcherIdForTesting, upstream_url, |
| + URLFetcher::POST, this, upstream_traffic_annotation); |
| if (use_framed_post_data_) |
| upstream_fetcher_->SetChunkedUpload("application/octet-stream"); |
| else |