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/public/renderer/history_item_serialization.h" | 5 #include "content/public/renderer/history_item_serialization.h" |
6 | 6 |
7 #include "content/common/page_state_serialization.h" | 7 #include "content/common/page_state_serialization.h" |
8 #include "content/public/common/page_state.h" | 8 #include "content/public/common/page_state.h" |
9 #include "third_party/WebKit/public/platform/WebHTTPBody.h" | 9 #include "third_party/WebKit/public/platform/WebHTTPBody.h" |
10 #include "third_party/WebKit/public/platform/WebPoint.h" | 10 #include "third_party/WebKit/public/platform/WebPoint.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 output->file_length = input.fileLength; | 41 output->file_length = input.fileLength; |
42 output->file_modification_time = input.modificationTime; | 42 output->file_modification_time = input.modificationTime; |
43 break; | 43 break; |
44 case WebHTTPBody::Element::TypeFileSystemURL: | 44 case WebHTTPBody::Element::TypeFileSystemURL: |
45 output->filesystem_url = input.fileSystemURL; | 45 output->filesystem_url = input.fileSystemURL; |
46 output->file_start = input.fileStart; | 46 output->file_start = input.fileStart; |
47 output->file_length = input.fileLength; | 47 output->file_length = input.fileLength; |
48 output->file_modification_time = input.modificationTime; | 48 output->file_modification_time = input.modificationTime; |
49 break; | 49 break; |
50 case WebHTTPBody::Element::TypeBlob: | 50 case WebHTTPBody::Element::TypeBlob: |
51 #ifdef USE_BLOB_UUIDS | |
52 output->blob_uuid = input.blobUUID.utf8(); | 51 output->blob_uuid = input.blobUUID.utf8(); |
53 #else | |
54 output->deprecated_blob_url = input.blobURL; | |
55 #endif | |
56 break; | 52 break; |
57 } | 53 } |
58 } | 54 } |
59 | 55 |
60 void AppendHTTPBodyElement(const ExplodedHttpBodyElement& element, | 56 void AppendHTTPBodyElement(const ExplodedHttpBodyElement& element, |
61 WebHTTPBody* http_body) { | 57 WebHTTPBody* http_body) { |
62 switch (element.type) { | 58 switch (element.type) { |
63 case WebHTTPBody::Element::TypeData: | 59 case WebHTTPBody::Element::TypeData: |
64 http_body->appendData(element.data); | 60 http_body->appendData(element.data); |
65 break; | 61 break; |
66 case WebHTTPBody::Element::TypeFile: | 62 case WebHTTPBody::Element::TypeFile: |
67 http_body->appendFileRange( | 63 http_body->appendFileRange( |
68 element.file_path, | 64 element.file_path, |
69 element.file_start, | 65 element.file_start, |
70 element.file_length, | 66 element.file_length, |
71 element.file_modification_time); | 67 element.file_modification_time); |
72 break; | 68 break; |
73 case WebHTTPBody::Element::TypeFileSystemURL: | 69 case WebHTTPBody::Element::TypeFileSystemURL: |
74 http_body->appendFileSystemURLRange( | 70 http_body->appendFileSystemURLRange( |
75 element.filesystem_url, | 71 element.filesystem_url, |
76 element.file_start, | 72 element.file_start, |
77 element.file_length, | 73 element.file_length, |
78 element.file_modification_time); | 74 element.file_modification_time); |
79 break; | 75 break; |
80 case WebHTTPBody::Element::TypeBlob: | 76 case WebHTTPBody::Element::TypeBlob: |
81 #ifdef USE_BLOB_UUIDS | |
82 http_body->appendBlob(WebString::fromUTF8(element.blob_uuid)); | 77 http_body->appendBlob(WebString::fromUTF8(element.blob_uuid)); |
83 #else | |
84 http_body->appendBlob(element.deprecated_blob_url); | |
85 #endif | |
86 break; | 78 break; |
87 } | 79 } |
88 } | 80 } |
89 | 81 |
90 bool RecursivelyGenerateFrameState(const WebHistoryItem& item, | 82 bool RecursivelyGenerateFrameState(const WebHistoryItem& item, |
91 ExplodedFrameState* state) { | 83 ExplodedFrameState* state) { |
92 state->url_string = item.urlString(); | 84 state->url_string = item.urlString(); |
93 state->original_url_string = item.originalURLString(); | 85 state->original_url_string = item.originalURLString(); |
94 state->referrer = item.referrer(); | 86 state->referrer = item.referrer(); |
95 state->target = item.target(); | 87 state->target = item.target(); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 | 184 |
193 WebHistoryItem item; | 185 WebHistoryItem item; |
194 item.initialize(); | 186 item.initialize(); |
195 if (!RecursivelyGenerateHistoryItem(state.top, &item)) | 187 if (!RecursivelyGenerateHistoryItem(state.top, &item)) |
196 return WebHistoryItem(); | 188 return WebHistoryItem(); |
197 | 189 |
198 return item; | 190 return item; |
199 } | 191 } |
200 | 192 |
201 } // namespace content | 193 } // namespace content |
OLD | NEW |