| 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 #import "ios/web/web_state/crw_pass_kit_downloader.h" | 5 #import "ios/web/web_state/crw_pass_kit_downloader.h" |
| 6 | 6 |
| 7 #include <memory> |
| 8 |
| 7 #import "base/ios/weak_nsobject.h" | 9 #import "base/ios/weak_nsobject.h" |
| 8 #include "base/mac/scoped_block.h" | 10 #include "base/mac/scoped_block.h" |
| 9 #include "base/macros.h" | 11 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
| 12 #include "base/strings/sys_string_conversions.h" | 13 #include "base/strings/sys_string_conversions.h" |
| 13 #import "ios/web/crw_network_activity_indicator_manager.h" | 14 #import "ios/web/crw_network_activity_indicator_manager.h" |
| 14 #include "net/http/http_response_headers.h" | 15 #include "net/http/http_response_headers.h" |
| 15 #include "net/url_request/url_fetcher.h" | 16 #include "net/url_request/url_fetcher.h" |
| 16 #include "net/url_request/url_fetcher_delegate.h" | 17 #include "net/url_request/url_fetcher_delegate.h" |
| 17 #include "net/url_request/url_request_context_getter.h" | 18 #include "net/url_request/url_request_context_getter.h" |
| 18 | 19 |
| 19 using net::URLFetcher; | 20 using net::URLFetcher; |
| 20 using net::URLFetcherDelegate; | 21 using net::URLFetcherDelegate; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 }; | 80 }; |
| 80 | 81 |
| 81 } // namespace | 82 } // namespace |
| 82 | 83 |
| 83 @implementation CRWPassKitDownloader { | 84 @implementation CRWPassKitDownloader { |
| 84 // Completion handler that is called when PassKit data is downloaded. | 85 // Completion handler that is called when PassKit data is downloaded. |
| 85 base::mac::ScopedBlock<web::PassKitCompletionHandler> _completionHandler; | 86 base::mac::ScopedBlock<web::PassKitCompletionHandler> _completionHandler; |
| 86 | 87 |
| 87 // URLFetcher with which PassKit data is downloaded. It is initialized | 88 // URLFetcher with which PassKit data is downloaded. It is initialized |
| 88 // whenever |downloadPassKitFileWithURL| is called. | 89 // whenever |downloadPassKitFileWithURL| is called. |
| 89 scoped_ptr<URLFetcher> _fetcher; | 90 std::unique_ptr<URLFetcher> _fetcher; |
| 90 | 91 |
| 91 // Delegate to bridge between URLFetcher callback and CRWPassKitDownlaoder. | 92 // Delegate to bridge between URLFetcher callback and CRWPassKitDownlaoder. |
| 92 scoped_ptr<PassKitFetcherDelegate> _fetcherDelegate; | 93 std::unique_ptr<PassKitFetcherDelegate> _fetcherDelegate; |
| 93 | 94 |
| 94 // Context getter which is passed to the URLFetcher, as required by | 95 // Context getter which is passed to the URLFetcher, as required by |
| 95 // URLFetcher API. | 96 // URLFetcher API. |
| 96 scoped_refptr<URLRequestContextGetter> _requestContextGetter; | 97 scoped_refptr<URLRequestContextGetter> _requestContextGetter; |
| 97 | 98 |
| 98 // Network activity ID for this instance of CRWPassKitDownloader. | 99 // Network activity ID for this instance of CRWPassKitDownloader. |
| 99 int _passKitDownloaderID; | 100 int _passKitDownloaderID; |
| 100 } | 101 } |
| 101 | 102 |
| 102 #pragma mark - Public Methods | 103 #pragma mark - Public Methods |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 stringWithFormat:@"PassKitDownloader.NetworkActivityIndicatorKey.%d", | 194 stringWithFormat:@"PassKitDownloader.NetworkActivityIndicatorKey.%d", |
| 194 _passKitDownloaderID]; | 195 _passKitDownloaderID]; |
| 195 } | 196 } |
| 196 | 197 |
| 197 - (void)reportUMAPassKitResult:(DownloadPassKitResult)result { | 198 - (void)reportUMAPassKitResult:(DownloadPassKitResult)result { |
| 198 UMA_HISTOGRAM_ENUMERATION(kUMADownloadPassKitResult, result, | 199 UMA_HISTOGRAM_ENUMERATION(kUMADownloadPassKitResult, result, |
| 199 DOWNLOAD_PASS_KIT_RESULT_COUNT); | 200 DOWNLOAD_PASS_KIT_RESULT_COUNT); |
| 200 } | 201 } |
| 201 | 202 |
| 202 @end | 203 @end |
| OLD | NEW |