| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/speech/google_streaming_remote_engine.h" | 5 #include "content/browser/speech/google_streaming_remote_engine.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/big_endian.h" | 10 #include "base/big_endian.h" |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 // Setup downstream fetcher. | 315 // Setup downstream fetcher. |
| 316 std::vector<std::string> downstream_args; | 316 std::vector<std::string> downstream_args; |
| 317 downstream_args.push_back( | 317 downstream_args.push_back( |
| 318 "key=" + net::EscapeQueryParamValue(google_apis::GetAPIKey(), true)); | 318 "key=" + net::EscapeQueryParamValue(google_apis::GetAPIKey(), true)); |
| 319 downstream_args.push_back("pair=" + request_key); | 319 downstream_args.push_back("pair=" + request_key); |
| 320 downstream_args.push_back("output=pb"); | 320 downstream_args.push_back("output=pb"); |
| 321 GURL downstream_url(std::string(kWebServiceBaseUrl) + | 321 GURL downstream_url(std::string(kWebServiceBaseUrl) + |
| 322 std::string(kDownstreamUrl) + | 322 std::string(kDownstreamUrl) + |
| 323 JoinString(downstream_args, '&')); | 323 JoinString(downstream_args, '&')); |
| 324 | 324 |
| 325 downstream_fetcher_.reset(URLFetcher::Create( | 325 downstream_fetcher_ = URLFetcher::Create( |
| 326 kDownstreamUrlFetcherIdForTesting, downstream_url, URLFetcher::GET, | 326 kDownstreamUrlFetcherIdForTesting, downstream_url, URLFetcher::GET, this); |
| 327 this)); | |
| 328 downstream_fetcher_->SetRequestContext(url_context_.get()); | 327 downstream_fetcher_->SetRequestContext(url_context_.get()); |
| 329 downstream_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | | 328 downstream_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | |
| 330 net::LOAD_DO_NOT_SEND_COOKIES | | 329 net::LOAD_DO_NOT_SEND_COOKIES | |
| 331 net::LOAD_DO_NOT_SEND_AUTH_DATA); | 330 net::LOAD_DO_NOT_SEND_AUTH_DATA); |
| 332 downstream_fetcher_->Start(); | 331 downstream_fetcher_->Start(); |
| 333 | 332 |
| 334 // Setup upstream fetcher. | 333 // Setup upstream fetcher. |
| 335 // TODO(hans): Support for user-selected grammars. | 334 // TODO(hans): Support for user-selected grammars. |
| 336 std::vector<std::string> upstream_args; | 335 std::vector<std::string> upstream_args; |
| 337 upstream_args.push_back("key=" + | 336 upstream_args.push_back("key=" + |
| (...skipping 30 matching lines...) Expand all Loading... |
| 368 if (preamble_encoder_) | 367 if (preamble_encoder_) |
| 369 audio_format = preamble_encoder_->mime_type() + ","; | 368 audio_format = preamble_encoder_->mime_type() + ","; |
| 370 audio_format += encoder_->mime_type(); | 369 audio_format += encoder_->mime_type(); |
| 371 upstream_args.push_back( | 370 upstream_args.push_back( |
| 372 "audioFormat=" + net::EscapeQueryParamValue(audio_format, true)); | 371 "audioFormat=" + net::EscapeQueryParamValue(audio_format, true)); |
| 373 } | 372 } |
| 374 GURL upstream_url(std::string(kWebServiceBaseUrl) + | 373 GURL upstream_url(std::string(kWebServiceBaseUrl) + |
| 375 std::string(kUpstreamUrl) + | 374 std::string(kUpstreamUrl) + |
| 376 JoinString(upstream_args, '&')); | 375 JoinString(upstream_args, '&')); |
| 377 | 376 |
| 378 upstream_fetcher_.reset(URLFetcher::Create( | 377 upstream_fetcher_ = URLFetcher::Create(kUpstreamUrlFetcherIdForTesting, |
| 379 kUpstreamUrlFetcherIdForTesting, upstream_url, URLFetcher::POST, this)); | 378 upstream_url, URLFetcher::POST, this); |
| 380 if (use_framed_post_data_) | 379 if (use_framed_post_data_) |
| 381 upstream_fetcher_->SetChunkedUpload("application/octet-stream"); | 380 upstream_fetcher_->SetChunkedUpload("application/octet-stream"); |
| 382 else | 381 else |
| 383 upstream_fetcher_->SetChunkedUpload(encoder_->mime_type()); | 382 upstream_fetcher_->SetChunkedUpload(encoder_->mime_type()); |
| 384 upstream_fetcher_->SetRequestContext(url_context_.get()); | 383 upstream_fetcher_->SetRequestContext(url_context_.get()); |
| 385 upstream_fetcher_->SetReferrer(config_.origin_url); | 384 upstream_fetcher_->SetReferrer(config_.origin_url); |
| 386 upstream_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | | 385 upstream_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | |
| 387 net::LOAD_DO_NOT_SEND_COOKIES | | 386 net::LOAD_DO_NOT_SEND_COOKIES | |
| 388 net::LOAD_DO_NOT_SEND_AUTH_DATA); | 387 net::LOAD_DO_NOT_SEND_AUTH_DATA); |
| 389 upstream_fetcher_->Start(); | 388 upstream_fetcher_->Start(); |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 } | 627 } |
| 629 | 628 |
| 630 GoogleStreamingRemoteEngine::FSMEventArgs::FSMEventArgs(FSMEvent event_value) | 629 GoogleStreamingRemoteEngine::FSMEventArgs::FSMEventArgs(FSMEvent event_value) |
| 631 : event(event_value) { | 630 : event(event_value) { |
| 632 } | 631 } |
| 633 | 632 |
| 634 GoogleStreamingRemoteEngine::FSMEventArgs::~FSMEventArgs() { | 633 GoogleStreamingRemoteEngine::FSMEventArgs::~FSMEventArgs() { |
| 635 } | 634 } |
| 636 | 635 |
| 637 } // namespace content | 636 } // namespace content |
| OLD | NEW |