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

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

Issue 2388253002: Use the previews black list for offline previews (Closed)
Patch Set: mmenke comments Created 4 years, 2 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
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/offline_page_request_interceptor.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_INTERCEPTOR_H_ 5 #ifndef CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_REQUEST_INTERCEPTOR_H_
6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_REQUEST_INTERCEPTOR_H_ 6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_REQUEST_INTERCEPTOR_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "net/url_request/url_request_interceptor.h" 9 #include "net/url_request/url_request_interceptor.h"
10 10
11 namespace net { 11 namespace net {
12 class NetworkDelegate; 12 class NetworkDelegate;
13 class URLRequest; 13 class URLRequest;
14 class URLRequestJob; 14 class URLRequestJob;
15 } 15 }
16 16
17 namespace previews {
18 class PreviewsDecider;
19 }
20
17 namespace offline_pages { 21 namespace offline_pages {
18 22
19 // An interceptor to hijack requests and potentially service them based on 23 // An interceptor to hijack requests and potentially service them based on
20 // their offline information. Created one per profile. 24 // their offline information. Created one per profile.
21 class OfflinePageRequestInterceptor : public net::URLRequestInterceptor { 25 class OfflinePageRequestInterceptor : public net::URLRequestInterceptor {
22 public: 26 public:
23 OfflinePageRequestInterceptor(); 27 // Embedder must guarantee that |previews_decider| outlives |this|.
28 explicit OfflinePageRequestInterceptor(
29 previews::PreviewsDecider* previews_decider);
24 ~OfflinePageRequestInterceptor() override; 30 ~OfflinePageRequestInterceptor() override;
25 31
26 private: 32 private:
27 // Overrides from net::URLRequestInterceptor: 33 // Overrides from net::URLRequestInterceptor:
28 net::URLRequestJob* MaybeInterceptRequest( 34 net::URLRequestJob* MaybeInterceptRequest(
29 net::URLRequest* request, 35 net::URLRequest* request,
30 net::NetworkDelegate* network_delegate) const override; 36 net::NetworkDelegate* network_delegate) const override;
31 37
38 // Used to determine if an URLRequest is eligible for offline previews.
39 previews::PreviewsDecider* previews_decider_;
40
32 DISALLOW_COPY_AND_ASSIGN(OfflinePageRequestInterceptor); 41 DISALLOW_COPY_AND_ASSIGN(OfflinePageRequestInterceptor);
33 }; 42 };
34 43
35 } // namespace offline_pages 44 } // namespace offline_pages
36 45
37 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_REQUEST_INTERCEPTOR_ H_ 46 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_REQUEST_INTERCEPTOR_ H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/offline_page_request_interceptor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698