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

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

Issue 2245733004: Serve offline page for online URL on disconnected or bad networks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix junit test Created 4 years, 3 months 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_REQUEST_INTERCEPTOR_H_
6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_REQUEST_INTERCEPTOR_H_
7
8 #include "base/macros.h"
9 #include "net/url_request/url_request_interceptor.h"
10
11 namespace net {
12 class NetworkDelegate;
13 class URLRequest;
14 class URLRequestJob;
15 }
16
17 namespace offline_pages {
18
19 // An interceptor to hijack requests and potentially service them based on
20 // their offline information. Created one per profile.
21 class OfflinePageRequestInterceptor : public net::URLRequestInterceptor {
22 public:
23 // |profile_id|, which identifies the profile, is passed as a void* to ensure
24 // it's not accidently used on the IO thread.
25 explicit OfflinePageRequestInterceptor(void* profile_id);
26 ~OfflinePageRequestInterceptor() override;
27
28 private:
29 // Overrides from net::URLRequestInterceptor:
30 net::URLRequestJob* MaybeInterceptRequest(
31 net::URLRequest* request,
32 net::NetworkDelegate* network_delegate) const override;
33
34 // The profile for processing offline pages.
35 void* const profile_id_;
36
37 DISALLOW_COPY_AND_ASSIGN(OfflinePageRequestInterceptor);
38 };
39
40 } // namespace offline_pages
41
42 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_REQUEST_INTERCEPTOR_ H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698