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

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

Issue 17030009: Inspector: wrapped inspector agent instances into factory-like wrappers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Addressed comments 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 class InstrumentingAgents; 54 class InstrumentingAgents;
55 class IntSize; 55 class IntSize;
56 class KURL; 56 class KURL;
57 class LayoutRect; 57 class LayoutRect;
58 class Page; 58 class Page;
59 class RenderObject; 59 class RenderObject;
60 class SharedBuffer; 60 class SharedBuffer;
61 61
62 typedef String ErrorString; 62 typedef String ErrorString;
63 63
64 class InspectorPageAgent : public InspectorBaseAgent<InspectorPageAgent>, public InspectorBackendDispatcher::PageCommandHandler { 64 class InspectorPageAgent : public InspectorBaseAgent, public InspectorBackendDis patcher::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 FontResource, 71 FontResource,
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 PassRefPtr<InspectorPageAgent> create(InstrumentingAgents*, Inspector State*, Page*, InjectedScriptManager*, InspectorOverlay*, InspectorClient*);
79 79
80 static bool cachedResourceContent(CachedResource*, String* result, bool* bas e64Encoded); 80 static bool cachedResourceContent(CachedResource*, String* result, bool* bas e64Encoded);
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 static void resourceContent(ErrorString*, Frame*, const KURL&, String* resul t, bool* base64Encoded); 82 static void resourceContent(ErrorString*, Frame*, const KURL&, String* resul t, bool* base64Encoded);
83 83
84 static PassRefPtr<SharedBuffer> resourceData(Frame*, const KURL&, String* te xtEncodingName); 84 static PassRefPtr<SharedBuffer> resourceData(Frame*, const KURL&, String* te xtEncodingName);
85 static CachedResource* cachedResource(Frame*, const KURL&); 85 static CachedResource* cachedResource(Frame*, const KURL&);
86 static TypeBuilder::Page::ResourceType::Enum resourceTypeJson(ResourceType); 86 static TypeBuilder::Page::ResourceType::Enum resourceTypeJson(ResourceType);
87 static ResourceType cachedResourceType(const CachedResource&); 87 static ResourceType cachedResourceType(const CachedResource&);
88 static TypeBuilder::Page::ResourceType::Enum cachedResourceTypeJson(const Ca chedResource&); 88 static TypeBuilder::Page::ResourceType::Enum cachedResourceTypeJson(const Ca chedResource&);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 String frameId(Frame*); 167 String frameId(Frame*);
168 bool hasIdForFrame(Frame*) const; 168 bool hasIdForFrame(Frame*) const;
169 String loaderId(DocumentLoader*); 169 String loaderId(DocumentLoader*);
170 Frame* findFrameWithSecurityOrigin(const String& originRawString); 170 Frame* findFrameWithSecurityOrigin(const String& originRawString);
171 Frame* assertFrame(ErrorString*, const String& frameId); 171 Frame* assertFrame(ErrorString*, const String& frameId);
172 String scriptPreprocessor() { return m_scriptPreprocessor; } 172 String scriptPreprocessor() { return m_scriptPreprocessor; }
173 String resourceSourceMapURL(const String& url); 173 String resourceSourceMapURL(const String& url);
174 static DocumentLoader* assertDocumentLoader(ErrorString*, Frame*); 174 static DocumentLoader* assertDocumentLoader(ErrorString*, Frame*);
175 175
176 private: 176 private:
177 InspectorPageAgent(InstrumentingAgents*, Page*, InspectorCompositeState*, In jectedScriptManager*, InspectorClient*, InspectorOverlay*); 177 InspectorPageAgent(InstrumentingAgents*, InspectorState*, Page*, InjectedScr iptManager*, InspectorOverlay*, InspectorClient*);
178 bool deviceMetricsChanged(int width, int height, double fontScaleFactor, boo l fitWindow); 178 bool deviceMetricsChanged(int width, int height, double fontScaleFactor, boo l fitWindow);
179 void updateViewMetrics(int, int, double, bool); 179 void updateViewMetrics(int, int, double, bool);
180 void updateTouchEventEmulationInPage(bool); 180 void updateTouchEventEmulationInPage(bool);
181 181
182 static bool dataContent(const char* data, unsigned size, const String& textE ncodingName, bool withBase64Encode, String* result); 182 static bool dataContent(const char* data, unsigned size, const String& textE ncodingName, bool withBase64Encode, String* result);
183 183
184 PassRefPtr<TypeBuilder::Page::Frame> buildObjectForFrame(Frame*); 184 PassRefPtr<TypeBuilder::Page::Frame> buildObjectForFrame(Frame*);
185 PassRefPtr<TypeBuilder::Page::FrameResourceTree> buildObjectForFrameTree(Fra me*); 185 PassRefPtr<TypeBuilder::Page::FrameResourceTree> buildObjectForFrameTree(Fra me*);
186 Page* m_page; 186 Page* m_page;
187 InjectedScriptManager* m_injectedScriptManager; 187 InjectedScriptManager* m_injectedScriptManager;
(...skipping 12 matching lines...) Expand all
200 bool m_isFirstLayoutAfterOnLoad; 200 bool m_isFirstLayoutAfterOnLoad;
201 bool m_geolocationOverridden; 201 bool m_geolocationOverridden;
202 bool m_ignoreScriptsEnabledNotification; 202 bool m_ignoreScriptsEnabledNotification;
203 bool m_didForceCompositingMode; 203 bool m_didForceCompositingMode;
204 RefPtr<GeolocationPosition> m_geolocationPosition; 204 RefPtr<GeolocationPosition> m_geolocationPosition;
205 RefPtr<GeolocationPosition> m_platformGeolocationPosition; 205 RefPtr<GeolocationPosition> m_platformGeolocationPosition;
206 RefPtr<DeviceOrientationData> m_deviceOrientation; 206 RefPtr<DeviceOrientationData> m_deviceOrientation;
207 }; 207 };
208 208
209 209
210 class InspectorPageFactory : public InspectorBaseFactory<InspectorPageFactory, I nspectorPageAgent> {
211 public:
212
213 static PassOwnPtr<InspectorPageFactory> create(InstrumentingAgents* instrume ntingAgents, InspectorCompositeState* state, Page* page, InjectedScriptManager* injectedScriptManager, InspectorOverlay* inspectorOverlay, InspectorClient* insp ectorClient)
214 {
215 return adoptPtr(new InspectorPageFactory(instrumentingAgents, state, pag e, injectedScriptManager, inspectorOverlay, inspectorClient));
216 }
217
218 protected:
219 InspectorPageFactory(InstrumentingAgents* instrumentingAgents, InspectorComp ositeState* compositeState, Page* page, InjectedScriptManager* injectedScriptMan ager, InspectorOverlay* inspectorOverlay, InspectorClient* inspectorClient)
220 : InspectorBaseFactory<InspectorPageFactory, InspectorPageAgent>("Page", instrumentingAgents, compositeState)
221 {
222 setAgent(InspectorPageAgent::create(m_instrumentingAgents, m_state, page , injectedScriptManager, inspectorOverlay, inspectorClient));
223 }
224 };
225
210 } // namespace WebCore 226 } // namespace WebCore
211 227
212 228
213 #endif // !defined(InspectorPagerAgent_h) 229 #endif // !defined(InspectorPagerAgent_h)
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorMemoryAgent.cpp ('k') | Source/core/inspector/InspectorPageAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698