| 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> | 7 #include <memory> |
| 8 | 8 |
| 9 #import "base/ios/weak_nsobject.h" | |
| 10 #include "base/mac/scoped_block.h" | 9 #include "base/mac/scoped_block.h" |
| 11 #include "base/macros.h" | 10 #include "base/macros.h" |
| 12 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 13 #include "base/strings/sys_string_conversions.h" | 12 #include "base/strings/sys_string_conversions.h" |
| 14 #import "ios/web/crw_network_activity_indicator_manager.h" | 13 #import "ios/web/crw_network_activity_indicator_manager.h" |
| 15 #include "net/http/http_response_headers.h" | 14 #include "net/http/http_response_headers.h" |
| 16 #include "net/url_request/url_fetcher.h" | 15 #include "net/url_request/url_fetcher.h" |
| 17 #include "net/url_request/url_fetcher_delegate.h" | 16 #include "net/url_request/url_fetcher_delegate.h" |
| 18 #include "net/url_request/url_request_context_getter.h" | 17 #include "net/url_request/url_request_context_getter.h" |
| 19 | 18 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 // download is complete. | 71 // download is complete. |
| 73 class PassKitFetcherDelegate : public URLFetcherDelegate { | 72 class PassKitFetcherDelegate : public URLFetcherDelegate { |
| 74 public: | 73 public: |
| 75 explicit PassKitFetcherDelegate(CRWPassKitDownloader* owner) | 74 explicit PassKitFetcherDelegate(CRWPassKitDownloader* owner) |
| 76 : owner_(owner) {} | 75 : owner_(owner) {} |
| 77 void OnURLFetchComplete(const URLFetcher* source) override { | 76 void OnURLFetchComplete(const URLFetcher* source) override { |
| 78 [owner_ didFinishDownload]; | 77 [owner_ didFinishDownload]; |
| 79 } | 78 } |
| 80 | 79 |
| 81 private: | 80 private: |
| 82 base::WeakNSObject<CRWPassKitDownloader> owner_; | 81 __weak CRWPassKitDownloader* owner_; |
| 83 DISALLOW_COPY_AND_ASSIGN(PassKitFetcherDelegate); | 82 DISALLOW_COPY_AND_ASSIGN(PassKitFetcherDelegate); |
| 84 }; | 83 }; |
| 85 | 84 |
| 86 } // namespace | 85 } // namespace |
| 87 | 86 |
| 88 @implementation CRWPassKitDownloader { | 87 @implementation CRWPassKitDownloader { |
| 89 // Completion handler that is called when PassKit data is downloaded. | 88 // Completion handler that is called when PassKit data is downloaded. |
| 90 base::mac::ScopedBlock<web::PassKitCompletionHandler> _completionHandler; | 89 base::mac::ScopedBlock<web::PassKitCompletionHandler> _completionHandler; |
| 91 | 90 |
| 92 // URLFetcher with which PassKit data is downloaded. It is initialized | 91 // URLFetcher with which PassKit data is downloaded. It is initialized |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 stringWithFormat:@"PassKitDownloader.NetworkActivityIndicatorKey.%d", | 196 stringWithFormat:@"PassKitDownloader.NetworkActivityIndicatorKey.%d", |
| 198 _passKitDownloaderID]; | 197 _passKitDownloaderID]; |
| 199 } | 198 } |
| 200 | 199 |
| 201 - (void)reportUMAPassKitResult:(DownloadPassKitResult)result { | 200 - (void)reportUMAPassKitResult:(DownloadPassKitResult)result { |
| 202 UMA_HISTOGRAM_ENUMERATION(kUMADownloadPassKitResult, result, | 201 UMA_HISTOGRAM_ENUMERATION(kUMADownloadPassKitResult, result, |
| 203 DOWNLOAD_PASS_KIT_RESULT_COUNT); | 202 DOWNLOAD_PASS_KIT_RESULT_COUNT); |
| 204 } | 203 } |
| 205 | 204 |
| 206 @end | 205 @end |
| OLD | NEW |