Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(339)

Side by Side Diff: chrome/browser/android/offline_pages/offline_page_request_job.h

Issue 2506293002: Trigger redirect for offline pages (Closed)
Patch Set: Fix trybot Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/offline_page_request_job.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
9
10 #include "base/memory/ref_counted.h"
8 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "base/time/time.h"
9 #include "content/public/browser/resource_request_info.h" 13 #include "content/public/browser/resource_request_info.h"
10 #include "content/public/common/resource_type.h" 14 #include "content/public/common/resource_type.h"
11 #include "net/url_request/url_request_file_job.h" 15 #include "net/url_request/url_request_file_job.h"
12 16
13 namespace base { 17 namespace base {
14 class FilePath; 18 class FilePath;
15 } 19 }
16 20
17 namespace previews { 21 namespace previews {
18 class PreviewsDecider; 22 class PreviewsDecider;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 static OfflinePageRequestJob* Create( 76 static OfflinePageRequestJob* Create(
73 net::URLRequest* request, 77 net::URLRequest* request,
74 net::NetworkDelegate* network_delegate, 78 net::NetworkDelegate* network_delegate,
75 previews::PreviewsDecider* previews_decider); 79 previews::PreviewsDecider* previews_decider);
76 80
77 ~OfflinePageRequestJob() override; 81 ~OfflinePageRequestJob() override;
78 82
79 // net::URLRequestJob overrides: 83 // net::URLRequestJob overrides:
80 void Start() override; 84 void Start() override;
81 void Kill() override; 85 void Kill() override;
86 bool IsRedirectResponse(GURL* location, int* http_status_code) override;
87 void GetResponseInfo(net::HttpResponseInfo* info) override;
88 void GetLoadTimingInfo(net::LoadTimingInfo* load_timing_info) const override;
89 bool CopyFragmentOnRedirect(const GURL& location) const override;
90 int GetResponseCode() const override;
82 91
83 void OnOfflineFilePathAvailable(const base::FilePath& offline_file_path); 92 void OnOfflineFilePathAvailable(const base::FilePath& offline_file_path);
84 void OnOfflineRedirectAvailabe(const GURL& redirected_url); 93 void OnOfflineRedirectAvailabe(const GURL& redirected_url);
85 94
86 void SetDelegateForTesting(std::unique_ptr<Delegate> delegate); 95 void SetDelegateForTesting(std::unique_ptr<Delegate> delegate);
87 96
88 private: 97 private:
89 OfflinePageRequestJob(net::URLRequest* request, 98 OfflinePageRequestJob(net::URLRequest* request,
90 net::NetworkDelegate* network_delegate, 99 net::NetworkDelegate* network_delegate,
91 previews::PreviewsDecider* previews_decider); 100 previews::PreviewsDecider* previews_decider);
92 101
93 void StartAsync(); 102 void StartAsync();
94 103
95 // Restarts the request job in order to fall back to the default handling. 104 // Restarts the request job in order to fall back to the default handling.
96 void FallbackToDefault(); 105 void FallbackToDefault();
97 106
98 std::unique_ptr<Delegate> delegate_; 107 std::unique_ptr<Delegate> delegate_;
99 108
109 // For redirect simulation.
110 scoped_refptr<net::HttpResponseHeaders> fake_headers_for_redirect_;
111 base::TimeTicks receive_redirect_headers_end_;
112 base::Time redirect_response_time_;
113
100 // Used to determine if an URLRequest is eligible for offline previews. 114 // Used to determine if an URLRequest is eligible for offline previews.
101 previews::PreviewsDecider* previews_decider_; 115 previews::PreviewsDecider* previews_decider_;
102 116
103 base::WeakPtrFactory<OfflinePageRequestJob> weak_ptr_factory_; 117 base::WeakPtrFactory<OfflinePageRequestJob> weak_ptr_factory_;
104 118
105 DISALLOW_COPY_AND_ASSIGN(OfflinePageRequestJob); 119 DISALLOW_COPY_AND_ASSIGN(OfflinePageRequestJob);
106 }; 120 };
107 121
108 } // namespace offline_pages 122 } // namespace offline_pages
109 123
110 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_REQUEST_JOB_H_ 124 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_REQUEST_JOB_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/offline_page_request_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698