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

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

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) 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 bool InspectorPageAgent::dataContent(const char* data, unsigned size, const Stri ng& textEncodingName, bool withBase64Encode, String* result) 232 bool InspectorPageAgent::dataContent(const char* data, unsigned size, const Stri ng& textEncodingName, bool withBase64Encode, String* result)
233 { 233 {
234 if (withBase64Encode) { 234 if (withBase64Encode) {
235 *result = base64Encode(data, size); 235 *result = base64Encode(data, size);
236 return true; 236 return true;
237 } 237 }
238 238
239 return decodeBuffer(data, size, textEncodingName, result); 239 return decodeBuffer(data, size, textEncodingName, result);
240 } 240 }
241 241
242 PassOwnPtr<InspectorPageAgent> InspectorPageAgent::create(InstrumentingAgents* i nstrumentingAgents, Page* page, InspectorCompositeState* state, InjectedScriptMa nager* injectedScriptManager, InspectorClient* client, InspectorOverlay* overlay ) 242 PassRefPtr<InspectorPageAgent> InspectorPageAgent::create(InstrumentingAgents* i nstrumentingAgents, InspectorState* state, Page* page, InjectedScriptManager* in jectedScriptManager, InspectorOverlay* overlay, InspectorClient* client)
243 { 243 {
244 return adoptPtr(new InspectorPageAgent(instrumentingAgents, page, state, inj ectedScriptManager, client, overlay)); 244 return adoptRef(new InspectorPageAgent(instrumentingAgents, state, page, inj ectedScriptManager, overlay, client));
245 } 245 }
246 246
247 // static 247 // static
248 void InspectorPageAgent::resourceContent(ErrorString* errorString, Frame* frame, const KURL& url, String* result, bool* base64Encoded) 248 void InspectorPageAgent::resourceContent(ErrorString* errorString, Frame* frame, const KURL& url, String* result, bool* base64Encoded)
249 { 249 {
250 DocumentLoader* loader = assertDocumentLoader(errorString, frame); 250 DocumentLoader* loader = assertDocumentLoader(errorString, frame);
251 if (!loader) 251 if (!loader)
252 return; 252 return;
253 if (!cachedResourceContent(cachedResource(frame, url), result, base64Encoded )) 253 if (!cachedResourceContent(cachedResource(frame, url), result, base64Encoded ))
254 *errorString = "No resource with given URL found"; 254 *errorString = "No resource with given URL found";
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 break; 306 break;
307 } 307 }
308 return InspectorPageAgent::OtherResource; 308 return InspectorPageAgent::OtherResource;
309 } 309 }
310 310
311 TypeBuilder::Page::ResourceType::Enum InspectorPageAgent::cachedResourceTypeJson (const CachedResource& cachedResource) 311 TypeBuilder::Page::ResourceType::Enum InspectorPageAgent::cachedResourceTypeJson (const CachedResource& cachedResource)
312 { 312 {
313 return resourceTypeJson(cachedResourceType(cachedResource)); 313 return resourceTypeJson(cachedResourceType(cachedResource));
314 } 314 }
315 315
316 InspectorPageAgent::InspectorPageAgent(InstrumentingAgents* instrumentingAgents, Page* page, InspectorCompositeState* inspectorState, InjectedScriptManager* inj ectedScriptManager, InspectorClient* client, InspectorOverlay* overlay) 316 InspectorPageAgent::InspectorPageAgent(InstrumentingAgents* instrumentingAgents, InspectorState* inspectorState, Page* page, InjectedScriptManager* injectedScri ptManager, InspectorOverlay* overlay, InspectorClient* client)
317 : InspectorBaseAgent<InspectorPageAgent>("Page", instrumentingAgents, inspec torState) 317 : InspectorBaseAgent(instrumentingAgents, inspectorState)
318 , m_page(page) 318 , m_page(page)
319 , m_injectedScriptManager(injectedScriptManager) 319 , m_injectedScriptManager(injectedScriptManager)
320 , m_client(client) 320 , m_client(client)
321 , m_frontend(0) 321 , m_frontend(0)
322 , m_overlay(overlay) 322 , m_overlay(overlay)
323 , m_lastScriptIdentifier(0) 323 , m_lastScriptIdentifier(0)
324 , m_enabled(false) 324 , m_enabled(false)
325 , m_isFirstLayoutAfterOnLoad(false) 325 , m_isFirstLayoutAfterOnLoad(false)
326 , m_geolocationOverridden(false) 326 , m_geolocationOverridden(false)
327 , m_ignoreScriptsEnabledNotification(false) 327 , m_ignoreScriptsEnabledNotification(false)
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after
1258 } 1258 }
1259 1259
1260 void InspectorPageAgent::setShowViewportSizeOnResize(ErrorString*, bool show, co nst bool* showGrid) 1260 void InspectorPageAgent::setShowViewportSizeOnResize(ErrorString*, bool show, co nst bool* showGrid)
1261 { 1261 {
1262 m_state->setBoolean(PageAgentState::showSizeOnResize, show); 1262 m_state->setBoolean(PageAgentState::showSizeOnResize, show);
1263 m_state->setBoolean(PageAgentState::showGridOnResize, showGrid && *showGrid) ; 1263 m_state->setBoolean(PageAgentState::showGridOnResize, showGrid && *showGrid) ;
1264 } 1264 }
1265 1265
1266 } // namespace WebCore 1266 } // namespace WebCore
1267 1267
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698