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

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

Issue 2322833002: Support serving offline page by offline ID (Closed)
Patch Set: 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
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 "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "content/public/browser/resource_request_info.h" 9 #include "content/public/browser/resource_request_info.h"
10 #include "content/public/common/resource_type.h" 10 #include "content/public/common/resource_type.h"
11 #include "net/url_request/url_request_file_job.h" 11 #include "net/url_request/url_request_file_job.h"
12 12
13 namespace base { 13 namespace base {
14 class FilePath; 14 class FilePath;
15 } 15 }
16 16
17 namespace offline_pages { 17 namespace offline_pages {
18 18
19 // Header that indicates that the offline page should be loaded if it exists 19 // Header that indicates that the offline page should be loaded if it exists
20 // regardless current network conditions. Its value is a comma/space separated 20 // regardless current network conditions. Its value is a comma/space separated
21 // name-value pair that may provide reason or define custom behavior. 21 // name-value pair that may provide reason or define custom behavior.
22 extern const char kLoadingOfflinePageHeader[]; 22 extern const char kOfflinePageHeader[];
23 // The name used in name-value pair of kLoadingOfflinePageHeader to tell if the
Dmitry Titov 2016/09/09 04:33:06 Need to update comment here - there is no more kLo
jianli 2016/09/10 00:56:04 Done.
24 // offline info in this header should be persisted across session restore.
25 extern const char kOfflinePageHeaderPersistKey[];
Dmitry Titov 2016/09/09 04:33:06 Is this from a separate CL? This CL does not seem
jianli 2016/09/10 00:56:04 Another CL (https://codereview.chromium.org/231036
23 // The name used in name-value pair of kLoadingOfflinePageHeader to denote the 26 // The name used in name-value pair of kLoadingOfflinePageHeader to denote the
24 // reason for loading offline page. 27 // reason for loading offline page.
25 extern const char kLoadingOfflinePageReason[]; 28 extern const char kOfflinePageHeaderReasonKey[];
26 // Possible values in name-value pair that denote the reason for loading offline 29 // Possible values in name-value pair that denote the reason for loading offline
27 // page. 30 // page.
28 extern const char kLoadingOfflinePageDueToNetError[]; 31 extern const char kOfflinePageHeaderReasonValueDueToNetError[];
32 // The name used in name-value pair of kLoadingOfflinePageHeader to denote the
33 // namespace of the offline page to load.
34 extern const char kOfflinePageHeaderNamespaceKey[];
35 // The name used in name-value pair of kLoadingOfflinePageHeader to denote the
36 // ID of the offline page to load. If kOfflinePageNamespace value exists, this
37 // ID is the client ID within the specific namespace. Otherwise, this ID is the
38 // offline ID.
39 extern const char kOfflinePageHeaderIDKey[];
29 40
30 // A request job that serves content from offline file. 41 // A request job that serves content from offline file.
31 class OfflinePageRequestJob : public net::URLRequestFileJob { 42 class OfflinePageRequestJob : public net::URLRequestFileJob {
32 public: 43 public:
33 // This enum is used for UMA reporting. It contains all possible outcomes of 44 // This enum is used for UMA reporting. It contains all possible outcomes of
34 // handling requests that might service offline page in different network 45 // handling requests that might service offline page in different network
35 // conditions. Generally one of these outcomes will happen. 46 // conditions. Generally one of these outcomes will happen.
36 // The fringe errors (like no OfflinePageModel, etc.) are not reported due 47 // The fringe errors (like no OfflinePageModel, etc.) are not reported due
37 // to their low probability. 48 // to their low probability.
38 // NOTE: because this is used for UMA reporting, these values should not be 49 // NOTE: because this is used for UMA reporting, these values should not be
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 std::unique_ptr<Delegate> delegate_; 116 std::unique_ptr<Delegate> delegate_;
106 117
107 base::WeakPtrFactory<OfflinePageRequestJob> weak_ptr_factory_; 118 base::WeakPtrFactory<OfflinePageRequestJob> weak_ptr_factory_;
108 119
109 DISALLOW_COPY_AND_ASSIGN(OfflinePageRequestJob); 120 DISALLOW_COPY_AND_ASSIGN(OfflinePageRequestJob);
110 }; 121 };
111 122
112 } // namespace offline_pages 123 } // namespace offline_pages
113 124
114 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_REQUEST_JOB_H_ 125 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_REQUEST_JOB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698