OLD | NEW |
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 26 matching lines...) Expand all Loading... |
37 #include "core/inspector/InspectorResourceContentLoader.h" | 37 #include "core/inspector/InspectorResourceContentLoader.h" |
38 #include "wtf/HashMap.h" | 38 #include "wtf/HashMap.h" |
39 #include "wtf/text/WTFString.h" | 39 #include "wtf/text/WTFString.h" |
40 | 40 |
41 namespace blink { | 41 namespace blink { |
42 | 42 |
43 class Resource; | 43 class Resource; |
44 class DOMWrapperWorld; | 44 class DOMWrapperWorld; |
45 class Document; | 45 class Document; |
46 class DocumentLoader; | 46 class DocumentLoader; |
| 47 class EditedResourcesContentManager; |
47 class LocalFrame; | 48 class LocalFrame; |
48 class GraphicsContext; | 49 class GraphicsContext; |
49 class GraphicsLayer; | 50 class GraphicsLayer; |
50 class InjectedScriptManager; | 51 class InjectedScriptManager; |
51 class InspectorClient; | 52 class InspectorClient; |
52 class InspectorOverlay; | 53 class InspectorOverlay; |
53 class InspectorResourceContentLoader; | 54 class InspectorResourceContentLoader; |
54 class InstrumentingAgents; | 55 class InstrumentingAgents; |
55 class IntSize; | 56 class IntSize; |
56 class KURL; | 57 class KURL; |
(...skipping 14 matching lines...) Expand all Loading... |
71 ImageResource, | 72 ImageResource, |
72 FontResource, | 73 FontResource, |
73 MediaResource, | 74 MediaResource, |
74 ScriptResource, | 75 ScriptResource, |
75 TextTrackResource, | 76 TextTrackResource, |
76 XHRResource, | 77 XHRResource, |
77 WebSocketResource, | 78 WebSocketResource, |
78 OtherResource | 79 OtherResource |
79 }; | 80 }; |
80 | 81 |
81 static PassOwnPtrWillBeRawPtr<InspectorPageAgent> create(Page*, InjectedScri
ptManager*, InspectorClient*, InspectorOverlay*); | 82 static PassOwnPtrWillBeRawPtr<InspectorPageAgent> create(Page*, InjectedScri
ptManager*, EditedResourcesContentManager*, InspectorClient*, InspectorOverlay*)
; |
82 | 83 |
83 // Settings overrides. | 84 // Settings overrides. |
84 void setTextAutosizingEnabled(bool); | 85 void setTextAutosizingEnabled(bool); |
85 void setDeviceScaleAdjustment(float); | 86 void setDeviceScaleAdjustment(float); |
86 | 87 |
87 static Vector<Document*> importsForFrame(LocalFrame*); | 88 static Vector<Document*> importsForFrame(LocalFrame*); |
88 static bool cachedResourceContent(Resource*, String* result, bool* base64Enc
oded); | 89 static bool cachedResourceContent(Resource*, String* result, bool* base64Enc
oded); |
89 static bool sharedBufferContent(PassRefPtr<SharedBuffer>, const String& text
EncodingName, bool withBase64Encode, String* result); | 90 static bool sharedBufferContent(PassRefPtr<SharedBuffer>, const String& text
EncodingName, bool withBase64Encode, String* result); |
90 | 91 |
91 static PassRefPtr<SharedBuffer> resourceData(LocalFrame*, const KURL&, Strin
g* textEncodingName); | 92 static PassRefPtr<SharedBuffer> resourceData(LocalFrame*, const KURL&, Strin
g* textEncodingName); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 bool hasIdForFrame(LocalFrame*) const; | 159 bool hasIdForFrame(LocalFrame*) const; |
159 String loaderId(DocumentLoader*); | 160 String loaderId(DocumentLoader*); |
160 LocalFrame* findFrameWithSecurityOrigin(const String& originRawString); | 161 LocalFrame* findFrameWithSecurityOrigin(const String& originRawString); |
161 LocalFrame* assertFrame(ErrorString*, const String& frameId); | 162 LocalFrame* assertFrame(ErrorString*, const String& frameId); |
162 String scriptPreprocessorSource() { return m_scriptPreprocessorSource; } | 163 String scriptPreprocessorSource() { return m_scriptPreprocessorSource; } |
163 const AtomicString& resourceSourceMapURL(const String& url); | 164 const AtomicString& resourceSourceMapURL(const String& url); |
164 bool deviceMetricsOverrideEnabled(); | 165 bool deviceMetricsOverrideEnabled(); |
165 void deviceOrPageScaleFactorChanged(); | 166 void deviceOrPageScaleFactorChanged(); |
166 static DocumentLoader* assertDocumentLoader(ErrorString*, LocalFrame*); | 167 static DocumentLoader* assertDocumentLoader(ErrorString*, LocalFrame*); |
167 InspectorResourceContentLoader* resourceContentLoader() { return m_inspector
ResourceContentLoader.get(); } | 168 InspectorResourceContentLoader* resourceContentLoader() { return m_inspector
ResourceContentLoader.get(); } |
168 void clearEditedResourcesContent(); | |
169 void addEditedResourceContent(const String& url, const String& content); | |
170 bool getEditedResourceContent(const String& url, String* content); | |
171 | 169 |
172 virtual void trace(Visitor*) OVERRIDE; | 170 virtual void trace(Visitor*) OVERRIDE; |
173 | 171 |
174 private: | 172 private: |
175 class GetResourceContentLoadListener; | 173 class GetResourceContentLoadListener; |
176 | 174 |
177 InspectorPageAgent(Page*, InjectedScriptManager*, InspectorClient*, Inspecto
rOverlay*); | 175 InspectorPageAgent(Page*, InjectedScriptManager*, EditedResourcesContentMana
ger*, InspectorClient*, InspectorOverlay*); |
178 bool deviceMetricsChanged(bool enabled, int width, int height, double device
ScaleFactor, bool mobile, bool fitWindow, double scale, double offsetX, double o
ffsetY); | 176 bool deviceMetricsChanged(bool enabled, int width, int height, double device
ScaleFactor, bool mobile, bool fitWindow, double scale, double offsetX, double o
ffsetY); |
179 void updateViewMetricsFromState(); | 177 void updateViewMetricsFromState(); |
180 void updateViewMetrics(bool enabled, int width, int height, double deviceSca
leFactor, bool mobile, bool fitWindow, double scale, double offsetX, double offs
etY); | 178 void updateViewMetrics(bool enabled, int width, int height, double deviceSca
leFactor, bool mobile, bool fitWindow, double scale, double offsetX, double offs
etY); |
181 void updateTouchEventEmulationInPage(bool); | 179 void updateTouchEventEmulationInPage(bool); |
182 bool compositingEnabled(ErrorString*); | 180 bool compositingEnabled(ErrorString*); |
183 | 181 |
184 void getResourceContentAfterResourcesContentLoaded(const String& frameId, co
nst String& url, PassRefPtr<GetResourceContentCallback>); | 182 void getResourceContentAfterResourcesContentLoaded(const String& frameId, co
nst String& url, PassRefPtr<GetResourceContentCallback>); |
185 | 183 |
186 static bool dataContent(const char* data, unsigned size, const String& textE
ncodingName, bool withBase64Encode, String* result); | 184 static bool dataContent(const char* data, unsigned size, const String& textE
ncodingName, bool withBase64Encode, String* result); |
187 | 185 |
188 void viewportChanged(); | 186 void viewportChanged(); |
189 | 187 |
190 PassRefPtr<TypeBuilder::Page::Frame> buildObjectForFrame(LocalFrame*); | 188 PassRefPtr<TypeBuilder::Page::Frame> buildObjectForFrame(LocalFrame*); |
191 PassRefPtr<TypeBuilder::Page::FrameResourceTree> buildObjectForFrameTree(Loc
alFrame*); | 189 PassRefPtr<TypeBuilder::Page::FrameResourceTree> buildObjectForFrameTree(Loc
alFrame*); |
192 RawPtrWillBeMember<Page> m_page; | 190 RawPtrWillBeMember<Page> m_page; |
193 RawPtrWillBeMember<InjectedScriptManager> m_injectedScriptManager; | 191 RawPtrWillBeMember<InjectedScriptManager> m_injectedScriptManager; |
| 192 RawPtrWillBeMember<EditedResourcesContentManager> m_editedResourcesContentMa
nager; |
194 InspectorClient* m_client; | 193 InspectorClient* m_client; |
195 InspectorFrontend::Page* m_frontend; | 194 InspectorFrontend::Page* m_frontend; |
196 InspectorOverlay* m_overlay; | 195 InspectorOverlay* m_overlay; |
197 long m_lastScriptIdentifier; | 196 long m_lastScriptIdentifier; |
198 String m_pendingScriptToEvaluateOnLoadOnce; | 197 String m_pendingScriptToEvaluateOnLoadOnce; |
199 String m_scriptToEvaluateOnLoadOnce; | 198 String m_scriptToEvaluateOnLoadOnce; |
200 String m_pendingScriptPreprocessor; | 199 String m_pendingScriptPreprocessor; |
201 String m_scriptPreprocessorSource; | 200 String m_scriptPreprocessorSource; |
202 HashMap<LocalFrame*, String> m_frameToIdentifier; | 201 HashMap<LocalFrame*, String> m_frameToIdentifier; |
203 HashMap<String, LocalFrame*> m_identifierToFrame; | 202 HashMap<String, LocalFrame*> m_identifierToFrame; |
204 HashMap<DocumentLoader*, String> m_loaderToIdentifier; | 203 HashMap<DocumentLoader*, String> m_loaderToIdentifier; |
205 bool m_enabled; | 204 bool m_enabled; |
206 bool m_ignoreScriptsEnabledNotification; | 205 bool m_ignoreScriptsEnabledNotification; |
207 bool m_deviceMetricsOverridden; | 206 bool m_deviceMetricsOverridden; |
208 bool m_emulateMobileEnabled; | 207 bool m_emulateMobileEnabled; |
209 | 208 |
210 bool m_touchEmulationEnabled; | 209 bool m_touchEmulationEnabled; |
211 bool m_originalTouchEnabled; | 210 bool m_originalTouchEnabled; |
212 bool m_originalDeviceSupportsMouse; | 211 bool m_originalDeviceSupportsMouse; |
213 bool m_originalDeviceSupportsTouch; | 212 bool m_originalDeviceSupportsTouch; |
214 | 213 |
215 bool m_embedderTextAutosizingEnabled; | 214 bool m_embedderTextAutosizingEnabled; |
216 double m_embedderFontScaleFactor; | 215 double m_embedderFontScaleFactor; |
217 | 216 |
218 OwnPtr<InspectorResourceContentLoader> m_inspectorResourceContentLoader; | 217 OwnPtr<InspectorResourceContentLoader> m_inspectorResourceContentLoader; |
219 HashMap<String, String> m_editedResourceContent; | |
220 }; | 218 }; |
221 | 219 |
222 | 220 |
223 } // namespace blink | 221 } // namespace blink |
224 | 222 |
225 | 223 |
226 #endif // !defined(InspectorPagerAgent_h) | 224 #endif // !defined(InspectorPagerAgent_h) |
OLD | NEW |