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

Side by Side Diff: Source/core/inspector/InspectorPageAgent.cpp

Issue 15832007: DevTools: Add support for //# sourceURL (sourceMappingURL) comments and deprecate //@ ones (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebaselined Created 7 years, 6 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) 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 #include "core/loader/cache/CachedCSSStyleSheet.h" 59 #include "core/loader/cache/CachedCSSStyleSheet.h"
60 #include "core/loader/cache/CachedFont.h" 60 #include "core/loader/cache/CachedFont.h"
61 #include "core/loader/cache/CachedImage.h" 61 #include "core/loader/cache/CachedImage.h"
62 #include "core/loader/cache/CachedResource.h" 62 #include "core/loader/cache/CachedResource.h"
63 #include "core/loader/cache/CachedResourceLoader.h" 63 #include "core/loader/cache/CachedResourceLoader.h"
64 #include "core/loader/cache/CachedScript.h" 64 #include "core/loader/cache/CachedScript.h"
65 #include "core/loader/cache/MemoryCache.h" 65 #include "core/loader/cache/MemoryCache.h"
66 #include "core/page/Frame.h" 66 #include "core/page/Frame.h"
67 #include "core/page/FrameView.h" 67 #include "core/page/FrameView.h"
68 #include "core/page/Page.h" 68 #include "core/page/Page.h"
69 #include "core/page/PageConsole.h"
69 #include "core/page/Settings.h" 70 #include "core/page/Settings.h"
70 #include "core/platform/Cookie.h" 71 #include "core/platform/Cookie.h"
71 #include "core/platform/text/RegularExpression.h" 72 #include "core/platform/text/RegularExpression.h"
72 #include "modules/geolocation/GeolocationController.h" 73 #include "modules/geolocation/GeolocationController.h"
73 #include "modules/geolocation/GeolocationError.h" 74 #include "modules/geolocation/GeolocationError.h"
74 #include "weborigin/SecurityOrigin.h" 75 #include "weborigin/SecurityOrigin.h"
75 #include "wtf/CurrentTime.h" 76 #include "wtf/CurrentTime.h"
76 #include "wtf/ListHashSet.h" 77 #include "wtf/ListHashSet.h"
77 #include "wtf/Vector.h" 78 #include "wtf/Vector.h"
78 #include "wtf/text/Base64.h" 79 #include "wtf/text/Base64.h"
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 } 904 }
904 905
905 Frame* InspectorPageAgent::assertFrame(ErrorString* errorString, const String& f rameId) 906 Frame* InspectorPageAgent::assertFrame(ErrorString* errorString, const String& f rameId)
906 { 907 {
907 Frame* frame = frameForId(frameId); 908 Frame* frame = frameForId(frameId);
908 if (!frame) 909 if (!frame)
909 *errorString = "No frame for given id found"; 910 *errorString = "No frame for given id found";
910 return frame; 911 return frame;
911 } 912 }
912 913
914 String InspectorPageAgent::resourceSourceMapURL(const String& url)
915 {
916 DEFINE_STATIC_LOCAL(String, sourceMapHttpHeader, (ASCIILiteral("SourceMap")) );
917 DEFINE_STATIC_LOCAL(String, deprecatedSourceMapHttpHeader, (ASCIILiteral("X- SourceMap")));
918 if (url.isEmpty())
919 return String();
920 Frame* frame = mainFrame();
921 if (!frame)
922 return String();
923 CachedResource* resource = cachedResource(frame, KURL(ParsedURLString, url)) ;
924 if (!resource)
925 return String();
926 String deprecatedHeaderSourceMapURL = resource->response().httpHeaderField(d eprecatedSourceMapHttpHeader);
927 if (!deprecatedHeaderSourceMapURL.isEmpty()) {
928 m_page->console()->addMessage(NetworkMessageSource, WarningMessageLevel, "Resource is served with deprecated header X-SourceMap, SourceMap should be use d instead.", url, 0);
929 return deprecatedHeaderSourceMapURL;
930 }
931 return resource->response().httpHeaderField(sourceMapHttpHeader);
932 }
933
913 // static 934 // static
914 DocumentLoader* InspectorPageAgent::assertDocumentLoader(ErrorString* errorStrin g, Frame* frame) 935 DocumentLoader* InspectorPageAgent::assertDocumentLoader(ErrorString* errorStrin g, Frame* frame)
915 { 936 {
916 FrameLoader* frameLoader = frame->loader(); 937 FrameLoader* frameLoader = frame->loader();
917 DocumentLoader* documentLoader = frameLoader ? frameLoader->documentLoader() : 0; 938 DocumentLoader* documentLoader = frameLoader ? frameLoader->documentLoader() : 0;
918 if (!documentLoader) 939 if (!documentLoader)
919 *errorString = "No documentLoader for given frame found"; 940 *errorString = "No documentLoader for given frame found";
920 return documentLoader; 941 return documentLoader;
921 } 942 }
922 943
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
1237 } 1258 }
1238 1259
1239 void InspectorPageAgent::setShowViewportSizeOnResize(ErrorString*, bool show, co nst bool* showGrid) 1260 void InspectorPageAgent::setShowViewportSizeOnResize(ErrorString*, bool show, co nst bool* showGrid)
1240 { 1261 {
1241 m_state->setBoolean(PageAgentState::showSizeOnResize, show); 1262 m_state->setBoolean(PageAgentState::showSizeOnResize, show);
1242 m_state->setBoolean(PageAgentState::showGridOnResize, showGrid && *showGrid) ; 1263 m_state->setBoolean(PageAgentState::showGridOnResize, showGrid && *showGrid) ;
1243 } 1264 }
1244 1265
1245 } // namespace WebCore 1266 } // namespace WebCore
1246 1267
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorPageAgent.h ('k') | Source/core/inspector/InspectorStyleSheet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698