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