| 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 #include "content/renderer/internal_document_state_data.h" | 5 #include "content/renderer/internal_document_state_data.h" |
| 6 | 6 |
| 7 #include "content/public/renderer/document_state.h" | 7 #include "content/public/renderer/document_state.h" |
| 8 #include "third_party/WebKit/public/web/WebDataSource.h" | 8 #include "third_party/WebKit/public/web/WebDataSource.h" |
| 9 | 9 |
| 10 namespace content { | 10 namespace content { |
| 11 | 11 |
| 12 namespace { | 12 namespace { |
| 13 | 13 |
| 14 // Key InternalDocumentStateData is stored under in DocumentState. | 14 // Key InternalDocumentStateData is stored under in DocumentState. |
| 15 const char kUserDataKey[] = "InternalDocumentStateData"; | 15 const char kUserDataKey[] = "InternalDocumentStateData"; |
| 16 | 16 |
| 17 } | 17 } |
| 18 | 18 |
| 19 InternalDocumentStateData::InternalDocumentStateData() | 19 InternalDocumentStateData::InternalDocumentStateData() |
| 20 : did_first_visually_non_empty_layout_(false), | 20 : did_first_visually_non_empty_layout_(false), |
| 21 did_first_visually_non_empty_paint_(false), | 21 did_first_visually_non_empty_paint_(false), |
| 22 http_status_code_(0), | 22 http_status_code_(0), |
| 23 use_error_page_(false), | 23 use_error_page_(false), |
| 24 is_overriding_user_agent_(false), | 24 is_overriding_user_agent_(false), |
| 25 must_reset_scroll_and_scale_state_(false), | 25 must_reset_scroll_and_scale_state_(false), |
| 26 cache_policy_override_set_(false), | 26 cache_policy_override_set_(false), |
| 27 cache_policy_override_(blink::WebURLRequest::UseProtocolCachePolicy), | 27 cache_policy_override_(blink::WebURLRequest::UseProtocolCachePolicy) { |
| 28 referrer_policy_set_(false), | |
| 29 referrer_policy_(blink::WebReferrerPolicyDefault) { | |
| 30 } | 28 } |
| 31 | 29 |
| 32 // static | 30 // static |
| 33 InternalDocumentStateData* InternalDocumentStateData::FromDataSource( | 31 InternalDocumentStateData* InternalDocumentStateData::FromDataSource( |
| 34 blink::WebDataSource* ds) { | 32 blink::WebDataSource* ds) { |
| 35 return FromDocumentState(static_cast<DocumentState*>(ds->extraData())); | 33 return FromDocumentState(static_cast<DocumentState*>(ds->extraData())); |
| 36 } | 34 } |
| 37 | 35 |
| 38 // static | 36 // static |
| 39 InternalDocumentStateData* InternalDocumentStateData::FromDocumentState( | 37 InternalDocumentStateData* InternalDocumentStateData::FromDocumentState( |
| 40 DocumentState* ds) { | 38 DocumentState* ds) { |
| 41 if (!ds) | 39 if (!ds) |
| 42 return NULL; | 40 return NULL; |
| 43 InternalDocumentStateData* data = static_cast<InternalDocumentStateData*>( | 41 InternalDocumentStateData* data = static_cast<InternalDocumentStateData*>( |
| 44 ds->GetUserData(&kUserDataKey)); | 42 ds->GetUserData(&kUserDataKey)); |
| 45 if (!data) { | 43 if (!data) { |
| 46 data = new InternalDocumentStateData; | 44 data = new InternalDocumentStateData; |
| 47 ds->SetUserData(&kUserDataKey, data); | 45 ds->SetUserData(&kUserDataKey, data); |
| 48 } | 46 } |
| 49 return data; | 47 return data; |
| 50 } | 48 } |
| 51 | 49 |
| 52 InternalDocumentStateData::~InternalDocumentStateData() { | 50 InternalDocumentStateData::~InternalDocumentStateData() { |
| 53 } | 51 } |
| 54 | 52 |
| 55 } // namespace content | 53 } // namespace content |
| OLD | NEW |