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