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/android/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/android/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/url_request/url_fetcher.h" | 10 #include "net/url_request/url_fetcher.h" |
11 | 11 |
12 using net::URLFetcher; | 12 using net::URLFetcher; |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 | 15 |
16 // Implementation of URLProvisionFetcher. | 16 // Implementation of URLProvisionFetcher. |
17 | 17 |
18 URLProvisionFetcher::URLProvisionFetcher( | 18 URLProvisionFetcher::URLProvisionFetcher( |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 std::string response; | 54 std::string response; |
55 bool success = false; | 55 bool success = false; |
56 if (response_code == 200) { | 56 if (response_code == 200) { |
57 success = source->GetResponseAsString(&response); | 57 success = source->GetResponseAsString(&response); |
58 DVLOG_IF(1, !success) << __FUNCTION__ << ": GetResponseAsString() failed"; | 58 DVLOG_IF(1, !success) << __FUNCTION__ << ": GetResponseAsString() failed"; |
59 } else { | 59 } else { |
60 DVLOG(1) << "CDM provision: server returned error code " << response_code; | 60 DVLOG(1) << "CDM provision: server returned error code " << response_code; |
61 } | 61 } |
62 | 62 |
63 request_.reset(); | 63 request_.reset(); |
64 | |
65 // URLFetcher implementation calls OnURLFetchComplete() on the same thread | 64 // URLFetcher implementation calls OnURLFetchComplete() on the same thread |
66 // that called Start() and it does this asynchronously. | 65 // that called Start() and it does this asynchronously. |
67 response_cb_.Run(success, response); | 66 response_cb_.Run(success, response); |
68 } | 67 } |
69 | 68 |
70 // Implementation of content public method CreateProvisionFetcher(). | 69 // Implementation of content public method CreateProvisionFetcher(). |
71 | 70 |
72 std::unique_ptr<media::ProvisionFetcher> CreateProvisionFetcher( | 71 std::unique_ptr<media::ProvisionFetcher> CreateProvisionFetcher( |
73 net::URLRequestContextGetter* context_getter) { | 72 net::URLRequestContextGetter* context_getter) { |
74 DCHECK(context_getter); | 73 DCHECK(context_getter); |
75 return base::MakeUnique<URLProvisionFetcher>(context_getter); | 74 return base::MakeUnique<URLProvisionFetcher>(context_getter); |
76 } | 75 } |
77 | 76 |
78 } // namespace content | 77 } // namespace content |
OLD | NEW |