| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PUBLIC_RENDERER_DOCUMENT_STATE_H_ | 5 #ifndef CONTENT_PUBLIC_RENDERER_DOCUMENT_STATE_H_ |
| 6 #define CONTENT_PUBLIC_RENDERER_DOCUMENT_STATE_H_ | 6 #define CONTENT_PUBLIC_RENDERER_DOCUMENT_STATE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.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 "base/time/time.h" | 13 #include "base/time/time.h" |
| 14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
| 15 #include "net/http/http_response_info.h" | 15 #include "net/http/http_response_info.h" |
| 16 #include "third_party/WebKit/public/web/WebDataSource.h" | 16 #include "third_party/WebKit/public/web/WebDataSource.h" |
| 17 | 17 |
| 18 namespace content { | 18 namespace content { |
| 19 | 19 |
| 20 class NavigationState; | 20 class NavigationState; |
| 21 struct PasswordForm; | |
| 22 | 21 |
| 23 // The RenderView stores an instance of this class in the "extra data" of each | 22 // The RenderView stores an instance of this class in the "extra data" of each |
| 24 // WebDataSource (see RenderView::DidCreateDataSource). | 23 // WebDataSource (see RenderView::DidCreateDataSource). |
| 25 class CONTENT_EXPORT DocumentState | 24 class CONTENT_EXPORT DocumentState |
| 26 : NON_EXPORTED_BASE(public WebKit::WebDataSource::ExtraData), | 25 : NON_EXPORTED_BASE(public WebKit::WebDataSource::ExtraData), |
| 27 public base::SupportsUserData { | 26 public base::SupportsUserData { |
| 28 public: | 27 public: |
| 29 // The exact values of this enum are used in histograms, so new values must be | 28 // The exact values of this enum are used in histograms, so new values must be |
| 30 // added to the end. | 29 // added to the end. |
| 31 enum LoadType { | 30 enum LoadType { |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 void set_connection_info( | 154 void set_connection_info( |
| 156 net::HttpResponseInfo::ConnectionInfo connection_info) { | 155 net::HttpResponseInfo::ConnectionInfo connection_info) { |
| 157 connection_info_ = connection_info; | 156 connection_info_ = connection_info; |
| 158 } | 157 } |
| 159 | 158 |
| 160 bool was_fetched_via_proxy() const { return was_fetched_via_proxy_; } | 159 bool was_fetched_via_proxy() const { return was_fetched_via_proxy_; } |
| 161 void set_was_fetched_via_proxy(bool value) { | 160 void set_was_fetched_via_proxy(bool value) { |
| 162 was_fetched_via_proxy_ = value; | 161 was_fetched_via_proxy_ = value; |
| 163 } | 162 } |
| 164 | 163 |
| 165 // If set, contains the PasswordForm that we believe triggered the current | |
| 166 // navigation (there is some ambiguity in the case of javascript initiated | |
| 167 // navigations). This information is used by the PasswordManager to determine | |
| 168 // if the user should be prompted to save their password. | |
| 169 // | |
| 170 // Note that setting this field doesn't affect where the data is sent or what | |
| 171 // origin we associate it with, only whether we prompt the user to save it. | |
| 172 // That is, a false positive is a usability issue (e.g. may try to save a | |
| 173 // mis-typed password) not a security issue. | |
| 174 PasswordForm* password_form_data() const { | |
| 175 return password_form_data_.get(); | |
| 176 } | |
| 177 void set_password_form_data(scoped_ptr<PasswordForm> data); | |
| 178 | |
| 179 void set_was_prefetcher(bool value) { was_prefetcher_ = value; } | 164 void set_was_prefetcher(bool value) { was_prefetcher_ = value; } |
| 180 bool was_prefetcher() const { return was_prefetcher_; } | 165 bool was_prefetcher() const { return was_prefetcher_; } |
| 181 | 166 |
| 182 void set_was_referred_by_prefetcher(bool value) { | 167 void set_was_referred_by_prefetcher(bool value) { |
| 183 was_referred_by_prefetcher_ = value; | 168 was_referred_by_prefetcher_ = value; |
| 184 } | 169 } |
| 185 bool was_referred_by_prefetcher() const { | 170 bool was_referred_by_prefetcher() const { |
| 186 return was_referred_by_prefetcher_; | 171 return was_referred_by_prefetcher_; |
| 187 } | 172 } |
| 188 | 173 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 208 base::Time first_paint_after_load_time_; | 193 base::Time first_paint_after_load_time_; |
| 209 bool load_histograms_recorded_; | 194 bool load_histograms_recorded_; |
| 210 bool web_timing_histograms_recorded_; | 195 bool web_timing_histograms_recorded_; |
| 211 bool was_fetched_via_spdy_; | 196 bool was_fetched_via_spdy_; |
| 212 bool was_npn_negotiated_; | 197 bool was_npn_negotiated_; |
| 213 std::string npn_negotiated_protocol_; | 198 std::string npn_negotiated_protocol_; |
| 214 bool was_alternate_protocol_available_; | 199 bool was_alternate_protocol_available_; |
| 215 net::HttpResponseInfo::ConnectionInfo connection_info_; | 200 net::HttpResponseInfo::ConnectionInfo connection_info_; |
| 216 bool was_fetched_via_proxy_; | 201 bool was_fetched_via_proxy_; |
| 217 | 202 |
| 218 scoped_ptr<PasswordForm> password_form_data_; | |
| 219 | |
| 220 // A prefetcher is a page that contains link rel=prefetch elements. | 203 // A prefetcher is a page that contains link rel=prefetch elements. |
| 221 bool was_prefetcher_; | 204 bool was_prefetcher_; |
| 222 bool was_referred_by_prefetcher_; | 205 bool was_referred_by_prefetcher_; |
| 223 | 206 |
| 224 LoadType load_type_; | 207 LoadType load_type_; |
| 225 | 208 |
| 226 scoped_ptr<NavigationState> navigation_state_; | 209 scoped_ptr<NavigationState> navigation_state_; |
| 227 | 210 |
| 228 bool can_load_local_resources_; | 211 bool can_load_local_resources_; |
| 229 }; | 212 }; |
| 230 | 213 |
| 231 #endif // CONTENT_PUBLIC_RENDERER_DOCUMENT_STATE_H_ | 214 #endif // CONTENT_PUBLIC_RENDERER_DOCUMENT_STATE_H_ |
| 232 | 215 |
| 233 } // namespace content | 216 } // namespace content |
| OLD | NEW |