| 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 "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 | |
| 20 // regardless current network conditions. Its value is a comma/space separated | |
| 21 // name-value pair that may provide reason or define custom behavior. | |
| 22 extern const char kOfflinePageHeader[]; | |
| 23 // The name used in name-value pair of kOfflinePageHeader to tell if the offline | |
| 24 // info in this header should be persisted across session restore. | |
| 25 extern const char kOfflinePageHeaderPersistKey[]; | |
| 26 // The name used in name-value pair of kOfflinePageHeader to denote the reason | |
| 27 // for loading offline page. | |
| 28 extern const char kOfflinePageHeaderReasonKey[]; | |
| 29 // Possible values in name-value pair that denote the reason for loading offline | |
| 30 // page. | |
| 31 extern const char kOfflinePageHeaderReasonValueDueToNetError[]; | |
| 32 extern const char kOfflinePageHeaderReasonValueFromDownload[]; | |
| 33 // The name used in name-value pair of kOfflinePageHeader to denote the offline | |
| 34 // ID of the offline page to load. | |
| 35 extern const char kOfflinePageHeaderIDKey[]; | |
| 36 | |
| 37 // A request job that serves content from offline file. | 19 // A request job that serves content from offline file. |
| 38 class OfflinePageRequestJob : public net::URLRequestFileJob { | 20 class OfflinePageRequestJob : public net::URLRequestFileJob { |
| 39 public: | 21 public: |
| 40 // This enum is used for UMA reporting. It contains all possible outcomes of | 22 // This enum is used for UMA reporting. It contains all possible outcomes of |
| 41 // handling requests that might service offline page in different network | 23 // handling requests that might service offline page in different network |
| 42 // conditions. Generally one of these outcomes will happen. | 24 // conditions. Generally one of these outcomes will happen. |
| 43 // The fringe errors (like no OfflinePageModel, etc.) are not reported due | 25 // The fringe errors (like no OfflinePageModel, etc.) are not reported due |
| 44 // to their low probability. | 26 // to their low probability. |
| 45 // NOTE: because this is used for UMA reporting, these values should not be | 27 // NOTE: because this is used for UMA reporting, these values should not be |
| 46 // changed or reused; new values should be ended immediately before the MAX | 28 // changed or reused; new values should be ended immediately before the MAX |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 std::unique_ptr<Delegate> delegate_; | 89 std::unique_ptr<Delegate> delegate_; |
| 108 | 90 |
| 109 base::WeakPtrFactory<OfflinePageRequestJob> weak_ptr_factory_; | 91 base::WeakPtrFactory<OfflinePageRequestJob> weak_ptr_factory_; |
| 110 | 92 |
| 111 DISALLOW_COPY_AND_ASSIGN(OfflinePageRequestJob); | 93 DISALLOW_COPY_AND_ASSIGN(OfflinePageRequestJob); |
| 112 }; | 94 }; |
| 113 | 95 |
| 114 } // namespace offline_pages | 96 } // namespace offline_pages |
| 115 | 97 |
| 116 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_REQUEST_JOB_H_ | 98 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_OFFLINE_PAGE_REQUEST_JOB_H_ |
| OLD | NEW |