| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_GET_OPERATION_REQUEST_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_GET_OPERATION_REQUEST_H_ |
| 6 #define COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_GET_OPERATION_REQUEST_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_GET_OPERATION_REQUEST_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "components/offline_pages/core/prefetch/prefetch_types.h" | 12 #include "components/offline_pages/core/prefetch/prefetch_types.h" |
| 13 #include "components/version_info/channel.h" |
| 13 | 14 |
| 14 namespace net { | 15 namespace net { |
| 15 class URLRequestContextGetter; | 16 class URLRequestContextGetter; |
| 16 } | 17 } |
| 17 | 18 |
| 18 namespace offline_pages { | 19 namespace offline_pages { |
| 19 | 20 |
| 20 class PrefetchRequestFetcher; | 21 class PrefetchRequestFetcher; |
| 21 | 22 |
| 22 // Sends this request to find out the current state of an operation that is | 23 // Sends this request to find out the current state of an operation that is |
| 23 // triggered by GeneratePageBundleRequest but not finished at that time. | 24 // triggered by GeneratePageBundleRequest but not finished at that time. |
| 24 class GetOperationRequest { | 25 class GetOperationRequest { |
| 25 public: | 26 public: |
| 26 // |name| identifies the operation triggered by the GeneratePageBundleRequest. | 27 // |name| identifies the operation triggered by the GeneratePageBundleRequest. |
| 27 // It is retrieved from the operation data returned in the | 28 // It is retrieved from the operation data returned in the |
| 28 // GeneratePageBundleRequest response. | 29 // GeneratePageBundleRequest response. |
| 29 GetOperationRequest(const std::string& name, | 30 GetOperationRequest(const std::string& name, |
| 31 version_info::Channel channel, |
| 30 net::URLRequestContextGetter* request_context_getter, | 32 net::URLRequestContextGetter* request_context_getter, |
| 31 const PrefetchRequestFinishedCallback& callback); | 33 const PrefetchRequestFinishedCallback& callback); |
| 32 ~GetOperationRequest(); | 34 ~GetOperationRequest(); |
| 33 | 35 |
| 34 private: | 36 private: |
| 35 void OnCompleted(PrefetchRequestStatus status, const std::string& data); | 37 void OnCompleted(PrefetchRequestStatus status, const std::string& data); |
| 36 | 38 |
| 37 PrefetchRequestFinishedCallback callback_; | 39 PrefetchRequestFinishedCallback callback_; |
| 38 std::unique_ptr<PrefetchRequestFetcher> fetcher_; | 40 std::unique_ptr<PrefetchRequestFetcher> fetcher_; |
| 39 | 41 |
| 40 DISALLOW_COPY_AND_ASSIGN(GetOperationRequest); | 42 DISALLOW_COPY_AND_ASSIGN(GetOperationRequest); |
| 41 }; | 43 }; |
| 42 | 44 |
| 43 } // namespace offline_pages | 45 } // namespace offline_pages |
| 44 | 46 |
| 45 #endif // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_GET_OPERATION_REQUEST_H_ | 47 #endif // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_GET_OPERATION_REQUEST_H_ |
| OLD | NEW |