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 // net::URLRequestFileJob overrides: |
| 107 bool CanAccessFile(const base::FilePath& original_path, |
| 108 const base::FilePath& absolute_path) override; |
| 109 |
106 OfflinePageRequestJob(net::URLRequest* request, | 110 OfflinePageRequestJob(net::URLRequest* request, |
107 net::NetworkDelegate* network_delegate, | 111 net::NetworkDelegate* network_delegate, |
108 previews::PreviewsDecider* previews_decider); | 112 previews::PreviewsDecider* previews_decider); |
109 | 113 |
110 void StartAsync(); | 114 void StartAsync(); |
111 | 115 |
112 // Restarts the request job in order to fall back to the default handling. | 116 // Restarts the request job in order to fall back to the default handling. |
113 void FallbackToDefault(); | 117 void FallbackToDefault(); |
114 | 118 |
115 std::unique_ptr<Delegate> delegate_; | 119 std::unique_ptr<Delegate> delegate_; |
116 | 120 |
117 // For redirect simulation. | 121 // For redirect simulation. |
118 scoped_refptr<net::HttpResponseHeaders> fake_headers_for_redirect_; | 122 scoped_refptr<net::HttpResponseHeaders> fake_headers_for_redirect_; |
119 base::TimeTicks receive_redirect_headers_end_; | 123 base::TimeTicks receive_redirect_headers_end_; |
120 base::Time redirect_response_time_; | 124 base::Time redirect_response_time_; |
121 | 125 |
122 // Used to determine if an URLRequest is eligible for offline previews. | 126 // Used to determine if an URLRequest is eligible for offline previews. |
123 previews::PreviewsDecider* previews_decider_; | 127 previews::PreviewsDecider* previews_decider_; |
124 | 128 |
125 base::WeakPtrFactory<OfflinePageRequestJob> weak_ptr_factory_; | 129 base::WeakPtrFactory<OfflinePageRequestJob> weak_ptr_factory_; |
126 | 130 |
127 DISALLOW_COPY_AND_ASSIGN(OfflinePageRequestJob); | 131 DISALLOW_COPY_AND_ASSIGN(OfflinePageRequestJob); |
128 }; | 132 }; |
129 | 133 |
130 } // namespace offline_pages | 134 } // namespace offline_pages |
131 | 135 |
132 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_REQUEST_JOB_H_ | 136 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_REQUEST_JOB_H_ |
OLD | NEW |