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

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

Issue 338253007: Revert "DevTools: Load document (html) content from disk cache in page agent enabling." (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 16 matching lines...) Expand all
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 #ifndef InspectorPageAgent_h 31 #ifndef InspectorPageAgent_h
32 #define InspectorPageAgent_h 32 #define InspectorPageAgent_h
33 33
34 34
35 #include "core/InspectorFrontend.h" 35 #include "core/InspectorFrontend.h"
36 #include "core/inspector/InspectorBaseAgent.h" 36 #include "core/inspector/InspectorBaseAgent.h"
37 #include "core/inspector/InspectorResourceContentLoader.h"
38 #include "wtf/HashMap.h" 37 #include "wtf/HashMap.h"
39 #include "wtf/text/WTFString.h" 38 #include "wtf/text/WTFString.h"
40 39
41 namespace WebCore { 40 namespace WebCore {
42 41
43 class Resource; 42 class Resource;
44 class DOMWrapperWorld; 43 class DOMWrapperWorld;
45 class Document; 44 class Document;
46 class DocumentLoader; 45 class DocumentLoader;
47 class LocalFrame; 46 class LocalFrame;
48 class GraphicsContext; 47 class GraphicsContext;
49 class GraphicsLayer; 48 class GraphicsLayer;
50 class InjectedScriptManager; 49 class InjectedScriptManager;
51 class InspectorClient; 50 class InspectorClient;
52 class InspectorOverlay; 51 class InspectorOverlay;
53 class InspectorResourceContentLoader;
54 class InstrumentingAgents; 52 class InstrumentingAgents;
55 class IntSize; 53 class IntSize;
56 class KURL; 54 class KURL;
57 class LayoutRect; 55 class LayoutRect;
58 class Page; 56 class Page;
59 class RenderObject; 57 class RenderObject;
60 class SharedBuffer; 58 class SharedBuffer;
61 class StyleResolver; 59 class StyleResolver;
62 60
63 typedef String ErrorString; 61 typedef String ErrorString;
(...skipping 13 matching lines...) Expand all
77 WebSocketResource, 75 WebSocketResource,
78 OtherResource 76 OtherResource
79 }; 77 };
80 78
81 static PassOwnPtr<InspectorPageAgent> create(Page*, InjectedScriptManager*, InspectorClient*, InspectorOverlay*); 79 static PassOwnPtr<InspectorPageAgent> create(Page*, InjectedScriptManager*, InspectorClient*, InspectorOverlay*);
82 80
83 // Settings overrides. 81 // Settings overrides.
84 void setTextAutosizingEnabled(bool); 82 void setTextAutosizingEnabled(bool);
85 void setDeviceScaleAdjustment(float); 83 void setDeviceScaleAdjustment(float);
86 84
87 static Vector<Document*> importsForFrame(LocalFrame*);
88 static bool cachedResourceContent(Resource*, String* result, bool* base64Enc oded); 85 static bool cachedResourceContent(Resource*, String* result, bool* base64Enc oded);
89 static bool sharedBufferContent(PassRefPtr<SharedBuffer>, const String& text EncodingName, bool withBase64Encode, String* result); 86 static bool sharedBufferContent(PassRefPtr<SharedBuffer>, const String& text EncodingName, bool withBase64Encode, String* result);
90 static void resourceContent(ErrorString*, LocalFrame*, const KURL&, String* result, bool* base64Encoded);
91 87
92 static PassRefPtr<SharedBuffer> resourceData(LocalFrame*, const KURL&, Strin g* textEncodingName); 88 static PassRefPtr<SharedBuffer> resourceData(LocalFrame*, const KURL&, Strin g* textEncodingName);
93 static Resource* cachedResource(LocalFrame*, const KURL&); 89 static Resource* cachedResource(LocalFrame*, const KURL&);
94 static TypeBuilder::Page::ResourceType::Enum resourceTypeJson(ResourceType); 90 static TypeBuilder::Page::ResourceType::Enum resourceTypeJson(ResourceType);
95 static ResourceType cachedResourceType(const Resource&); 91 static ResourceType cachedResourceType(const Resource&);
96 static TypeBuilder::Page::ResourceType::Enum cachedResourceTypeJson(const Re source&); 92 static TypeBuilder::Page::ResourceType::Enum cachedResourceTypeJson(const Re source&);
97 93
98 // Page API for InspectorFrontend 94 // Page API for InspectorFrontend
99 virtual void enable(ErrorString*) OVERRIDE; 95 virtual void enable(ErrorString*) OVERRIDE;
100 virtual void disable(ErrorString*) OVERRIDE; 96 virtual void disable(ErrorString*) OVERRIDE;
101 virtual void addScriptToEvaluateOnLoad(ErrorString*, const String& source, S tring* result) OVERRIDE; 97 virtual void addScriptToEvaluateOnLoad(ErrorString*, const String& source, S tring* result) OVERRIDE;
102 virtual void removeScriptToEvaluateOnLoad(ErrorString*, const String& identi fier) OVERRIDE; 98 virtual void removeScriptToEvaluateOnLoad(ErrorString*, const String& identi fier) OVERRIDE;
103 virtual void reload(ErrorString*, const bool* optionalIgnoreCache, const Str ing* optionalScriptToEvaluateOnLoad, const String* optionalScriptPreprocessor) O VERRIDE; 99 virtual void reload(ErrorString*, const bool* optionalIgnoreCache, const Str ing* optionalScriptToEvaluateOnLoad, const String* optionalScriptPreprocessor) O VERRIDE;
104 virtual void navigate(ErrorString*, const String& url) OVERRIDE; 100 virtual void navigate(ErrorString*, const String& url) OVERRIDE;
105 virtual void getCookies(ErrorString*, RefPtr<TypeBuilder::Array<TypeBuilder: :Page::Cookie> >& cookies) OVERRIDE; 101 virtual void getCookies(ErrorString*, RefPtr<TypeBuilder::Array<TypeBuilder: :Page::Cookie> >& cookies) OVERRIDE;
106 virtual void deleteCookie(ErrorString*, const String& cookieName, const Stri ng& url) OVERRIDE; 102 virtual void deleteCookie(ErrorString*, const String& cookieName, const Stri ng& url) OVERRIDE;
107 virtual void getResourceTree(ErrorString*, RefPtr<TypeBuilder::Page::FrameRe sourceTree>&) OVERRIDE; 103 virtual void getResourceTree(ErrorString*, RefPtr<TypeBuilder::Page::FrameRe sourceTree>&) OVERRIDE;
108 virtual void getResourceContent(ErrorString*, const String& frameId, const S tring& url, PassRefPtr<GetResourceContentCallback>) OVERRIDE; 104 virtual void getResourceContent(ErrorString*, const String& frameId, const S tring& url, String* content, bool* base64Encoded) OVERRIDE;
109 virtual void hasTouchInputs(ErrorString*, bool* result) OVERRIDE; 105 virtual void hasTouchInputs(ErrorString*, bool* result) OVERRIDE;
110 virtual void searchInResource(ErrorString*, const String& frameId, const Str ing& url, const String& query, const bool* optionalCaseSensitive, const bool* op tionalIsRegex, RefPtr<TypeBuilder::Array<TypeBuilder::Page::SearchMatch> >&) OVE RRIDE; 106 virtual void searchInResource(ErrorString*, const String& frameId, const Str ing& url, const String& query, const bool* optionalCaseSensitive, const bool* op tionalIsRegex, RefPtr<TypeBuilder::Array<TypeBuilder::Page::SearchMatch> >&) OVE RRIDE;
111 virtual void setDocumentContent(ErrorString*, const String& frameId, const S tring& html) OVERRIDE; 107 virtual void setDocumentContent(ErrorString*, const String& frameId, const S tring& html) OVERRIDE;
112 virtual void setDeviceMetricsOverride(ErrorString*, int width, int height, d ouble deviceScaleFactor, bool emulateViewport, bool fitWindow, const bool* optio nalTextAutosizing, const double* optionalFontScaleFactor) OVERRIDE; 108 virtual void setDeviceMetricsOverride(ErrorString*, int width, int height, d ouble deviceScaleFactor, bool emulateViewport, bool fitWindow, const bool* optio nalTextAutosizing, const double* optionalFontScaleFactor) OVERRIDE;
113 virtual void clearDeviceMetricsOverride(ErrorString*) OVERRIDE; 109 virtual void clearDeviceMetricsOverride(ErrorString*) OVERRIDE;
114 virtual void setShowPaintRects(ErrorString*, bool show) OVERRIDE; 110 virtual void setShowPaintRects(ErrorString*, bool show) OVERRIDE;
115 virtual void setShowDebugBorders(ErrorString*, bool show) OVERRIDE; 111 virtual void setShowDebugBorders(ErrorString*, bool show) OVERRIDE;
116 virtual void setShowFPSCounter(ErrorString*, bool show) OVERRIDE; 112 virtual void setShowFPSCounter(ErrorString*, bool show) OVERRIDE;
117 virtual void setContinuousPaintingEnabled(ErrorString*, bool enabled) OVERRI DE; 113 virtual void setContinuousPaintingEnabled(ErrorString*, bool enabled) OVERRI DE;
118 virtual void setShowScrollBottleneckRects(ErrorString*, bool show) OVERRIDE; 114 virtual void setShowScrollBottleneckRects(ErrorString*, bool show) OVERRIDE;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 LocalFrame* frameForId(const String& frameId); 153 LocalFrame* frameForId(const String& frameId);
158 String frameId(LocalFrame*); 154 String frameId(LocalFrame*);
159 bool hasIdForFrame(LocalFrame*) const; 155 bool hasIdForFrame(LocalFrame*) const;
160 String loaderId(DocumentLoader*); 156 String loaderId(DocumentLoader*);
161 LocalFrame* findFrameWithSecurityOrigin(const String& originRawString); 157 LocalFrame* findFrameWithSecurityOrigin(const String& originRawString);
162 LocalFrame* assertFrame(ErrorString*, const String& frameId); 158 LocalFrame* assertFrame(ErrorString*, const String& frameId);
163 String scriptPreprocessorSource() { return m_scriptPreprocessorSource; } 159 String scriptPreprocessorSource() { return m_scriptPreprocessorSource; }
164 const AtomicString& resourceSourceMapURL(const String& url); 160 const AtomicString& resourceSourceMapURL(const String& url);
165 bool deviceMetricsOverrideEnabled(); 161 bool deviceMetricsOverrideEnabled();
166 static DocumentLoader* assertDocumentLoader(ErrorString*, LocalFrame*); 162 static DocumentLoader* assertDocumentLoader(ErrorString*, LocalFrame*);
167 InspectorResourceContentLoader* resourceContentLoader() { return m_inspector ResourceContentLoader.get(); }
168 163
169 private: 164 private:
170 class GetResourceContentLoadListener; 165 static void resourceContent(ErrorString*, LocalFrame*, const KURL&, String* result, bool* base64Encoded);
171 166
172 InspectorPageAgent(Page*, InjectedScriptManager*, InspectorClient*, Inspecto rOverlay*); 167 InspectorPageAgent(Page*, InjectedScriptManager*, InspectorClient*, Inspecto rOverlay*);
173 bool deviceMetricsChanged(bool enabled, int width, int height, double device ScaleFactor, bool emulateViewport, bool fitWindow, double fontScaleFactor, bool textAutosizing); 168 bool deviceMetricsChanged(bool enabled, int width, int height, double device ScaleFactor, bool emulateViewport, bool fitWindow, double fontScaleFactor, bool textAutosizing);
174 void updateViewMetricsFromState(); 169 void updateViewMetricsFromState();
175 void updateViewMetrics(bool enabled, int width, int height, double deviceSca leFactor, bool emulateViewport, bool fitWindow, double fontScaleFactor, bool tex tAutosizingEnabled); 170 void updateViewMetrics(bool enabled, int width, int height, double deviceSca leFactor, bool emulateViewport, bool fitWindow, double fontScaleFactor, bool tex tAutosizingEnabled);
176 void updateTouchEventEmulationInPage(bool); 171 void updateTouchEventEmulationInPage(bool);
177 bool compositingEnabled(ErrorString*); 172 bool compositingEnabled(ErrorString*);
178 173
179 void getResourceContentAfterResourcesContentLoaded(const String& frameId, co nst String& url, PassRefPtr<GetResourceContentCallback>);
180
181 static bool dataContent(const char* data, unsigned size, const String& textE ncodingName, bool withBase64Encode, String* result); 174 static bool dataContent(const char* data, unsigned size, const String& textE ncodingName, bool withBase64Encode, String* result);
182 175
183 PassRefPtr<TypeBuilder::Page::Frame> buildObjectForFrame(LocalFrame*); 176 PassRefPtr<TypeBuilder::Page::Frame> buildObjectForFrame(LocalFrame*);
184 PassRefPtr<TypeBuilder::Page::FrameResourceTree> buildObjectForFrameTree(Loc alFrame*); 177 PassRefPtr<TypeBuilder::Page::FrameResourceTree> buildObjectForFrameTree(Loc alFrame*);
185 Page* m_page; 178 Page* m_page;
186 InjectedScriptManager* m_injectedScriptManager; 179 InjectedScriptManager* m_injectedScriptManager;
187 InspectorClient* m_client; 180 InspectorClient* m_client;
188 InspectorFrontend::Page* m_frontend; 181 InspectorFrontend::Page* m_frontend;
189 InspectorOverlay* m_overlay; 182 InspectorOverlay* m_overlay;
190 long m_lastScriptIdentifier; 183 long m_lastScriptIdentifier;
191 String m_pendingScriptToEvaluateOnLoadOnce; 184 String m_pendingScriptToEvaluateOnLoadOnce;
192 String m_scriptToEvaluateOnLoadOnce; 185 String m_scriptToEvaluateOnLoadOnce;
193 String m_pendingScriptPreprocessor; 186 String m_pendingScriptPreprocessor;
194 String m_scriptPreprocessorSource; 187 String m_scriptPreprocessorSource;
195 HashMap<LocalFrame*, String> m_frameToIdentifier; 188 HashMap<LocalFrame*, String> m_frameToIdentifier;
196 HashMap<String, LocalFrame*> m_identifierToFrame; 189 HashMap<String, LocalFrame*> m_identifierToFrame;
197 HashMap<DocumentLoader*, String> m_loaderToIdentifier; 190 HashMap<DocumentLoader*, String> m_loaderToIdentifier;
198 bool m_enabled; 191 bool m_enabled;
199 bool m_ignoreScriptsEnabledNotification; 192 bool m_ignoreScriptsEnabledNotification;
200 bool m_deviceMetricsOverridden; 193 bool m_deviceMetricsOverridden;
201 bool m_emulateViewportEnabled; 194 bool m_emulateViewportEnabled;
202 195
203 bool m_touchEmulationEnabled; 196 bool m_touchEmulationEnabled;
204 bool m_originalTouchEnabled; 197 bool m_originalTouchEnabled;
205 bool m_originalDeviceSupportsMouse; 198 bool m_originalDeviceSupportsMouse;
206 bool m_originalDeviceSupportsTouch; 199 bool m_originalDeviceSupportsTouch;
207 200
208 bool m_embedderTextAutosizingEnabled; 201 bool m_embedderTextAutosizingEnabled;
209 double m_embedderFontScaleFactor; 202 double m_embedderFontScaleFactor;
210
211 OwnPtr<InspectorResourceContentLoader> m_inspectorResourceContentLoader;
212 }; 203 };
213 204
214 205
215 } // namespace WebCore 206 } // namespace WebCore
216 207
217 208
218 #endif // !defined(InspectorPagerAgent_h) 209 #endif // !defined(InspectorPagerAgent_h)
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorCSSAgent.cpp ('k') | Source/core/inspector/InspectorPageAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698