| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 WebFrameSerializerCacheControlPolicy::kFailForNoStoreMainFrame); | 339 WebFrameSerializerCacheControlPolicy::kFailForNoStoreMainFrame); |
| 340 | 340 |
| 341 if (!need_to_check_no_store) | 341 if (!need_to_check_no_store) |
| 342 return true; | 342 return true; |
| 343 | 343 |
| 344 return !CacheControlNoStoreHeaderPresent(*web_local_frame_impl); | 344 return !CacheControlNoStoreHeaderPresent(*web_local_frame_impl); |
| 345 } | 345 } |
| 346 | 346 |
| 347 } // namespace | 347 } // namespace |
| 348 | 348 |
| 349 WebThreadSafeData WebFrameSerializer::GenerateMHTMLHeader( | |
| 350 const WebString& boundary, | |
| 351 WebLocalFrame* frame, | |
| 352 MHTMLPartsGenerationDelegate* delegate) { | |
| 353 TRACE_EVENT0("page-serialization", "WebFrameSerializer::generateMHTMLHeader"); | |
| 354 DCHECK(frame); | |
| 355 DCHECK(delegate); | |
| 356 | |
| 357 if (!FrameShouldBeSerializedAsMHTML(frame, delegate->CacheControlPolicy())) | |
| 358 return WebThreadSafeData(); | |
| 359 | |
| 360 WebLocalFrameImpl* web_local_frame_impl = ToWebLocalFrameImpl(frame); | |
| 361 DCHECK(web_local_frame_impl); | |
| 362 | |
| 363 Document* document = web_local_frame_impl->GetFrame()->GetDocument(); | |
| 364 | |
| 365 RefPtr<RawData> buffer = RawData::Create(); | |
| 366 MHTMLArchive::GenerateMHTMLHeader(boundary, document->title(), | |
| 367 document->SuggestedMIMEType(), | |
| 368 *buffer->MutableData()); | |
| 369 return buffer.Release(); | |
| 370 } | |
| 371 | |
| 372 WebThreadSafeData WebFrameSerializer::GenerateMHTMLParts( | 349 WebThreadSafeData WebFrameSerializer::GenerateMHTMLParts( |
| 373 const WebString& boundary, | 350 const WebString& boundary, |
| 374 WebLocalFrame* web_frame, | 351 WebLocalFrame* web_frame, |
| 375 MHTMLPartsGenerationDelegate* web_delegate) { | 352 MHTMLPartsGenerationDelegate* web_delegate) { |
| 376 TRACE_EVENT0("page-serialization", "WebFrameSerializer::generateMHTMLParts"); | 353 TRACE_EVENT0("page-serialization", "WebFrameSerializer::generateMHTMLParts"); |
| 377 DCHECK(web_frame); | 354 DCHECK(web_frame); |
| 378 DCHECK(web_delegate); | 355 DCHECK(web_delegate); |
| 379 | 356 |
| 380 if (!FrameShouldBeSerializedAsMHTML(web_frame, | 357 if (!FrameShouldBeSerializedAsMHTML(web_frame, |
| 381 web_delegate->CacheControlPolicy())) | 358 web_delegate->CacheControlPolicy())) |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 const WebString& base_target) { | 437 const WebString& base_target) { |
| 461 // TODO(yosin) We should call |FrameSerializer::baseTagDeclarationOf()|. | 438 // TODO(yosin) We should call |FrameSerializer::baseTagDeclarationOf()|. |
| 462 if (base_target.IsEmpty()) | 439 if (base_target.IsEmpty()) |
| 463 return String("<base href=\".\">"); | 440 return String("<base href=\".\">"); |
| 464 String base_string = "<base href=\".\" target=\"" + | 441 String base_string = "<base href=\".\" target=\"" + |
| 465 static_cast<const String&>(base_target) + "\">"; | 442 static_cast<const String&>(base_target) + "\">"; |
| 466 return base_string; | 443 return base_string; |
| 467 } | 444 } |
| 468 | 445 |
| 469 } // namespace blink | 446 } // namespace blink |
| OLD | NEW |