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

Side by Side Diff: Source/core/fetch/ResourceFetcher.cpp

Issue 566533003: Mixed Content: Make MixedContentChecker completely static. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixing tests. Created 6 years, 3 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) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/ 6 Copyright (C) 2009 Torch Mobile Inc. http://www.torchmobile.com/
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 #include "core/fetch/ScriptResource.h" 44 #include "core/fetch/ScriptResource.h"
45 #include "core/fetch/XSLStyleSheetResource.h" 45 #include "core/fetch/XSLStyleSheetResource.h"
46 #include "core/html/HTMLElement.h" 46 #include "core/html/HTMLElement.h"
47 #include "core/html/HTMLFrameOwnerElement.h" 47 #include "core/html/HTMLFrameOwnerElement.h"
48 #include "core/html/imports/HTMLImportsController.h" 48 #include "core/html/imports/HTMLImportsController.h"
49 #include "core/inspector/ConsoleMessage.h" 49 #include "core/inspector/ConsoleMessage.h"
50 #include "core/inspector/InspectorInstrumentation.h" 50 #include "core/inspector/InspectorInstrumentation.h"
51 #include "core/loader/DocumentLoader.h" 51 #include "core/loader/DocumentLoader.h"
52 #include "core/loader/FrameLoader.h" 52 #include "core/loader/FrameLoader.h"
53 #include "core/loader/FrameLoaderClient.h" 53 #include "core/loader/FrameLoaderClient.h"
54 #include "core/loader/MixedContentChecker.h"
54 #include "core/loader/PingLoader.h" 55 #include "core/loader/PingLoader.h"
55 #include "core/loader/SubstituteData.h" 56 #include "core/loader/SubstituteData.h"
56 #include "core/loader/UniqueIdentifier.h" 57 #include "core/loader/UniqueIdentifier.h"
57 #include "core/loader/appcache/ApplicationCacheHost.h" 58 #include "core/loader/appcache/ApplicationCacheHost.h"
58 #include "core/frame/LocalDOMWindow.h" 59 #include "core/frame/LocalDOMWindow.h"
59 #include "core/frame/LocalFrame.h" 60 #include "core/frame/LocalFrame.h"
60 #include "core/frame/csp/ContentSecurityPolicy.h" 61 #include "core/frame/csp/ContentSecurityPolicy.h"
61 #include "core/timing/Performance.h" 62 #include "core/timing/Performance.h"
62 #include "core/timing/ResourceTimingInfo.h" 63 #include "core/timing/ResourceTimingInfo.h"
63 #include "core/frame/Settings.h" 64 #include "core/frame/Settings.h"
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 562
562 // If we're loading the main resource of a subframe, ensure that we check 563 // If we're loading the main resource of a subframe, ensure that we check
563 // against the parent of the active frame, rather than the frame itself. 564 // against the parent of the active frame, rather than the frame itself.
564 LocalFrame* effectiveFrame = frame(); 565 LocalFrame* effectiveFrame = frame();
565 if (resourceRequest.frameType() == WebURLRequest::FrameTypeNested) { 566 if (resourceRequest.frameType() == WebURLRequest::FrameTypeNested) {
566 // FIXME: Deal with RemoteFrames. 567 // FIXME: Deal with RemoteFrames.
567 if (frame()->tree().parent()->isLocalFrame()) 568 if (frame()->tree().parent()->isLocalFrame())
568 effectiveFrame = toLocalFrame(frame()->tree().parent()); 569 effectiveFrame = toLocalFrame(frame()->tree().parent());
569 } 570 }
570 571
571 return !MixedContentChecker::shouldBlockFetch(effectiveFrame, resourceReques t, url); 572 return !MixedContentChecker::shouldBlockFetch(effectiveFrame, resourceReques t.requestContext(), resourceRequest.frameType(), url);
572 } 573 }
573 574
574 bool ResourceFetcher::canAccessResource(Resource* resource, SecurityOrigin* sour ceOrigin, const KURL& url) const 575 bool ResourceFetcher::canAccessResource(Resource* resource, SecurityOrigin* sour ceOrigin, const KURL& url) const
575 { 576 {
576 // Redirects can change the response URL different from one of request. 577 // Redirects can change the response URL different from one of request.
577 if (!canRequest(resource->type(), resource->resourceRequest(), url, resource ->options(), resource->isUnusedPreload(), FetchRequest::UseDefaultOriginRestrict ionForType)) 578 if (!canRequest(resource->type(), resource->resourceRequest(), url, resource ->options(), resource->isUnusedPreload(), FetchRequest::UseDefaultOriginRestrict ionForType))
578 return false; 579 return false;
579 580
580 if (!sourceOrigin && document()) 581 if (!sourceOrigin && document())
581 sourceOrigin = document()->securityOrigin(); 582 sourceOrigin = document()->securityOrigin();
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 // Ensure main resources aren't preloaded, since the cache can't actually re use the preload. 1188 // Ensure main resources aren't preloaded, since the cache can't actually re use the preload.
1188 if (type == Resource::MainResource) 1189 if (type == Resource::MainResource)
1189 return; 1190 return;
1190 1191
1191 String encoding; 1192 String encoding;
1192 if (type == Resource::Script || type == Resource::CSSStyleSheet) 1193 if (type == Resource::Script || type == Resource::CSSStyleSheet)
1193 encoding = charset.isEmpty() ? m_document->charset().string() : charset; 1194 encoding = charset.isEmpty() ? m_document->charset().string() : charset;
1194 1195
1195 request.setCharset(encoding); 1196 request.setCharset(encoding);
1196 request.setForPreload(true); 1197 request.setForPreload(true);
1198 request.mutableResourceRequest().setRequestContext(WebURLRequest::RequestCon textPrefetch);
1197 1199
1198 ResourcePtr<Resource> resource; 1200 ResourcePtr<Resource> resource;
1199 // Loading images involves several special cases, so use dedicated fetch met hod instead. 1201 // Loading images involves several special cases, so use dedicated fetch met hod instead.
1200 if (type == Resource::Image) 1202 if (type == Resource::Image)
1201 resource = fetchImage(request); 1203 resource = fetchImage(request);
1202 if (!resource) 1204 if (!resource)
1203 resource = requestResource(type, request); 1205 resource = requestResource(type, request);
1204 if (!resource || (m_preloads && m_preloads->contains(resource.get()))) 1206 if (!resource || (m_preloads && m_preloads->contains(resource.get())))
1205 return; 1207 return;
1206 TRACE_EVENT_ASYNC_STEP_INTO0("net", "Resource", resource.get(), "Preload"); 1208 TRACE_EVENT_ASYNC_STEP_INTO0("net", "Resource", resource.get(), "Preload");
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
1494 1496
1495 void ResourceFetcher::trace(Visitor* visitor) 1497 void ResourceFetcher::trace(Visitor* visitor)
1496 { 1498 {
1497 visitor->trace(m_document); 1499 visitor->trace(m_document);
1498 visitor->trace(m_loaders); 1500 visitor->trace(m_loaders);
1499 visitor->trace(m_multipartLoaders); 1501 visitor->trace(m_multipartLoaders);
1500 ResourceLoaderHost::trace(visitor); 1502 ResourceLoaderHost::trace(visitor);
1501 } 1503 }
1502 1504
1503 } 1505 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698