Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(522)

Side by Side Diff: third_party/WebKit/Source/core/frame/FrameSerializer.cpp

Issue 1977303003: Adds a feature to MHTML serialization that omits subframes and subresources marked no-store. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no-store
Patch Set: Address Łukasz comments. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 break; 379 break;
380 380
381 default: 381 default:
382 ASSERT_NOT_REACHED(); 382 ASSERT_NOT_REACHED();
383 } 383 }
384 } 384 }
385 385
386 bool FrameSerializer::shouldAddURL(const KURL& url) 386 bool FrameSerializer::shouldAddURL(const KURL& url)
387 { 387 {
388 return url.isValid() && !m_resourceURLs.contains(url) && !url.protocolIsData () 388 return url.isValid() && !m_resourceURLs.contains(url) && !url.protocolIsData ()
389 && !m_delegate.shouldSkipResource(url); 389 && !m_delegate.shouldSkipResourceWithURL(url);
390 } 390 }
391 391
392 void FrameSerializer::addToResources(Resource* resource, PassRefPtr<SharedBuffer > data, const KURL& url) 392 void FrameSerializer::addToResources(Resource* resource, PassRefPtr<SharedBuffer > data, const KURL& url)
Łukasz Anforowicz 2016/05/19 18:50:18 nit: I think that callers always guarantee that |r
dewittj 2016/05/19 19:44:55 Done.
393 { 393 {
394 if (m_delegate.shouldSkipResource(resource))
395 return;
396
394 if (!data) { 397 if (!data) {
395 DLOG(ERROR) << "No data for resource " << url.getString(); 398 DLOG(ERROR) << "No data for resource " << url.getString();
396 return; 399 return;
397 } 400 }
398 401
399 String mimeType = resource->response().mimeType(); 402 String mimeType = resource->response().mimeType();
400 m_resources->append(SerializedResource(url, mimeType, data)); 403 m_resources->append(SerializedResource(url, mimeType, data));
401 m_resourceURLs.add(url); 404 m_resourceURLs.add(url);
402 } 405 }
403 406
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 continue; 479 continue;
477 } 480 }
478 emitsMinus = ch == '-'; 481 emitsMinus = ch == '-';
479 builder.append(ch); 482 builder.append(ch);
480 } 483 }
481 CString escapedUrl = builder.toString().ascii(); 484 CString escapedUrl = builder.toString().ascii();
482 return String::format("saved from url=(%04d)%s", static_cast<int>(escapedUrl .length()), escapedUrl.data()); 485 return String::format("saved from url=(%04d)%s", static_cast<int>(escapedUrl .length()), escapedUrl.data());
483 } 486 }
484 487
485 } // namespace blink 488 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698