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

Side by Side Diff: content/renderer/internal_document_state_data.h

Issue 13722005: Moves fields only accessed from content::DocumentState to content::InternalDocumentStateData. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Style tweak Created 7 years, 8 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 | Annotate | Revision Log
OLDNEW
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>
9
10 #include "base/memory/scoped_ptr.h"
8 #include "base/supports_user_data.h" 11 #include "base/supports_user_data.h"
12 #include "googleurl/src/gurl.h"
13 #include "third_party/WebKit/Source/Platform/chromium/public/WebReferrerPolicy.h "
14 #include "third_party/WebKit/Source/Platform/chromium/public/WebURLRequest.h"
15
16 namespace webkit_glue {
17 class AltErrorPageResourceFetcher;
18 }
9 19
10 namespace WebKit { 20 namespace WebKit {
11 class WebDataSource; 21 class WebDataSource;
12 } 22 }
13 23
14 namespace content { 24 namespace content {
15 25
26 class DocumentState;
27
16 // Stores internal state per WebDataSource. 28 // Stores internal state per WebDataSource.
17 class InternalDocumentStateData : public base::SupportsUserData::Data { 29 class InternalDocumentStateData : public base::SupportsUserData::Data {
18 public: 30 public:
19 InternalDocumentStateData(); 31 InternalDocumentStateData();
20 32
21 static InternalDocumentStateData* FromDataSource(WebKit::WebDataSource* ds); 33 static InternalDocumentStateData* FromDataSource(WebKit::WebDataSource* ds);
34 static InternalDocumentStateData* FromDocumentState(DocumentState* ds);
22 35
23 // Set to true once RenderViewImpl::didFirstVisuallyNonEmptyLayout() is 36 // Set to true once RenderViewImpl::didFirstVisuallyNonEmptyLayout() is
24 // invoked. 37 // invoked.
25 bool did_first_visually_non_empty_layout() const { 38 bool did_first_visually_non_empty_layout() const {
26 return did_first_visually_non_empty_layout_; 39 return did_first_visually_non_empty_layout_;
27 } 40 }
28 void set_did_first_visually_non_empty_layout(bool value) { 41 void set_did_first_visually_non_empty_layout(bool value) {
29 did_first_visually_non_empty_layout_ = value; 42 did_first_visually_non_empty_layout_ = value;
30 } 43 }
31 44
32 // Set to true once RenderViewImpl::DidFlushPaint() is inovked after 45 // Set to true once RenderViewImpl::DidFlushPaint() is inovked after
33 // RenderViewImpl::didFirstVisuallyNonEmptyLayout(). In other words after the 46 // RenderViewImpl::didFirstVisuallyNonEmptyLayout(). In other words after the
34 // page has painted something. 47 // page has painted something.
35 bool did_first_visually_non_empty_paint() const { 48 bool did_first_visually_non_empty_paint() const {
36 return did_first_visually_non_empty_paint_; 49 return did_first_visually_non_empty_paint_;
37 } 50 }
38 void set_did_first_visually_non_empty_paint(bool value) { 51 void set_did_first_visually_non_empty_paint(bool value) {
39 did_first_visually_non_empty_paint_ = value; 52 did_first_visually_non_empty_paint_ = value;
40 } 53 }
41 54
55 int http_status_code() const { return http_status_code_; }
56 void set_http_status_code(int http_status_code) {
57 http_status_code_ = http_status_code;
58 }
59
60 const GURL& searchable_form_url() const { return searchable_form_url_; }
61 void set_searchable_form_url(const GURL& url) { searchable_form_url_ = url; }
62 const std::string& searchable_form_encoding() const {
63 return searchable_form_encoding_;
64 }
65 void set_searchable_form_encoding(const std::string& encoding) {
66 searchable_form_encoding_ = encoding;
67 }
68
69 // True if an error page should be used, if the http status code also
70 // indicates an error.
71 bool use_error_page() const { return use_error_page_; }
72 void set_use_error_page(bool use_error_page) {
73 use_error_page_ = use_error_page;
74 }
75
76 // True if the user agent was overridden for this page.
77 bool is_overriding_user_agent() const { return is_overriding_user_agent_; }
78 void set_is_overriding_user_agent(bool state) {
79 is_overriding_user_agent_ = state;
80 }
81
82 // True if we have to reset the scroll and scale state of the page
83 // after the provisional load has been committed.
84 bool must_reset_scroll_and_scale_state() const {
85 return must_reset_scroll_and_scale_state_;
86 }
87 void set_must_reset_scroll_and_scale_state(bool state) {
88 must_reset_scroll_and_scale_state_ = state;
89 }
90
91 // Sets the cache policy. The cache policy is only used if explicitly set and
92 // by default is not set. You can mark a NavigationState as not having a cache
93 // state by way of clear_cache_policy_override.
94 void set_cache_policy_override(
95 WebKit::WebURLRequest::CachePolicy cache_policy) {
96 cache_policy_override_ = cache_policy;
97 cache_policy_override_set_ = true;
98 }
99 WebKit::WebURLRequest::CachePolicy cache_policy_override() const {
100 return cache_policy_override_;
101 }
102 void clear_cache_policy_override() {
103 cache_policy_override_set_ = false;
104 cache_policy_override_ = WebKit::WebURLRequest::UseProtocolCachePolicy;
105 }
106 bool is_cache_policy_override_set() const {
107 return cache_policy_override_set_;
108 }
109
110 // Sets the referrer policy to use. This is only used for browser initiated
111 // navigations, otherwise, the referrer policy is defined by the frame's
112 // document.
113 WebKit::WebReferrerPolicy referrer_policy() const {
114 return referrer_policy_;
115 }
116 void set_referrer_policy(WebKit::WebReferrerPolicy referrer_policy) {
117 referrer_policy_ = referrer_policy;
118 referrer_policy_set_ = true;
119 }
120 void clear_referrer_policy() {
121 referrer_policy_ = WebKit::WebReferrerPolicyDefault;
122 referrer_policy_set_ = false;
123 }
124 bool is_referrer_policy_set() const { return referrer_policy_set_; }
125
126 webkit_glue::AltErrorPageResourceFetcher* alt_error_page_fetcher() const {
127 return alt_error_page_fetcher_.get();
128 }
129 void set_alt_error_page_fetcher(webkit_glue::AltErrorPageResourceFetcher* f);
130
42 protected: 131 protected:
43 virtual ~InternalDocumentStateData(); 132 virtual ~InternalDocumentStateData();
44 133
45 private: 134 private:
46 bool did_first_visually_non_empty_layout_; 135 bool did_first_visually_non_empty_layout_;
47 bool did_first_visually_non_empty_paint_; 136 bool did_first_visually_non_empty_paint_;
137 int http_status_code_;
138 GURL searchable_form_url_;
139 std::string searchable_form_encoding_;
140 bool use_error_page_;
141 bool is_overriding_user_agent_;
142 bool must_reset_scroll_and_scale_state_;
143 bool cache_policy_override_set_;
144 WebKit::WebURLRequest::CachePolicy cache_policy_override_;
145 bool referrer_policy_set_;
146 WebKit::WebReferrerPolicy referrer_policy_;
147 scoped_ptr<webkit_glue::AltErrorPageResourceFetcher> alt_error_page_fetcher_;
48 148
49 DISALLOW_COPY_AND_ASSIGN(InternalDocumentStateData); 149 DISALLOW_COPY_AND_ASSIGN(InternalDocumentStateData);
50 }; 150 };
51 151
52 } // namespace content 152 } // namespace content
53 153
54 #endif // CONTENT_RENDERER_INTERNAL_DOCUMENT_STATE_DATA_H_ 154 #endif // CONTENT_RENDERER_INTERNAL_DOCUMENT_STATE_DATA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698