| 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/base/load_flags.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) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 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 request_ = URLFetcher::Create(GURL(request_string), URLFetcher::POST, this); |
| 36 | 37 |
| 37 // SetUploadData is mandatory even if we are not uploading anything. | 38 // SetUploadData is mandatory even if we are not uploading anything. |
| 38 request_->SetUploadData("", ""); | 39 request_->SetUploadData("", ""); |
| 39 request_->AddExtraRequestHeader("User-Agent: Widevine CDM v1.0"); | 40 request_->AddExtraRequestHeader("User-Agent: Widevine CDM v1.0"); |
| 40 request_->AddExtraRequestHeader("Content-Type: application/json"); | 41 request_->AddExtraRequestHeader("Content-Type: application/json"); |
| 42 request_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES | |
| 43 net::LOAD_DO_NOT_SEND_COOKIES); |
| 41 | 44 |
| 42 DCHECK(context_getter_); | 45 DCHECK(context_getter_); |
| 43 request_->SetRequestContext(context_getter_); | 46 request_->SetRequestContext(context_getter_); |
| 44 | 47 |
| 45 request_->Start(); | 48 request_->Start(); |
| 46 } | 49 } |
| 47 | 50 |
| 48 void URLProvisionFetcher::OnURLFetchComplete(const net::URLFetcher* source) { | 51 void URLProvisionFetcher::OnURLFetchComplete(const net::URLFetcher* source) { |
| 49 DCHECK(source); | 52 DCHECK(source); |
| 50 | 53 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 68 | 71 |
| 69 // Implementation of content public method CreateProvisionFetcher(). | 72 // Implementation of content public method CreateProvisionFetcher(). |
| 70 | 73 |
| 71 std::unique_ptr<media::ProvisionFetcher> CreateProvisionFetcher( | 74 std::unique_ptr<media::ProvisionFetcher> CreateProvisionFetcher( |
| 72 net::URLRequestContextGetter* context_getter) { | 75 net::URLRequestContextGetter* context_getter) { |
| 73 DCHECK(context_getter); | 76 DCHECK(context_getter); |
| 74 return base::MakeUnique<URLProvisionFetcher>(context_getter); | 77 return base::MakeUnique<URLProvisionFetcher>(context_getter); |
| 75 } | 78 } |
| 76 | 79 |
| 77 } // namespace content | 80 } // namespace content |
| OLD | NEW |