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

Side by Side Diff: third_party/WebKit/Source/platform/mhtml/MHTMLArchive.cpp

Issue 2002433002: Handle online and offline redirects via interceptor and offline scheme (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 5 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
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 } 62 }
63 return stringBuilder.toString(); 63 return stringBuilder.toString();
64 } 64 }
65 65
66 MHTMLArchive::MHTMLArchive() 66 MHTMLArchive::MHTMLArchive()
67 { 67 {
68 } 68 }
69 69
70 MHTMLArchive* MHTMLArchive::create(const KURL& url, SharedBuffer* data) 70 MHTMLArchive* MHTMLArchive::create(const KURL& url, SharedBuffer* data)
71 { 71 {
72 // For security reasons we only load MHTML pages from local URLs. 72 // For security reasons we only load MHTML pages from local URLs or offline resource.
73 if (!SchemeRegistry::shouldTreatURLSchemeAsLocal(url.protocol())) 73 if (!SchemeRegistry::shouldTreatURLSchemeAsLocal(url.protocol()) && url.prot ocol() != "offline")
74 return nullptr; 74 return nullptr;
75 75
76 MHTMLParser parser(data); 76 MHTMLParser parser(data);
77 HeapVector<Member<ArchiveResource>> resources = parser.parseArchive(); 77 HeapVector<Member<ArchiveResource>> resources = parser.parseArchive();
78 if (resources.isEmpty()) 78 if (resources.isEmpty())
79 return nullptr; // Invalid MHTML file. 79 return nullptr; // Invalid MHTML file.
80 80
81 MHTMLArchive* archive = new MHTMLArchive; 81 MHTMLArchive* archive = new MHTMLArchive;
82 // The first document suitable resource is the main resource of the top fram e. 82 // The first document suitable resource is the main resource of the top fram e.
83 for (size_t i = 0; i < resources.size(); ++i) { 83 for (size_t i = 0; i < resources.size(); ++i) {
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 return m_subresources.get(url.getString()); 237 return m_subresources.get(url.getString());
238 } 238 }
239 239
240 DEFINE_TRACE(MHTMLArchive) 240 DEFINE_TRACE(MHTMLArchive)
241 { 241 {
242 visitor->trace(m_mainResource); 242 visitor->trace(m_mainResource);
243 visitor->trace(m_subresources); 243 visitor->trace(m_subresources);
244 } 244 }
245 245
246 } // namespace blink 246 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698