| 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/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/supports_user_data.h" | 11 #include "base/supports_user_data.h" |
| 12 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" | 12 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" |
| 13 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 13 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
| 14 #include "url/gurl.h" | 14 #include "url/gurl.h" |
| 15 | 15 |
| 16 namespace WebKit { | 16 namespace blink { |
| 17 class WebDataSource; | 17 class WebDataSource; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace content { | 20 namespace content { |
| 21 | 21 |
| 22 class AltErrorPageResourceFetcher; | 22 class AltErrorPageResourceFetcher; |
| 23 class DocumentState; | 23 class DocumentState; |
| 24 | 24 |
| 25 // Stores internal state per WebDataSource. | 25 // Stores internal state per WebDataSource. |
| 26 class InternalDocumentStateData : public base::SupportsUserData::Data { | 26 class InternalDocumentStateData : public base::SupportsUserData::Data { |
| 27 public: | 27 public: |
| 28 InternalDocumentStateData(); | 28 InternalDocumentStateData(); |
| 29 | 29 |
| 30 static InternalDocumentStateData* FromDataSource(WebKit::WebDataSource* ds); | 30 static InternalDocumentStateData* FromDataSource(blink::WebDataSource* ds); |
| 31 static InternalDocumentStateData* FromDocumentState(DocumentState* ds); | 31 static InternalDocumentStateData* FromDocumentState(DocumentState* ds); |
| 32 | 32 |
| 33 // Set to true once RenderViewImpl::didFirstVisuallyNonEmptyLayout() is | 33 // Set to true once RenderViewImpl::didFirstVisuallyNonEmptyLayout() is |
| 34 // invoked. | 34 // invoked. |
| 35 bool did_first_visually_non_empty_layout() const { | 35 bool did_first_visually_non_empty_layout() const { |
| 36 return did_first_visually_non_empty_layout_; | 36 return did_first_visually_non_empty_layout_; |
| 37 } | 37 } |
| 38 void set_did_first_visually_non_empty_layout(bool value) { | 38 void set_did_first_visually_non_empty_layout(bool value) { |
| 39 did_first_visually_non_empty_layout_ = value; | 39 did_first_visually_non_empty_layout_ = value; |
| 40 } | 40 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 return must_reset_scroll_and_scale_state_; | 82 return must_reset_scroll_and_scale_state_; |
| 83 } | 83 } |
| 84 void set_must_reset_scroll_and_scale_state(bool state) { | 84 void set_must_reset_scroll_and_scale_state(bool state) { |
| 85 must_reset_scroll_and_scale_state_ = state; | 85 must_reset_scroll_and_scale_state_ = state; |
| 86 } | 86 } |
| 87 | 87 |
| 88 // Sets the cache policy. The cache policy is only used if explicitly set and | 88 // Sets the cache policy. The cache policy is only used if explicitly set and |
| 89 // by default is not set. You can mark a NavigationState as not having a cache | 89 // by default is not set. You can mark a NavigationState as not having a cache |
| 90 // state by way of clear_cache_policy_override. | 90 // state by way of clear_cache_policy_override. |
| 91 void set_cache_policy_override( | 91 void set_cache_policy_override( |
| 92 WebKit::WebURLRequest::CachePolicy cache_policy) { | 92 blink::WebURLRequest::CachePolicy cache_policy) { |
| 93 cache_policy_override_ = cache_policy; | 93 cache_policy_override_ = cache_policy; |
| 94 cache_policy_override_set_ = true; | 94 cache_policy_override_set_ = true; |
| 95 } | 95 } |
| 96 WebKit::WebURLRequest::CachePolicy cache_policy_override() const { | 96 blink::WebURLRequest::CachePolicy cache_policy_override() const { |
| 97 return cache_policy_override_; | 97 return cache_policy_override_; |
| 98 } | 98 } |
| 99 void clear_cache_policy_override() { | 99 void clear_cache_policy_override() { |
| 100 cache_policy_override_set_ = false; | 100 cache_policy_override_set_ = false; |
| 101 cache_policy_override_ = WebKit::WebURLRequest::UseProtocolCachePolicy; | 101 cache_policy_override_ = blink::WebURLRequest::UseProtocolCachePolicy; |
| 102 } | 102 } |
| 103 bool is_cache_policy_override_set() const { | 103 bool is_cache_policy_override_set() const { |
| 104 return cache_policy_override_set_; | 104 return cache_policy_override_set_; |
| 105 } | 105 } |
| 106 | 106 |
| 107 // Sets the referrer policy to use. This is only used for browser initiated | 107 // Sets the referrer policy to use. This is only used for browser initiated |
| 108 // navigations, otherwise, the referrer policy is defined by the frame's | 108 // navigations, otherwise, the referrer policy is defined by the frame's |
| 109 // document. | 109 // document. |
| 110 WebKit::WebReferrerPolicy referrer_policy() const { | 110 blink::WebReferrerPolicy referrer_policy() const { |
| 111 return referrer_policy_; | 111 return referrer_policy_; |
| 112 } | 112 } |
| 113 void set_referrer_policy(WebKit::WebReferrerPolicy referrer_policy) { | 113 void set_referrer_policy(blink::WebReferrerPolicy referrer_policy) { |
| 114 referrer_policy_ = referrer_policy; | 114 referrer_policy_ = referrer_policy; |
| 115 referrer_policy_set_ = true; | 115 referrer_policy_set_ = true; |
| 116 } | 116 } |
| 117 void clear_referrer_policy() { | 117 void clear_referrer_policy() { |
| 118 referrer_policy_ = WebKit::WebReferrerPolicyDefault; | 118 referrer_policy_ = blink::WebReferrerPolicyDefault; |
| 119 referrer_policy_set_ = false; | 119 referrer_policy_set_ = false; |
| 120 } | 120 } |
| 121 bool is_referrer_policy_set() const { return referrer_policy_set_; } | 121 bool is_referrer_policy_set() const { return referrer_policy_set_; } |
| 122 | 122 |
| 123 AltErrorPageResourceFetcher* alt_error_page_fetcher() const { | 123 AltErrorPageResourceFetcher* alt_error_page_fetcher() const { |
| 124 return alt_error_page_fetcher_.get(); | 124 return alt_error_page_fetcher_.get(); |
| 125 } | 125 } |
| 126 void set_alt_error_page_fetcher(AltErrorPageResourceFetcher* f); | 126 void set_alt_error_page_fetcher(AltErrorPageResourceFetcher* f); |
| 127 | 127 |
| 128 protected: | 128 protected: |
| 129 virtual ~InternalDocumentStateData(); | 129 virtual ~InternalDocumentStateData(); |
| 130 | 130 |
| 131 private: | 131 private: |
| 132 bool did_first_visually_non_empty_layout_; | 132 bool did_first_visually_non_empty_layout_; |
| 133 bool did_first_visually_non_empty_paint_; | 133 bool did_first_visually_non_empty_paint_; |
| 134 int http_status_code_; | 134 int http_status_code_; |
| 135 GURL searchable_form_url_; | 135 GURL searchable_form_url_; |
| 136 std::string searchable_form_encoding_; | 136 std::string searchable_form_encoding_; |
| 137 bool use_error_page_; | 137 bool use_error_page_; |
| 138 bool is_overriding_user_agent_; | 138 bool is_overriding_user_agent_; |
| 139 bool must_reset_scroll_and_scale_state_; | 139 bool must_reset_scroll_and_scale_state_; |
| 140 bool cache_policy_override_set_; | 140 bool cache_policy_override_set_; |
| 141 WebKit::WebURLRequest::CachePolicy cache_policy_override_; | 141 blink::WebURLRequest::CachePolicy cache_policy_override_; |
| 142 bool referrer_policy_set_; | 142 bool referrer_policy_set_; |
| 143 WebKit::WebReferrerPolicy referrer_policy_; | 143 blink::WebReferrerPolicy referrer_policy_; |
| 144 scoped_ptr<AltErrorPageResourceFetcher> alt_error_page_fetcher_; | 144 scoped_ptr<AltErrorPageResourceFetcher> alt_error_page_fetcher_; |
| 145 | 145 |
| 146 DISALLOW_COPY_AND_ASSIGN(InternalDocumentStateData); | 146 DISALLOW_COPY_AND_ASSIGN(InternalDocumentStateData); |
| 147 }; | 147 }; |
| 148 | 148 |
| 149 } // namespace content | 149 } // namespace content |
| 150 | 150 |
| 151 #endif // CONTENT_RENDERER_INTERNAL_DOCUMENT_STATE_DATA_H_ | 151 #endif // CONTENT_RENDERER_INTERNAL_DOCUMENT_STATE_DATA_H_ |
| OLD | NEW |