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

Side by Side Diff: Source/core/loader/appcache/ApplicationCacheHost.cpp

Issue 161213003: Fix layering of ApplicationCacheHost (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: The real thing Created 6 years, 10 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 | Annotate | Revision Log
OLDNEW
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 13 matching lines...) Expand all
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "core/loader/appcache/ApplicationCacheHost.h" 32 #include "core/loader/appcache/ApplicationCacheHost.h"
33 33
34 #include "public/platform/WebURL.h"
35 #include "public/platform/WebURLError.h"
36 #include "public/platform/WebURLResponse.h"
37 #include "public/platform/WebVector.h"
38 #include "ApplicationCacheHostInternal.h"
39 #include "WebFrameImpl.h"
40 #include "bindings/v8/ExceptionStatePlaceholder.h" 34 #include "bindings/v8/ExceptionStatePlaceholder.h"
41 #include "core/events/ProgressEvent.h" 35 #include "core/events/ProgressEvent.h"
36 #include "core/frame/Frame.h"
37 #include "core/frame/Settings.h"
42 #include "core/inspector/InspectorApplicationCacheAgent.h" 38 #include "core/inspector/InspectorApplicationCacheAgent.h"
43 #include "core/inspector/InspectorInstrumentation.h" 39 #include "core/inspector/InspectorInstrumentation.h"
44 #include "core/loader/DocumentLoader.h" 40 #include "core/loader/DocumentLoader.h"
45 #include "core/loader/FrameLoader.h" 41 #include "core/loader/FrameLoader.h"
46 #include "core/loader/appcache/ApplicationCache.h" 42 #include "core/loader/appcache/ApplicationCache.h"
47 #include "core/frame/Frame.h" 43 #include "core/loader/appcache/ApplicationCacheHostInternal.h"
48 #include "core/page/Page.h" 44 #include "core/page/Page.h"
49 #include "core/frame/Settings.h"
50 #include "platform/exported/WrappedResourceRequest.h" 45 #include "platform/exported/WrappedResourceRequest.h"
51 #include "platform/exported/WrappedResourceResponse.h" 46 #include "platform/exported/WrappedResourceResponse.h"
52 #include "platform/weborigin/SecurityOrigin.h" 47 #include "platform/weborigin/SecurityOrigin.h"
48 #include "public/platform/WebURL.h"
49 #include "public/platform/WebURLError.h"
50 #include "public/platform/WebURLResponse.h"
51 #include "public/platform/WebVector.h"
53 52
54 using namespace blink; 53 using namespace blink;
55 54
56 namespace WebCore { 55 namespace WebCore {
57 56
58 // We provide a custom implementation of this class that calls out to the 57 // We provide a custom implementation of this class that calls out to the
59 // embedding application instead of using WebCore's built in appcache system. 58 // embedding application instead of using WebCore's built in appcache system.
60 // This file replaces webcore/appcache/ApplicationCacheHost.cpp in our build. 59 // This file replaces webcore/appcache/ApplicationCacheHost.cpp in our build.
61 60
62 ApplicationCacheHost::ApplicationCacheHost(DocumentLoader* documentLoader) 61 ApplicationCacheHost::ApplicationCacheHost(DocumentLoader* documentLoader)
(...skipping 13 matching lines...) Expand all
76 // We defer creating the outer host object to avoid spurious creation/destru ction 75 // We defer creating the outer host object to avoid spurious creation/destru ction
77 // around creating empty documents. At this point, we're initiating a main r esource 76 // around creating empty documents. At this point, we're initiating a main r esource
78 // load for the document, so its for real. 77 // load for the document, so its for real.
79 78
80 if (!isApplicationCacheEnabled()) 79 if (!isApplicationCacheEnabled())
81 return; 80 return;
82 81
83 m_internal = adoptPtr(new ApplicationCacheHostInternal(this)); 82 m_internal = adoptPtr(new ApplicationCacheHostInternal(this));
84 if (m_internal->m_outerHost) { 83 if (m_internal->m_outerHost) {
85 WrappedResourceRequest wrapped(request); 84 WrappedResourceRequest wrapped(request);
86 m_internal->m_outerHost->willStartMainResourceRequest(wrapped, WebFrameI mpl::fromFrame(m_documentLoader->frame())); 85
87 } else 86 const WebApplicationCacheHost* spawningHost = 0;
87 if (Frame* frame = m_documentLoader->frame()) {
88 Frame* spawningFrame = frame->tree().parent();
89 if (!spawningFrame)
90 spawningFrame = frame->loader().opener();
91 if (!spawningFrame)
92 spawningFrame = frame;
93 if (DocumentLoader* spawningDocLoader = spawningFrame->loader().docu mentLoader())
94 spawningHost = ApplicationCacheHostInternal::toWebApplicationCac heHost(spawningDocLoader->applicationCacheHost());
95 }
96
97 m_internal->m_outerHost->willStartMainResourceRequest(wrapped, spawningH ost);
98 } else {
88 m_internal.clear(); 99 m_internal.clear();
100 }
89 101
90 // NOTE: The semantics of this method, and others in this interface, are sub tly different 102 // NOTE: The semantics of this method, and others in this interface, are sub tly different
91 // than the method names would suggest. For example, in this method never re turns an appcached 103 // than the method names would suggest. For example, in this method never re turns an appcached
92 // response in the SubstituteData out argument, instead we return the appcac hed response thru 104 // response in the SubstituteData out argument, instead we return the appcac hed response thru
93 // the usual resource loading pipeline. 105 // the usual resource loading pipeline.
94 } 106 }
95 107
96 void ApplicationCacheHost::selectCacheWithoutManifest() 108 void ApplicationCacheHost::selectCacheWithoutManifest()
97 { 109 {
98 if (m_internal) 110 if (m_internal)
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 249
238 void ApplicationCacheHost::abort() 250 void ApplicationCacheHost::abort()
239 { 251 {
240 if (m_internal) 252 if (m_internal)
241 m_internal->m_outerHost->abort(); 253 m_internal->m_outerHost->abort();
242 } 254 }
243 255
244 bool ApplicationCacheHost::isApplicationCacheEnabled() 256 bool ApplicationCacheHost::isApplicationCacheEnabled()
245 { 257 {
246 ASSERT(m_documentLoader->frame()); 258 ASSERT(m_documentLoader->frame());
247 return m_documentLoader->frame()->settings() 259 return m_documentLoader->frame()->settings() && m_documentLoader->frame()->s ettings()->offlineWebApplicationCacheEnabled();
248 && m_documentLoader->frame()->settings()->offlineWebApplicationCacheE nabled();
249 } 260 }
250 261
251 } // namespace WebCore 262 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/loader/FrameLoaderClient.h ('k') | Source/core/loader/appcache/ApplicationCacheHostInternal.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698