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

Side by Side Diff: content/browser/media/url_provision_fetcher.cc

Issue 2717483002: Network traffic annotation added to url_provision_fetcher. (Closed)
Patch Set: Conflict resolved. Created 3 years, 8 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/base/load_flags.h" 10 #include "net/base/load_flags.h"
11 #include "net/traffic_annotation/network_traffic_annotation.h"
11 #include "net/url_request/url_fetcher.h" 12 #include "net/url_request/url_fetcher.h"
12 13
13 using net::URLFetcher; 14 using net::URLFetcher;
14 15
15 namespace content { 16 namespace content {
16 17
17 // Implementation of URLProvisionFetcher. 18 // Implementation of URLProvisionFetcher.
18 19
19 URLProvisionFetcher::URLProvisionFetcher( 20 URLProvisionFetcher::URLProvisionFetcher(
20 net::URLRequestContextGetter* context_getter) 21 net::URLRequestContextGetter* context_getter)
21 : context_getter_(context_getter) {} 22 : context_getter_(context_getter) {}
22 23
23 URLProvisionFetcher::~URLProvisionFetcher() {} 24 URLProvisionFetcher::~URLProvisionFetcher() {}
24 25
25 void URLProvisionFetcher::Retrieve( 26 void URLProvisionFetcher::Retrieve(
26 const std::string& default_url, 27 const std::string& default_url,
27 const std::string& request_data, 28 const std::string& request_data,
28 const media::ProvisionFetcher::ResponseCB& response_cb) { 29 const media::ProvisionFetcher::ResponseCB& response_cb) {
29 response_cb_ = response_cb; 30 response_cb_ = response_cb;
30 31
31 const std::string request_string = 32 const std::string request_string =
32 default_url + "&signedRequest=" + request_data; 33 default_url + "&signedRequest=" + request_data;
33 DVLOG(1) << __func__ << ": request:" << request_string; 34 DVLOG(1) << __func__ << ": request:" << request_string;
34 35
35 DCHECK(!request_); 36 DCHECK(!request_);
36 request_ = URLFetcher::Create(GURL(request_string), URLFetcher::POST, this); 37 net::NetworkTrafficAnnotationTag traffic_annotation =
38 net::DefineNetworkTrafficAnnotation("url_prevision_fetcher", R"(
39 semantics {
40 sender: "Content Decryption Module"
41 description:
42 "For a Content Decryption Module (CDM) to obtain origin-specific "
43 "identifiers from an individualization or provisioning server. See "
44 "https://w3c.github.io/encrypted-media/#direct-individualization."
45 trigger:
46 "During protected content playback, if the CDM hasn’t been "
47 "provisioned yet, it may trigger a provision request which will be "
48 "sent to a provisioning server."
49 data:
50 "Opaque provision request generated by the CDM. It may contain "
51 "distinctive identifiers (see "
52 "https://w3c.github.io/encrypted-media/#distinctive-identifier) "
53 "and/or distinctive permanent identifiers (see "
54 "https://w3c.github.io/encrypted-media/#distinctive-permanent-"
55 "identifier), which must be encrypted. It does NOT contain origin "
56 "information, even in encrypted form."
57 destination: OTHER
58 }
59 policy {
60 cookies_allowed: false
61 setting:
62 "On Android, users can disable this feature by disabling Protected "
63 "Media Identifier permissions."
64 policy_exception_justification: "Not implemented."
65 })");
66 request_ = URLFetcher::Create(GURL(request_string), URLFetcher::POST, this,
67 traffic_annotation);
37 68
38 // SetUploadData is mandatory even if we are not uploading anything. 69 // SetUploadData is mandatory even if we are not uploading anything.
39 request_->SetUploadData("", ""); 70 request_->SetUploadData("", "");
40 request_->AddExtraRequestHeader("User-Agent: Widevine CDM v1.0"); 71 request_->AddExtraRequestHeader("User-Agent: Widevine CDM v1.0");
41 request_->AddExtraRequestHeader("Content-Type: application/json"); 72 request_->AddExtraRequestHeader("Content-Type: application/json");
42 request_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | 73 request_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES |
43 net::LOAD_DO_NOT_SEND_COOKIES); 74 net::LOAD_DO_NOT_SEND_COOKIES);
44 75
45 DCHECK(context_getter_); 76 DCHECK(context_getter_);
46 request_->SetRequestContext(context_getter_); 77 request_->SetRequestContext(context_getter_);
(...skipping 24 matching lines...) Expand all
71 102
72 // Implementation of content public method CreateProvisionFetcher(). 103 // Implementation of content public method CreateProvisionFetcher().
73 104
74 std::unique_ptr<media::ProvisionFetcher> CreateProvisionFetcher( 105 std::unique_ptr<media::ProvisionFetcher> CreateProvisionFetcher(
75 net::URLRequestContextGetter* context_getter) { 106 net::URLRequestContextGetter* context_getter) {
76 DCHECK(context_getter); 107 DCHECK(context_getter);
77 return base::MakeUnique<URLProvisionFetcher>(context_getter); 108 return base::MakeUnique<URLProvisionFetcher>(context_getter);
78 } 109 }
79 110
80 } // namespace content 111 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698