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