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" | |
Ramin Halavati
2017/04/04 08:23:52
This field should be a rather short and descriptiv
xhwang
2017/04/04 17:08:32
This is also used on ChromeCast so "Content Decryp
slan
2017/04/04 19:30:20
+1
Ramin Halavati
2017/04/05 09:12:06
Done.
| |
40 description: | |
41 "For a Content Decryption Module (CDM) to obtain origin-specific " | |
42 "identifiers from an individualization or provisioning server. See " | |
43 "https://w3c.github.io/encrypted-media/#direct-individualization." | |
44 trigger: | |
45 "During protected content playback, if the CDM hasn’t been " | |
46 "provisioned yet, it may trigger a provision request which will be " | |
47 "sent to a provisioning server." | |
48 data: | |
49 "Opaque provision request generated by the CDM. It may contain " | |
50 "distinctive identifiers (see " | |
51 "https://w3c.github.io/encrypted-media/#distinctive-identifier) " | |
52 "and/or distinctive permanent identifiers (see " | |
53 "https://w3c.github.io/encrypted-media/#distinctive-permanent-" | |
54 "identifier), which must be encrypted. It does NOT contain origin " | |
55 "information, even in encrypted form." | |
56 destination: OTHER | |
Ramin Halavati
2017/04/04 08:23:52
My understanding is it may send to websites not ow
xhwang
2017/04/04 17:08:32
Currently it's mostly Google sites, but this can c
Ramin Halavati
2017/04/05 09:12:06
Done.
| |
57 } | |
58 policy { | |
59 cookies_allowed: false/true | |
Ramin Halavati
2017/04/04 08:23:52
It seems to me that cookies are not specifically d
xhwang
2017/04/04 17:08:32
Sure. Thank you!
Ramin Halavati
2017/04/05 09:12:06
Done in https://codereview.chromium.org/2804563002
| |
60 cookies_store: "..." | |
61 setting: | |
62 "Users can disable this feature by blocking Protected Media " | |
63 "Identifier permissions via unchecking Protected content in " | |
64 "Android settings, under Site Settings, Media." | |
xhwang
2017/04/04 17:08:32
Again, this setting is for Android only. I am not
slan
2017/04/04 19:30:20
We don't have support for disabling protected medi
Ramin Halavati
2017/04/05 09:12:06
Done.
| |
65 policy_exception_justification: "Not implemented." | |
66 })"); | |
67 request_ = URLFetcher::Create(GURL(request_string), URLFetcher::POST, this, | |
68 traffic_annotation); | |
36 | 69 |
37 // SetUploadData is mandatory even if we are not uploading anything. | 70 // SetUploadData is mandatory even if we are not uploading anything. |
38 request_->SetUploadData("", ""); | 71 request_->SetUploadData("", ""); |
39 request_->AddExtraRequestHeader("User-Agent: Widevine CDM v1.0"); | 72 request_->AddExtraRequestHeader("User-Agent: Widevine CDM v1.0"); |
40 request_->AddExtraRequestHeader("Content-Type: application/json"); | 73 request_->AddExtraRequestHeader("Content-Type: application/json"); |
41 | 74 |
42 DCHECK(context_getter_); | 75 DCHECK(context_getter_); |
43 request_->SetRequestContext(context_getter_); | 76 request_->SetRequestContext(context_getter_); |
44 | 77 |
45 request_->Start(); | 78 request_->Start(); |
(...skipping 22 matching lines...) Expand all Loading... | |
68 | 101 |
69 // Implementation of content public method CreateProvisionFetcher(). | 102 // Implementation of content public method CreateProvisionFetcher(). |
70 | 103 |
71 std::unique_ptr<media::ProvisionFetcher> CreateProvisionFetcher( | 104 std::unique_ptr<media::ProvisionFetcher> CreateProvisionFetcher( |
72 net::URLRequestContextGetter* context_getter) { | 105 net::URLRequestContextGetter* context_getter) { |
73 DCHECK(context_getter); | 106 DCHECK(context_getter); |
74 return base::MakeUnique<URLProvisionFetcher>(context_getter); | 107 return base::MakeUnique<URLProvisionFetcher>(context_getter); |
75 } | 108 } |
76 | 109 |
77 } // namespace content | 110 } // namespace content |
OLD | NEW |