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 COMPONENTS_OFFLINE_PAGES_REQUEST_HEADER_OFFLINE_PAGE_HEADER_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_REQUEST_HEADER_OFFLINE_PAGE_HEADER_H_ |
6 #define COMPONENTS_OFFLINE_PAGES_REQUEST_HEADER_OFFLINE_PAGE_HEADER_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_CORE_REQUEST_HEADER_OFFLINE_PAGE_HEADER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 namespace offline_pages { | 10 namespace offline_pages { |
11 | 11 |
12 // Header that defines the custom behavior to load offline pages. Its value is a | 12 // Header that defines the custom behavior to load offline pages. Its value is a |
13 // comma/space separated name-value pair. | 13 // comma/space separated name-value pair. |
14 extern const char kOfflinePageHeader[]; | 14 extern const char kOfflinePageHeader[]; |
15 | 15 |
16 // The name used in name-value pair of kOfflinePageHeader to tell if the offline | 16 // The name used in name-value pair of kOfflinePageHeader to tell if the offline |
(...skipping 17 matching lines...) Expand all Loading... |
34 extern const char kOfflinePageHeaderReasonValueReload[]; | 34 extern const char kOfflinePageHeaderReasonValueReload[]; |
35 | 35 |
36 // The name used in name-value pair of kOfflinePageHeader to denote the offline | 36 // The name used in name-value pair of kOfflinePageHeader to denote the offline |
37 // ID of the offline page to load. | 37 // ID of the offline page to load. |
38 extern const char kOfflinePageHeaderIDKey[]; | 38 extern const char kOfflinePageHeaderIDKey[]; |
39 | 39 |
40 // Used to parse the extra request header string that defines offline page | 40 // Used to parse the extra request header string that defines offline page |
41 // loading behaviors. | 41 // loading behaviors. |
42 struct OfflinePageHeader { | 42 struct OfflinePageHeader { |
43 public: | 43 public: |
44 enum class Reason { | 44 enum class Reason { NONE, NET_ERROR, DOWNLOAD, RELOAD }; |
45 NONE, | |
46 NET_ERROR, | |
47 DOWNLOAD, | |
48 RELOAD | |
49 }; | |
50 | 45 |
51 OfflinePageHeader(); | 46 OfflinePageHeader(); |
52 | 47 |
53 // Constructed from a request header value string. | 48 // Constructed from a request header value string. |
54 // The struct members will be cleared if the parsing failed. | 49 // The struct members will be cleared if the parsing failed. |
55 explicit OfflinePageHeader(const std::string& header_value); | 50 explicit OfflinePageHeader(const std::string& header_value); |
56 | 51 |
57 ~OfflinePageHeader(); | 52 ~OfflinePageHeader(); |
58 | 53 |
59 // Returns the full header string, including both key and value, that could be | 54 // Returns the full header string, including both key and value, that could be |
(...skipping 10 matching lines...) Expand all Loading... |
70 | 65 |
71 // Describes the reason to load offline page. | 66 // Describes the reason to load offline page. |
72 Reason reason; | 67 Reason reason; |
73 | 68 |
74 // The offline ID of the page to load. | 69 // The offline ID of the page to load. |
75 std::string id; | 70 std::string id; |
76 }; | 71 }; |
77 | 72 |
78 } // namespace offline_pages | 73 } // namespace offline_pages |
79 | 74 |
80 #endif // COMPONENTS_OFFLINE_PAGES_REQUEST_HEADER_OFFLINE_PAGE_HEADER_H_ | 75 #endif // COMPONENTS_OFFLINE_PAGES_CORE_REQUEST_HEADER_OFFLINE_PAGE_HEADER_H_ |
OLD | NEW |