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

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

Issue 17030009: Inspector: wrapped inspector agent instances into factory-like wrappers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Made InspectorBaseAgent RefCounted 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) 2010, Google Inc. All rights reserved. 2 * Copyright (C) 2010, 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 class NodeList; 60 class NodeList;
61 class SelectorProfile; 61 class SelectorProfile;
62 class StyleResolver; 62 class StyleResolver;
63 class StyleRule; 63 class StyleRule;
64 class StyleSheetVisitor; 64 class StyleSheetVisitor;
65 class UpdateRegionLayoutTask; 65 class UpdateRegionLayoutTask;
66 66
67 typedef HashMap<CSSStyleSheet*, RefPtr<InspectorStyleSheet> > CSSStyleSheetToIns pectorStyleSheet; 67 typedef HashMap<CSSStyleSheet*, RefPtr<InspectorStyleSheet> > CSSStyleSheetToIns pectorStyleSheet;
68 68
69 class InspectorCSSAgent 69 class InspectorCSSAgent
70 : public InspectorBaseAgent<InspectorCSSAgent> 70 : public InspectorBaseAgent
71 , public InspectorDOMAgent::DOMListener 71 , public InspectorDOMAgent::DOMListener
72 , public InspectorBackendDispatcher::CSSCommandHandler 72 , public InspectorBackendDispatcher::CSSCommandHandler
73 , public InspectorStyleSheet::Listener { 73 , public InspectorStyleSheet::Listener {
74 WTF_MAKE_NONCOPYABLE(InspectorCSSAgent); 74 WTF_MAKE_NONCOPYABLE(InspectorCSSAgent);
75 public: 75 public:
76 enum MediaListSource { 76 enum MediaListSource {
77 MediaListSourceLinkedSheet, 77 MediaListSourceLinkedSheet,
78 MediaListSourceInlineSheet, 78 MediaListSourceInlineSheet,
79 MediaListSourceMediaRule, 79 MediaListSourceMediaRule,
80 MediaListSourceImportRule 80 MediaListSourceImportRule
(...skipping 12 matching lines...) Expand all
93 m_contentSecurityPolicy->setOverrideAllowInlineStyle(false); 93 m_contentSecurityPolicy->setOverrideAllowInlineStyle(false);
94 } 94 }
95 95
96 private: 96 private:
97 ContentSecurityPolicy* m_contentSecurityPolicy; 97 ContentSecurityPolicy* m_contentSecurityPolicy;
98 }; 98 };
99 99
100 static CSSStyleRule* asCSSStyleRule(CSSRule*); 100 static CSSStyleRule* asCSSStyleRule(CSSRule*);
101 static bool cssErrorFilter(const CSSParserString& content, int propertyId, i nt errorType); 101 static bool cssErrorFilter(const CSSParserString& content, int propertyId, i nt errorType);
102 102
103 static PassOwnPtr<InspectorCSSAgent> create(InstrumentingAgents* instrumenti ngAgents, InspectorCompositeState* state, InspectorDOMAgent* domAgent, Inspector PageAgent* pageAgent) 103 static PassRefPtr<InspectorCSSAgent> create(InstrumentingAgents* instrumenti ngAgents, InspectorState* state, PassRefPtr<InspectorDOMAgent> domAgent, PassRef Ptr<InspectorPageAgent> pageAgent)
104 { 104 {
105 return adoptPtr(new InspectorCSSAgent(instrumentingAgents, state, domAge nt, pageAgent)); 105 return adoptRef(new InspectorCSSAgent(instrumentingAgents, state, domAge nt, pageAgent));
106 } 106 }
107 ~InspectorCSSAgent(); 107 ~InspectorCSSAgent();
108 108
109 bool forcePseudoState(Element*, CSSSelector::PseudoType); 109 bool forcePseudoState(Element*, CSSSelector::PseudoType);
110 virtual void setFrontend(InspectorFrontend*); 110 virtual void setFrontend(InspectorFrontend*);
111 virtual void clearFrontend(); 111 virtual void clearFrontend();
112 virtual void discardAgent(); 112 virtual void discardAgent();
113 virtual void restore(); 113 virtual void restore();
114 virtual void enable(ErrorString*); 114 virtual void enable(ErrorString*);
115 virtual void disable(ErrorString*); 115 virtual void disable(ErrorString*);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 152
153 private: 153 private:
154 class StyleSheetAction; 154 class StyleSheetAction;
155 class SetStyleSheetTextAction; 155 class SetStyleSheetTextAction;
156 class SetStyleTextAction; 156 class SetStyleTextAction;
157 class SetPropertyTextAction; 157 class SetPropertyTextAction;
158 class TogglePropertyAction; 158 class TogglePropertyAction;
159 class SetRuleSelectorAction; 159 class SetRuleSelectorAction;
160 class AddRuleAction; 160 class AddRuleAction;
161 161
162 InspectorCSSAgent(InstrumentingAgents*, InspectorCompositeState*, InspectorD OMAgent*, InspectorPageAgent*); 162 InspectorCSSAgent(InstrumentingAgents*, InspectorState*, PassRefPtr<Inspecto rDOMAgent>, PassRefPtr<InspectorPageAgent>);
163 163
164 typedef HashMap<String, RefPtr<InspectorStyleSheet> > IdToInspectorStyleShee t; 164 typedef HashMap<String, RefPtr<InspectorStyleSheet> > IdToInspectorStyleShee t;
165 typedef HashMap<Node*, RefPtr<InspectorStyleSheetForInlineStyle> > NodeToIns pectorStyleSheet; // bogus "stylesheets" with elements' inline styles 165 typedef HashMap<Node*, RefPtr<InspectorStyleSheetForInlineStyle> > NodeToIns pectorStyleSheet; // bogus "stylesheets" with elements' inline styles
166 typedef HashMap<RefPtr<Document>, RefPtr<InspectorStyleSheet> > DocumentToVi aInspectorStyleSheet; // "via inspector" stylesheets 166 typedef HashMap<RefPtr<Document>, RefPtr<InspectorStyleSheet> > DocumentToVi aInspectorStyleSheet; // "via inspector" stylesheets
167 typedef HashMap<int, unsigned> NodeIdToForcedPseudoState; 167 typedef HashMap<int, unsigned> NodeIdToForcedPseudoState;
168 168
169 void resetNonPersistentData(); 169 void resetNonPersistentData();
170 InspectorStyleSheetForInlineStyle* asInspectorStyleSheet(Element* element); 170 InspectorStyleSheetForInlineStyle* asInspectorStyleSheet(Element* element);
171 Element* elementForId(ErrorString*, int nodeId); 171 Element* elementForId(ErrorString*, int nodeId);
172 int documentNodeWithRequestedFlowsId(Document*); 172 int documentNodeWithRequestedFlowsId(Document*);
(...skipping 17 matching lines...) Expand all
190 virtual void didRemoveDocument(Document*); 190 virtual void didRemoveDocument(Document*);
191 virtual void didRemoveDOMNode(Node*); 191 virtual void didRemoveDOMNode(Node*);
192 virtual void didModifyDOMAttr(Element*); 192 virtual void didModifyDOMAttr(Element*);
193 193
194 // InspectorCSSAgent::Listener implementation 194 // InspectorCSSAgent::Listener implementation
195 virtual void styleSheetChanged(InspectorStyleSheet*); 195 virtual void styleSheetChanged(InspectorStyleSheet*);
196 196
197 void resetPseudoStates(); 197 void resetPseudoStates();
198 198
199 InspectorFrontend::CSS* m_frontend; 199 InspectorFrontend::CSS* m_frontend;
200 InspectorDOMAgent* m_domAgent; 200 RefPtr<InspectorDOMAgent> m_domAgent;
201 InspectorPageAgent* m_pageAgent; 201 RefPtr<InspectorPageAgent> m_pageAgent;
202 202
203 IdToInspectorStyleSheet m_idToInspectorStyleSheet; 203 IdToInspectorStyleSheet m_idToInspectorStyleSheet;
204 CSSStyleSheetToInspectorStyleSheet m_cssStyleSheetToInspectorStyleSheet; 204 CSSStyleSheetToInspectorStyleSheet m_cssStyleSheetToInspectorStyleSheet;
205 NodeToInspectorStyleSheet m_nodeToInspectorStyleSheet; 205 NodeToInspectorStyleSheet m_nodeToInspectorStyleSheet;
206 DocumentToViaInspectorStyleSheet m_documentToInspectorStyleSheet; 206 DocumentToViaInspectorStyleSheet m_documentToInspectorStyleSheet;
207 NodeIdToForcedPseudoState m_nodeIdToForcedPseudoState; 207 NodeIdToForcedPseudoState m_nodeIdToForcedPseudoState;
208 HashSet<int> m_namedFlowCollectionsRequested; 208 HashSet<int> m_namedFlowCollectionsRequested;
209 OwnPtr<UpdateRegionLayoutTask> m_updateRegionLayoutTask; 209 OwnPtr<UpdateRegionLayoutTask> m_updateRegionLayoutTask;
210 210
211 int m_lastStyleSheetId; 211 int m_lastStyleSheetId;
212 bool m_creatingViaInspectorStyleSheet; 212 bool m_creatingViaInspectorStyleSheet;
213 213
214 OwnPtr<SelectorProfile> m_currentSelectorProfile; 214 OwnPtr<SelectorProfile> m_currentSelectorProfile;
215 215
216 friend class StyleSheetBinder; 216 friend class StyleSheetBinder;
217 }; 217 };
218 218
219 class InspectorCSSController: public InspectorBaseController<InspectorCSSControl ler, InspectorCSSAgent> {
220 public:
221
222 static PassOwnPtr<InspectorCSSController> create(InstrumentingAgents* instru mentingAgents, InspectorCompositeState* compositeState, InspectorDOMController* domController, InspectorPageController* pageController)
223 {
224 return adoptPtr(new InspectorCSSController(instrumentingAgents, composit eState, domController, pageController));
225 }
226
227 protected:
228 InspectorCSSController(InstrumentingAgents*, InspectorCompositeState*, Inspe ctorDOMController*, InspectorPageController*);
229 };
219 230
220 } // namespace WebCore 231 } // namespace WebCore
221 232
222 #endif // !defined(InspectorCSSAgent_h) 233 #endif // !defined(InspectorCSSAgent_h)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698