OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 CONTENT_RENDERER_INTERNAL_DOCUMENT_STATE_DATA_H_ | 5 #ifndef CONTENT_RENDERER_INTERNAL_DOCUMENT_STATE_DATA_H_ |
6 #define CONTENT_RENDERER_INTERNAL_DOCUMENT_STATE_DATA_H_ | 6 #define CONTENT_RENDERER_INTERNAL_DOCUMENT_STATE_DATA_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/supports_user_data.h" | 12 #include "base/supports_user_data.h" |
13 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 13 #include "third_party/WebKit/public/platform/WebCachePolicy.h" |
14 #include "url/gurl.h" | 14 #include "url/gurl.h" |
15 | 15 |
16 namespace blink { | 16 namespace blink { |
17 class WebDataSource; | 17 class WebDataSource; |
| 18 enum class WebCachePolicy; |
18 } | 19 } |
19 | 20 |
20 namespace content { | 21 namespace content { |
21 | 22 |
22 class DocumentState; | 23 class DocumentState; |
23 | 24 |
24 // Stores internal state per WebDataSource. | 25 // Stores internal state per WebDataSource. |
25 class InternalDocumentStateData : public base::SupportsUserData::Data { | 26 class InternalDocumentStateData : public base::SupportsUserData::Data { |
26 public: | 27 public: |
27 InternalDocumentStateData(); | 28 InternalDocumentStateData(); |
(...skipping 26 matching lines...) Expand all Loading... |
54 bool must_reset_scroll_and_scale_state() const { | 55 bool must_reset_scroll_and_scale_state() const { |
55 return must_reset_scroll_and_scale_state_; | 56 return must_reset_scroll_and_scale_state_; |
56 } | 57 } |
57 void set_must_reset_scroll_and_scale_state(bool state) { | 58 void set_must_reset_scroll_and_scale_state(bool state) { |
58 must_reset_scroll_and_scale_state_ = state; | 59 must_reset_scroll_and_scale_state_ = state; |
59 } | 60 } |
60 | 61 |
61 // Sets the cache policy. The cache policy is only used if explicitly set and | 62 // Sets the cache policy. The cache policy is only used if explicitly set and |
62 // by default is not set. You can mark a NavigationState as not having a cache | 63 // by default is not set. You can mark a NavigationState as not having a cache |
63 // state by way of clear_cache_policy_override. | 64 // state by way of clear_cache_policy_override. |
64 void set_cache_policy_override( | 65 void set_cache_policy_override(blink::WebCachePolicy cache_policy) { |
65 blink::WebURLRequest::CachePolicy cache_policy) { | |
66 cache_policy_override_ = cache_policy; | 66 cache_policy_override_ = cache_policy; |
67 cache_policy_override_set_ = true; | 67 cache_policy_override_set_ = true; |
68 } | 68 } |
69 blink::WebURLRequest::CachePolicy cache_policy_override() const { | 69 blink::WebCachePolicy cache_policy_override() const { |
70 return cache_policy_override_; | 70 return cache_policy_override_; |
71 } | 71 } |
72 void clear_cache_policy_override() { | 72 void clear_cache_policy_override() { |
73 cache_policy_override_set_ = false; | 73 cache_policy_override_set_ = false; |
74 cache_policy_override_ = blink::WebURLRequest::UseProtocolCachePolicy; | 74 cache_policy_override_ = blink::WebCachePolicy::UseProtocolCachePolicy; |
75 } | 75 } |
76 bool is_cache_policy_override_set() const { | 76 bool is_cache_policy_override_set() const { |
77 return cache_policy_override_set_; | 77 return cache_policy_override_set_; |
78 } | 78 } |
79 | 79 |
80 protected: | 80 protected: |
81 ~InternalDocumentStateData() override; | 81 ~InternalDocumentStateData() override; |
82 | 82 |
83 private: | 83 private: |
84 int http_status_code_; | 84 int http_status_code_; |
85 GURL searchable_form_url_; | 85 GURL searchable_form_url_; |
86 std::string searchable_form_encoding_; | 86 std::string searchable_form_encoding_; |
87 bool is_overriding_user_agent_; | 87 bool is_overriding_user_agent_; |
88 bool must_reset_scroll_and_scale_state_; | 88 bool must_reset_scroll_and_scale_state_; |
89 bool cache_policy_override_set_; | 89 bool cache_policy_override_set_; |
90 blink::WebURLRequest::CachePolicy cache_policy_override_; | 90 blink::WebCachePolicy cache_policy_override_; |
91 | 91 |
92 DISALLOW_COPY_AND_ASSIGN(InternalDocumentStateData); | 92 DISALLOW_COPY_AND_ASSIGN(InternalDocumentStateData); |
93 }; | 93 }; |
94 | 94 |
95 } // namespace content | 95 } // namespace content |
96 | 96 |
97 #endif // CONTENT_RENDERER_INTERNAL_DOCUMENT_STATE_DATA_H_ | 97 #endif // CONTENT_RENDERER_INTERNAL_DOCUMENT_STATE_DATA_H_ |
OLD | NEW |