| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_REQUEST_JOB_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_REQUEST_JOB_H_ |
| 6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_REQUEST_JOB_H_ | 6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_REQUEST_JOB_H_ |
| 7 | 7 |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "content/public/browser/resource_request_info.h" | 9 #include "content/public/browser/resource_request_info.h" |
| 10 #include "content/public/common/resource_type.h" | 10 #include "content/public/common/resource_type.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 net::NetworkDelegate* network_delegate, | 74 net::NetworkDelegate* network_delegate, |
| 75 previews::PreviewsDecider* previews_decider); | 75 previews::PreviewsDecider* previews_decider); |
| 76 | 76 |
| 77 ~OfflinePageRequestJob() override; | 77 ~OfflinePageRequestJob() override; |
| 78 | 78 |
| 79 // net::URLRequestJob overrides: | 79 // net::URLRequestJob overrides: |
| 80 void Start() override; | 80 void Start() override; |
| 81 void Kill() override; | 81 void Kill() override; |
| 82 | 82 |
| 83 void OnOfflineFilePathAvailable(const base::FilePath& offline_file_path); | 83 void OnOfflineFilePathAvailable(const base::FilePath& offline_file_path); |
| 84 void OnOfflineRedirectAvailabe(const GURL& redirected_url); |
| 84 | 85 |
| 85 void SetDelegateForTesting(std::unique_ptr<Delegate> delegate); | 86 void SetDelegateForTesting(std::unique_ptr<Delegate> delegate); |
| 86 | 87 |
| 87 private: | 88 private: |
| 88 OfflinePageRequestJob(net::URLRequest* request, | 89 OfflinePageRequestJob(net::URLRequest* request, |
| 89 net::NetworkDelegate* network_delegate, | 90 net::NetworkDelegate* network_delegate, |
| 90 previews::PreviewsDecider* previews_decider); | 91 previews::PreviewsDecider* previews_decider); |
| 91 | 92 |
| 92 void StartAsync(); | 93 void StartAsync(); |
| 93 | 94 |
| 94 // Restarts the request job in order to fall back to the default handling. | 95 // Restarts the request job in order to fall back to the default handling. |
| 95 void FallbackToDefault(); | 96 void FallbackToDefault(); |
| 96 | 97 |
| 97 std::unique_ptr<Delegate> delegate_; | 98 std::unique_ptr<Delegate> delegate_; |
| 98 | 99 |
| 99 // Used to determine if an URLRequest is eligible for offline previews. | 100 // Used to determine if an URLRequest is eligible for offline previews. |
| 100 previews::PreviewsDecider* previews_decider_; | 101 previews::PreviewsDecider* previews_decider_; |
| 101 | 102 |
| 102 base::WeakPtrFactory<OfflinePageRequestJob> weak_ptr_factory_; | 103 base::WeakPtrFactory<OfflinePageRequestJob> weak_ptr_factory_; |
| 103 | 104 |
| 104 DISALLOW_COPY_AND_ASSIGN(OfflinePageRequestJob); | 105 DISALLOW_COPY_AND_ASSIGN(OfflinePageRequestJob); |
| 105 }; | 106 }; |
| 106 | 107 |
| 107 } // namespace offline_pages | 108 } // namespace offline_pages |
| 108 | 109 |
| 109 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_REQUEST_JOB_H_ | 110 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_REQUEST_JOB_H_ |
| OLD | NEW |