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
3 // found in the LICENSE file.
5 #include "content/renderer/internal_document_state_data.h"
7 #include "content/public/renderer/document_state.h"
8 #include "content/renderer/fetchers/alt_error_page_resource_fetcher.h"
9 #include "third_party/WebKit/public/web/WebDataSource.h"
15 // Key InternalDocumentStateData is stored under in DocumentState.
16 const char kUserDataKey
[] = "InternalDocumentStateData";
20 InternalDocumentStateData::InternalDocumentStateData()
21 : did_first_visually_non_empty_layout_(false),
22 did_first_visually_non_empty_paint_(false),
24 use_error_page_(false),
25 is_overriding_user_agent_(false),
26 must_reset_scroll_and_scale_state_(false),
27 cache_policy_override_set_(false),
28 cache_policy_override_(WebKit::WebURLRequest::UseProtocolCachePolicy
),
29 referrer_policy_set_(false),
30 referrer_policy_(WebKit::WebReferrerPolicyDefault
) {
34 InternalDocumentStateData
* InternalDocumentStateData::FromDataSource(
35 WebKit::WebDataSource
* ds
) {
36 return FromDocumentState(static_cast<DocumentState
*>(ds
->extraData()));
40 InternalDocumentStateData
* InternalDocumentStateData::FromDocumentState(
44 InternalDocumentStateData
* data
= static_cast<InternalDocumentStateData
*>(
45 ds
->GetUserData(&kUserDataKey
));
47 data
= new InternalDocumentStateData
;
48 ds
->SetUserData(&kUserDataKey
, data
);
53 InternalDocumentStateData::~InternalDocumentStateData() {
56 void InternalDocumentStateData::set_alt_error_page_fetcher(
57 AltErrorPageResourceFetcher
* f
) {
58 alt_error_page_fetcher_
.reset(f
);
61 } // namespace content