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 <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 void OnOpenComplete(int result) override; | 96 void OnOpenComplete(int result) override; |
97 void OnSeekComplete(int64_t result) override; | 97 void OnSeekComplete(int64_t result) override; |
98 void OnReadComplete(net::IOBuffer* buf, int result) override; | 98 void OnReadComplete(net::IOBuffer* buf, int result) override; |
99 | 99 |
100 void OnOfflineFilePathAvailable(const base::FilePath& offline_file_path); | 100 void OnOfflineFilePathAvailable(const base::FilePath& offline_file_path); |
101 void OnOfflineRedirectAvailabe(const GURL& redirected_url); | 101 void OnOfflineRedirectAvailabe(const GURL& redirected_url); |
102 | 102 |
103 void SetDelegateForTesting(std::unique_ptr<Delegate> delegate); | 103 void SetDelegateForTesting(std::unique_ptr<Delegate> delegate); |
104 | 104 |
105 private: | 105 private: |
| 106 // Returns true to disable the file patch checking for file: scheme in |
| 107 // URLRequestFileJob, that's not relevant for this class. |
| 108 bool CanAccessFile(const base::FilePath& original_path, |
| 109 const base::FilePath& absolute_path) override { |
| 110 return true; |
| 111 } |
| 112 |
106 OfflinePageRequestJob(net::URLRequest* request, | 113 OfflinePageRequestJob(net::URLRequest* request, |
107 net::NetworkDelegate* network_delegate, | 114 net::NetworkDelegate* network_delegate, |
108 previews::PreviewsDecider* previews_decider); | 115 previews::PreviewsDecider* previews_decider); |
109 | 116 |
110 void StartAsync(); | 117 void StartAsync(); |
111 | 118 |
112 // Restarts the request job in order to fall back to the default handling. | 119 // Restarts the request job in order to fall back to the default handling. |
113 void FallbackToDefault(); | 120 void FallbackToDefault(); |
114 | 121 |
115 std::unique_ptr<Delegate> delegate_; | 122 std::unique_ptr<Delegate> delegate_; |
116 | 123 |
117 // For redirect simulation. | 124 // For redirect simulation. |
118 scoped_refptr<net::HttpResponseHeaders> fake_headers_for_redirect_; | 125 scoped_refptr<net::HttpResponseHeaders> fake_headers_for_redirect_; |
119 base::TimeTicks receive_redirect_headers_end_; | 126 base::TimeTicks receive_redirect_headers_end_; |
120 base::Time redirect_response_time_; | 127 base::Time redirect_response_time_; |
121 | 128 |
122 // Used to determine if an URLRequest is eligible for offline previews. | 129 // Used to determine if an URLRequest is eligible for offline previews. |
123 previews::PreviewsDecider* previews_decider_; | 130 previews::PreviewsDecider* previews_decider_; |
124 | 131 |
125 base::WeakPtrFactory<OfflinePageRequestJob> weak_ptr_factory_; | 132 base::WeakPtrFactory<OfflinePageRequestJob> weak_ptr_factory_; |
126 | 133 |
127 DISALLOW_COPY_AND_ASSIGN(OfflinePageRequestJob); | 134 DISALLOW_COPY_AND_ASSIGN(OfflinePageRequestJob); |
128 }; | 135 }; |
129 | 136 |
130 } // namespace offline_pages | 137 } // namespace offline_pages |
131 | 138 |
132 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_REQUEST_JOB_H_ | 139 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_REQUEST_JOB_H_ |
OLD | NEW |