Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/media/url_provision_fetcher.h" | 5 #include "content/browser/media/url_provision_fetcher.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "content/public/browser/provision_fetcher_factory.h" | 8 #include "content/public/browser/provision_fetcher_factory.h" |
| 9 #include "media/base/bind_to_current_loop.h" | 9 #include "media/base/bind_to_current_loop.h" |
| 10 #include "net/traffic_annotation/network_traffic_annotation.h" | |
| 10 #include "net/url_request/url_fetcher.h" | 11 #include "net/url_request/url_fetcher.h" |
| 11 | 12 |
| 12 using net::URLFetcher; | 13 using net::URLFetcher; |
| 13 | 14 |
| 14 namespace content { | 15 namespace content { |
| 15 | 16 |
| 16 // Implementation of URLProvisionFetcher. | 17 // Implementation of URLProvisionFetcher. |
| 17 | 18 |
| 18 URLProvisionFetcher::URLProvisionFetcher( | 19 URLProvisionFetcher::URLProvisionFetcher( |
| 19 net::URLRequestContextGetter* context_getter) | 20 net::URLRequestContextGetter* context_getter) |
| 20 : context_getter_(context_getter) {} | 21 : context_getter_(context_getter) {} |
| 21 | 22 |
| 22 URLProvisionFetcher::~URLProvisionFetcher() {} | 23 URLProvisionFetcher::~URLProvisionFetcher() {} |
| 23 | 24 |
| 24 void URLProvisionFetcher::Retrieve( | 25 void URLProvisionFetcher::Retrieve( |
| 25 const std::string& default_url, | 26 const std::string& default_url, |
| 26 const std::string& request_data, | 27 const std::string& request_data, |
| 27 const media::ProvisionFetcher::ResponseCB& response_cb) { | 28 const media::ProvisionFetcher::ResponseCB& response_cb) { |
| 28 response_cb_ = response_cb; | 29 response_cb_ = response_cb; |
| 29 | 30 |
| 30 const std::string request_string = | 31 const std::string request_string = |
| 31 default_url + "&signedRequest=" + request_data; | 32 default_url + "&signedRequest=" + request_data; |
| 32 DVLOG(1) << __func__ << ": request:" << request_string; | 33 DVLOG(1) << __func__ << ": request:" << request_string; |
| 33 | 34 |
| 34 DCHECK(!request_); | 35 DCHECK(!request_); |
| 35 request_ = URLFetcher::Create(GURL(request_string), URLFetcher::POST, this); | 36 net::NetworkTrafficAnnotationTag traffic_annotation = |
| 37 net::DefineNetworkTrafficAnnotation("url_prevision_fetcher", R"( | |
| 38 semantics { | |
| 39 sender: "ProvisionFetcher for Android MediaDrm" | |
| 40 description: | |
| 41 "Android MediaDrm (a part of encrypted content playback) requires " | |
| 42 "provisioning of the device. This is a request to provisioning " | |
| 43 "server." | |
| 44 trigger: "NotProvisionedException from MediaDrm" | |
|
Ramin Halavati
2017/03/09 06:28:47
Please be a little more specific for a not-softwar
| |
| 45 data: "Opaque request generated by Android framework" | |
|
Ramin Halavati
2017/03/09 06:28:47
Ditto.
| |
| 46 destination: WEBSITE/GOOGLE_OWNED_SERVICE/OTHER | |
|
Ramin Halavati
2017/03/09 06:28:47
Isn't it sent to a website that belongs to Google?
| |
| 47 } | |
| 48 policy { | |
| 49 cookies_allowed: false/true | |
|
Ramin Halavati
2017/03/09 06:28:47
I don't see disabling cookies in the code. If you
| |
| 50 cookies_store: "..." | |
| 51 setting: "..." | |
| 52 policy { | |
| 53 [POLICY_NAME] { | |
| 54 policy_options {mode: MANDATORY/RECOMMENDED/UNSET} | |
| 55 value: ... | |
| 56 } | |
| 57 } | |
| 58 policy_exception_justification: "..." | |
|
Ramin Halavati
2017/03/09 06:28:47
If there is no chrome policy implemented to preven
| |
| 59 })"); | |
| 60 request_ = URLFetcher::Create(GURL(request_string), URLFetcher::POST, this, | |
| 61 traffic_annotation); | |
| 36 | 62 |
| 37 // SetUploadData is mandatory even if we are not uploading anything. | 63 // SetUploadData is mandatory even if we are not uploading anything. |
| 38 request_->SetUploadData("", ""); | 64 request_->SetUploadData("", ""); |
| 39 request_->AddExtraRequestHeader("User-Agent: Widevine CDM v1.0"); | 65 request_->AddExtraRequestHeader("User-Agent: Widevine CDM v1.0"); |
| 40 request_->AddExtraRequestHeader("Content-Type: application/json"); | 66 request_->AddExtraRequestHeader("Content-Type: application/json"); |
| 41 | 67 |
| 42 DCHECK(context_getter_); | 68 DCHECK(context_getter_); |
| 43 request_->SetRequestContext(context_getter_); | 69 request_->SetRequestContext(context_getter_); |
| 44 | 70 |
| 45 request_->Start(); | 71 request_->Start(); |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 68 | 94 |
| 69 // Implementation of content public method CreateProvisionFetcher(). | 95 // Implementation of content public method CreateProvisionFetcher(). |
| 70 | 96 |
| 71 std::unique_ptr<media::ProvisionFetcher> CreateProvisionFetcher( | 97 std::unique_ptr<media::ProvisionFetcher> CreateProvisionFetcher( |
| 72 net::URLRequestContextGetter* context_getter) { | 98 net::URLRequestContextGetter* context_getter) { |
| 73 DCHECK(context_getter); | 99 DCHECK(context_getter); |
| 74 return base::MakeUnique<URLProvisionFetcher>(context_getter); | 100 return base::MakeUnique<URLProvisionFetcher>(context_getter); |
| 75 } | 101 } |
| 76 | 102 |
| 77 } // namespace content | 103 } // namespace content |
| OLD | NEW |