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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 class IntSize; | 54 class IntSize; |
55 class KURL; | 55 class KURL; |
56 class LayoutRect; | 56 class LayoutRect; |
57 class Page; | 57 class Page; |
58 class RenderObject; | 58 class RenderObject; |
59 class SharedBuffer; | 59 class SharedBuffer; |
60 class StyleResolver; | 60 class StyleResolver; |
61 | 61 |
62 typedef String ErrorString; | 62 typedef String ErrorString; |
63 | 63 |
64 class InspectorPageAgent : public InspectorBaseAgent<InspectorPageAgent>, public
InspectorBackendDispatcher::PageCommandHandler { | 64 class InspectorPageAgent FINAL : public InspectorBaseAgent<InspectorPageAgent>,
public InspectorBackendDispatcher::PageCommandHandler { |
65 WTF_MAKE_NONCOPYABLE(InspectorPageAgent); | 65 WTF_MAKE_NONCOPYABLE(InspectorPageAgent); |
66 public: | 66 public: |
67 enum ResourceType { | 67 enum ResourceType { |
68 DocumentResource, | 68 DocumentResource, |
69 StylesheetResource, | 69 StylesheetResource, |
70 ImageResource, | 70 ImageResource, |
71 Font, | 71 Font, |
72 ScriptResource, | 72 ScriptResource, |
73 XHRResource, | 73 XHRResource, |
74 WebSocketResource, | 74 WebSocketResource, |
75 OtherResource | 75 OtherResource |
76 }; | 76 }; |
77 | 77 |
78 static PassOwnPtr<InspectorPageAgent> create(InstrumentingAgents*, Page*, In
spectorCompositeState*, InjectedScriptManager*, InspectorClient*, InspectorOverl
ay*); | 78 static PassOwnPtr<InspectorPageAgent> create(InstrumentingAgents*, Page*, In
spectorCompositeState*, InjectedScriptManager*, InspectorClient*, InspectorOverl
ay*); |
79 | 79 |
80 static bool cachedResourceContent(Resource*, String* result, bool* base64Enc
oded); | 80 static bool cachedResourceContent(Resource*, String* result, bool* base64Enc
oded); |
81 static bool sharedBufferContent(PassRefPtr<SharedBuffer>, const String& text
EncodingName, bool withBase64Encode, String* result); | 81 static bool sharedBufferContent(PassRefPtr<SharedBuffer>, const String& text
EncodingName, bool withBase64Encode, String* result); |
82 | 82 |
83 static PassRefPtr<SharedBuffer> resourceData(Frame*, const KURL&, String* te
xtEncodingName); | 83 static PassRefPtr<SharedBuffer> resourceData(Frame*, const KURL&, String* te
xtEncodingName); |
84 static Resource* cachedResource(Frame*, const KURL&); | 84 static Resource* cachedResource(Frame*, const KURL&); |
85 static TypeBuilder::Page::ResourceType::Enum resourceTypeJson(ResourceType); | 85 static TypeBuilder::Page::ResourceType::Enum resourceTypeJson(ResourceType); |
86 static ResourceType cachedResourceType(const Resource&); | 86 static ResourceType cachedResourceType(const Resource&); |
87 static TypeBuilder::Page::ResourceType::Enum cachedResourceTypeJson(const Re
source&); | 87 static TypeBuilder::Page::ResourceType::Enum cachedResourceTypeJson(const Re
source&); |
88 | 88 |
89 // Page API for InspectorFrontend | 89 // Page API for InspectorFrontend |
90 virtual void enable(ErrorString*); | 90 virtual void enable(ErrorString*) OVERRIDE; |
91 virtual void disable(ErrorString*); | 91 virtual void disable(ErrorString*) OVERRIDE; |
92 virtual void addScriptToEvaluateOnLoad(ErrorString*, const String& source, S
tring* result); | 92 virtual void addScriptToEvaluateOnLoad(ErrorString*, const String& source, S
tring* result) OVERRIDE; |
93 virtual void removeScriptToEvaluateOnLoad(ErrorString*, const String& identi
fier); | 93 virtual void removeScriptToEvaluateOnLoad(ErrorString*, const String& identi
fier) OVERRIDE; |
94 virtual void reload(ErrorString*, const bool* optionalIgnoreCache, const Str
ing* optionalScriptToEvaluateOnLoad, const String* optionalScriptPreprocessor); | 94 virtual void reload(ErrorString*, const bool* optionalIgnoreCache, const Str
ing* optionalScriptToEvaluateOnLoad, const String* optionalScriptPreprocessor) O
VERRIDE; |
95 virtual void navigate(ErrorString*, const String& url); | 95 virtual void navigate(ErrorString*, const String& url) OVERRIDE; |
96 virtual void getNavigationHistory(ErrorString*, int*, RefPtr<TypeBuilder::Ar
ray<TypeBuilder::Page::NavigationEntry> >&); | 96 virtual void getNavigationHistory(ErrorString*, int*, RefPtr<TypeBuilder::Ar
ray<TypeBuilder::Page::NavigationEntry> >&) OVERRIDE; |
97 virtual void navigateToHistoryEntry(ErrorString*, int); | 97 virtual void navigateToHistoryEntry(ErrorString*, int) OVERRIDE; |
98 virtual void getCookies(ErrorString*, RefPtr<TypeBuilder::Array<TypeBuilder:
:Page::Cookie> >& cookies); | 98 virtual void getCookies(ErrorString*, RefPtr<TypeBuilder::Array<TypeBuilder:
:Page::Cookie> >& cookies) OVERRIDE; |
99 virtual void deleteCookie(ErrorString*, const String& cookieName, const Stri
ng& url); | 99 virtual void deleteCookie(ErrorString*, const String& cookieName, const Stri
ng& url) OVERRIDE; |
100 virtual void getResourceTree(ErrorString*, RefPtr<TypeBuilder::Page::FrameRe
sourceTree>&); | 100 virtual void getResourceTree(ErrorString*, RefPtr<TypeBuilder::Page::FrameRe
sourceTree>&) OVERRIDE; |
101 virtual void getResourceContent(ErrorString*, const String& frameId, const S
tring& url, String* content, bool* base64Encoded); | 101 virtual void getResourceContent(ErrorString*, const String& frameId, const S
tring& url, String* content, bool* base64Encoded) OVERRIDE; |
102 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> >&); | 102 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; |
103 virtual void setDocumentContent(ErrorString*, const String& frameId, const S
tring& html); | 103 virtual void setDocumentContent(ErrorString*, const String& frameId, const S
tring& html) OVERRIDE; |
104 virtual void setDeviceMetricsOverride(ErrorString*, int width, int height, d
ouble deviceScaleFactor, bool emulateViewport, bool fitWindow, const bool* optio
nalTextAutosizing, const double* optionalFontScaleFactor); | 104 virtual void setDeviceMetricsOverride(ErrorString*, int width, int height, d
ouble deviceScaleFactor, bool emulateViewport, bool fitWindow, const bool* optio
nalTextAutosizing, const double* optionalFontScaleFactor) OVERRIDE; |
105 virtual void setShowPaintRects(ErrorString*, bool show); | 105 virtual void setShowPaintRects(ErrorString*, bool show) OVERRIDE; |
106 virtual void setShowDebugBorders(ErrorString*, bool show); | 106 virtual void setShowDebugBorders(ErrorString*, bool show) OVERRIDE; |
107 virtual void setShowFPSCounter(ErrorString*, bool show); | 107 virtual void setShowFPSCounter(ErrorString*, bool show) OVERRIDE; |
108 virtual void setContinuousPaintingEnabled(ErrorString*, bool enabled); | 108 virtual void setContinuousPaintingEnabled(ErrorString*, bool enabled) OVERRI
DE; |
109 virtual void setShowScrollBottleneckRects(ErrorString*, bool show); | 109 virtual void setShowScrollBottleneckRects(ErrorString*, bool show) OVERRIDE; |
110 virtual void getScriptExecutionStatus(ErrorString*, PageCommandHandler::Resu
lt::Enum*); | 110 virtual void getScriptExecutionStatus(ErrorString*, PageCommandHandler::Resu
lt::Enum*) OVERRIDE; |
111 virtual void setScriptExecutionDisabled(ErrorString*, bool); | 111 virtual void setScriptExecutionDisabled(ErrorString*, bool) OVERRIDE; |
112 virtual void setGeolocationOverride(ErrorString*, const double*, const doubl
e*, const double*); | 112 virtual void setGeolocationOverride(ErrorString*, const double*, const doubl
e*, const double*) OVERRIDE; |
113 virtual void clearGeolocationOverride(ErrorString*); | 113 virtual void clearGeolocationOverride(ErrorString*) OVERRIDE; |
114 virtual void setDeviceOrientationOverride(ErrorString*, double, double, doub
le); | 114 virtual void setDeviceOrientationOverride(ErrorString*, double, double, doub
le) OVERRIDE; |
115 virtual void clearDeviceOrientationOverride(ErrorString*); | 115 virtual void clearDeviceOrientationOverride(ErrorString*) OVERRIDE; |
116 virtual void setTouchEmulationEnabled(ErrorString*, bool); | 116 virtual void setTouchEmulationEnabled(ErrorString*, bool) OVERRIDE; |
117 virtual void setEmulatedMedia(ErrorString*, const String&); | 117 virtual void setEmulatedMedia(ErrorString*, const String&) OVERRIDE; |
118 virtual void captureScreenshot(ErrorString*, const String* format, const int
* quality, const int* maxWidth, const int* maxHeight, String* data, RefPtr<TypeB
uilder::Page::ScreencastFrameMetadata>& out_metadata); | 118 virtual void captureScreenshot(ErrorString*, const String* format, const int
* quality, const int* maxWidth, const int* maxHeight, String* data, RefPtr<TypeB
uilder::Page::ScreencastFrameMetadata>& out_metadata) OVERRIDE; |
119 virtual void canScreencast(ErrorString*, bool*); | 119 virtual void canScreencast(ErrorString*, bool*) OVERRIDE; |
120 virtual void startScreencast(ErrorString*, const String* format, const int*
quality, const int* maxWidth, const int* maxHeight); | 120 virtual void startScreencast(ErrorString*, const String* format, const int*
quality, const int* maxWidth, const int* maxHeight) OVERRIDE; |
121 virtual void stopScreencast(ErrorString*); | 121 virtual void stopScreencast(ErrorString*) OVERRIDE; |
122 virtual void handleJavaScriptDialog(ErrorString*, bool accept, const String*
promptText); | 122 virtual void handleJavaScriptDialog(ErrorString*, bool accept, const String*
promptText) OVERRIDE; |
123 virtual void queryUsageAndQuota(WebCore::ErrorString*, const WTF::String&, W
TF::RefPtr<WebCore::TypeBuilder::Page::Quota>&, WTF::RefPtr<WebCore::TypeBuilder
::Page::Usage>&); | 123 virtual void queryUsageAndQuota(WebCore::ErrorString*, const WTF::String&, W
TF::RefPtr<WebCore::TypeBuilder::Page::Quota>&, WTF::RefPtr<WebCore::TypeBuilder
::Page::Usage>&) OVERRIDE; |
124 virtual void setShowViewportSizeOnResize(ErrorString*, bool show, const bool
* showGrid); | 124 virtual void setShowViewportSizeOnResize(ErrorString*, bool show, const bool
* showGrid) OVERRIDE; |
125 | 125 |
126 // Geolocation override helper. | 126 // Geolocation override helper. |
127 GeolocationPosition* overrideGeolocationPosition(GeolocationPosition*); | 127 GeolocationPosition* overrideGeolocationPosition(GeolocationPosition*); |
128 | 128 |
129 // Text autosizing override helpers. | 129 // Text autosizing override helpers. |
130 bool overrideTextAutosizing(bool); | 130 bool overrideTextAutosizing(bool); |
131 // Note: This is used by Settings::deviceScaleAdjustment to calculate the ov
erridden device scale adjustment. | 131 // Note: This is used by Settings::deviceScaleAdjustment to calculate the ov
erridden device scale adjustment. |
132 float overrideFontScaleFactor(float); | 132 float overrideFontScaleFactor(float); |
133 | 133 |
134 // InspectorInstrumentation API | 134 // InspectorInstrumentation API |
(...skipping 13 matching lines...) Expand all Loading... |
148 bool applyViewportStyleOverride(StyleResolver*); | 148 bool applyViewportStyleOverride(StyleResolver*); |
149 void applyEmulatedMedia(String*); | 149 void applyEmulatedMedia(String*); |
150 void didPaint(RenderObject*, const GraphicsLayer*, GraphicsContext*, const L
ayoutRect&); | 150 void didPaint(RenderObject*, const GraphicsLayer*, GraphicsContext*, const L
ayoutRect&); |
151 void didLayout(RenderObject*); | 151 void didLayout(RenderObject*); |
152 void didScroll(); | 152 void didScroll(); |
153 void didResizeMainFrame(); | 153 void didResizeMainFrame(); |
154 void didRecalculateStyle(); | 154 void didRecalculateStyle(); |
155 void scriptsEnabled(bool isEnabled); | 155 void scriptsEnabled(bool isEnabled); |
156 | 156 |
157 // Inspector Controller API | 157 // Inspector Controller API |
158 virtual void setFrontend(InspectorFrontend*); | 158 virtual void setFrontend(InspectorFrontend*) OVERRIDE; |
159 virtual void clearFrontend(); | 159 virtual void clearFrontend() OVERRIDE; |
160 virtual void restore(); | 160 virtual void restore() OVERRIDE; |
161 | 161 |
162 void webViewResized(const IntSize&); | 162 void webViewResized(const IntSize&); |
163 | 163 |
164 // Cross-agents API | 164 // Cross-agents API |
165 Page* page() { return m_page; } | 165 Page* page() { return m_page; } |
166 Frame* mainFrame(); | 166 Frame* mainFrame(); |
167 String createIdentifier(); | 167 String createIdentifier(); |
168 Frame* frameForId(const String& frameId); | 168 Frame* frameForId(const String& frameId); |
169 String frameId(Frame*); | 169 String frameId(Frame*); |
170 bool hasIdForFrame(Frame*) const; | 170 bool hasIdForFrame(Frame*) const; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 bool m_emulateViewportEnabled; | 209 bool m_emulateViewportEnabled; |
210 RefPtr<GeolocationPosition> m_geolocationPosition; | 210 RefPtr<GeolocationPosition> m_geolocationPosition; |
211 RefPtr<GeolocationPosition> m_platformGeolocationPosition; | 211 RefPtr<GeolocationPosition> m_platformGeolocationPosition; |
212 }; | 212 }; |
213 | 213 |
214 | 214 |
215 } // namespace WebCore | 215 } // namespace WebCore |
216 | 216 |
217 | 217 |
218 #endif // !defined(InspectorPagerAgent_h) | 218 #endif // !defined(InspectorPagerAgent_h) |
OLD | NEW |