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

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

Issue 31063004: Have Frame::loader() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 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
« no previous file with comments | « Source/core/inspector/InspectorOverlay.cpp ('k') | Source/core/loader/CookieJar.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 *error = "Script not found"; 437 *error = "Script not found";
438 return; 438 return;
439 } 439 }
440 scripts->remove(identifier); 440 scripts->remove(identifier);
441 } 441 }
442 442
443 void InspectorPageAgent::reload(ErrorString*, const bool* const optionalIgnoreCa che, const String* optionalScriptToEvaluateOnLoad, const String* optionalScriptP reprocessor) 443 void InspectorPageAgent::reload(ErrorString*, const bool* const optionalIgnoreCa che, const String* optionalScriptToEvaluateOnLoad, const String* optionalScriptP reprocessor)
444 { 444 {
445 m_pendingScriptToEvaluateOnLoadOnce = optionalScriptToEvaluateOnLoad ? *opti onalScriptToEvaluateOnLoad : ""; 445 m_pendingScriptToEvaluateOnLoadOnce = optionalScriptToEvaluateOnLoad ? *opti onalScriptToEvaluateOnLoad : "";
446 m_pendingScriptPreprocessor = optionalScriptPreprocessor ? *optionalScriptPr eprocessor : ""; 446 m_pendingScriptPreprocessor = optionalScriptPreprocessor ? *optionalScriptPr eprocessor : "";
447 m_page->mainFrame()->loader()->reload(optionalIgnoreCache && *optionalIgnore Cache ? EndToEndReload : NormalReload); 447 m_page->mainFrame()->loader().reload(optionalIgnoreCache && *optionalIgnoreC ache ? EndToEndReload : NormalReload);
448 } 448 }
449 449
450 void InspectorPageAgent::navigate(ErrorString*, const String& url) 450 void InspectorPageAgent::navigate(ErrorString*, const String& url)
451 { 451 {
452 UserGestureIndicator indicator(DefinitelyProcessingNewUserGesture); 452 UserGestureIndicator indicator(DefinitelyProcessingNewUserGesture);
453 Frame* frame = m_page->mainFrame(); 453 Frame* frame = m_page->mainFrame();
454 FrameLoadRequest request(frame->document()->securityOrigin(), ResourceReques t(frame->document()->completeURL(url))); 454 FrameLoadRequest request(frame->document()->securityOrigin(), ResourceReques t(frame->document()->completeURL(url)));
455 frame->loader()->load(request); 455 frame->loader().load(request);
456 } 456 }
457 457
458 void InspectorPageAgent::getNavigationHistory(ErrorString*, int*, RefPtr<TypeBui lder::Array<TypeBuilder::Page::NavigationEntry> >&) 458 void InspectorPageAgent::getNavigationHistory(ErrorString*, int*, RefPtr<TypeBui lder::Array<TypeBuilder::Page::NavigationEntry> >&)
459 { } 459 { }
460 460
461 void InspectorPageAgent::navigateToHistoryEntry(ErrorString*, int) 461 void InspectorPageAgent::navigateToHistoryEntry(ErrorString*, int)
462 { } 462 { }
463 463
464 static PassRefPtr<TypeBuilder::Page::Cookie> buildObjectForCookie(const Cookie& cookie) 464 static PassRefPtr<TypeBuilder::Page::Cookie> buildObjectForCookie(const Cookie& cookie)
465 { 465 {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 result.append(cachedResource); 516 result.append(cachedResource);
517 } 517 }
518 518
519 return result; 519 return result;
520 } 520 }
521 521
522 static Vector<KURL> allResourcesURLsForFrame(Frame* frame) 522 static Vector<KURL> allResourcesURLsForFrame(Frame* frame)
523 { 523 {
524 Vector<KURL> result; 524 Vector<KURL> result;
525 525
526 result.append(urlWithoutFragment(frame->loader()->documentLoader()->url())); 526 result.append(urlWithoutFragment(frame->loader().documentLoader()->url()));
527 527
528 Vector<Resource*> allResources = cachedResourcesForFrame(frame); 528 Vector<Resource*> allResources = cachedResourcesForFrame(frame);
529 for (Vector<Resource*>::const_iterator it = allResources.begin(); it != allR esources.end(); ++it) 529 for (Vector<Resource*>::const_iterator it = allResources.begin(); it != allR esources.end(); ++it)
530 result.append(urlWithoutFragment((*it)->url())); 530 result.append(urlWithoutFragment((*it)->url()));
531 531
532 return result; 532 return result;
533 } 533 }
534 534
535 void InspectorPageAgent::getCookies(ErrorString*, RefPtr<TypeBuilder::Array<Type Builder::Page::Cookie> >& cookies, WTF::String* cookiesString) 535 void InspectorPageAgent::getCookies(ErrorString*, RefPtr<TypeBuilder::Array<Type Builder::Page::Cookie> >& cookies, WTF::String* cookiesString)
536 { 536 {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 void InspectorPageAgent::searchInResource(ErrorString*, const String& frameId, c onst String& url, const String& query, const bool* const optionalCaseSensitive, const bool* const optionalIsRegex, RefPtr<TypeBuilder::Array<TypeBuilder::Page:: SearchMatch> >& results) 591 void InspectorPageAgent::searchInResource(ErrorString*, const String& frameId, c onst String& url, const String& query, const bool* const optionalCaseSensitive, const bool* const optionalIsRegex, RefPtr<TypeBuilder::Array<TypeBuilder::Page:: SearchMatch> >& results)
592 { 592 {
593 results = TypeBuilder::Array<TypeBuilder::Page::SearchMatch>::create(); 593 results = TypeBuilder::Array<TypeBuilder::Page::SearchMatch>::create();
594 594
595 bool isRegex = optionalIsRegex ? *optionalIsRegex : false; 595 bool isRegex = optionalIsRegex ? *optionalIsRegex : false;
596 bool caseSensitive = optionalCaseSensitive ? *optionalCaseSensitive : false; 596 bool caseSensitive = optionalCaseSensitive ? *optionalCaseSensitive : false;
597 597
598 Frame* frame = frameForId(frameId); 598 Frame* frame = frameForId(frameId);
599 KURL kurl(ParsedURLString, url); 599 KURL kurl(ParsedURLString, url);
600 600
601 FrameLoader* frameLoader = frame ? frame->loader() : 0; 601 FrameLoader* frameLoader = frame ? &frame->loader() : 0;
602 DocumentLoader* loader = frameLoader ? frameLoader->documentLoader() : 0; 602 DocumentLoader* loader = frameLoader ? frameLoader->documentLoader() : 0;
603 if (!loader) 603 if (!loader)
604 return; 604 return;
605 605
606 String content; 606 String content;
607 bool success = false; 607 bool success = false;
608 Resource* resource = cachedResource(frame, kurl); 608 Resource* resource = cachedResource(frame, kurl);
609 if (resource) 609 if (resource)
610 success = textContentForResource(resource, &content); 610 success = textContentForResource(resource, &content);
611 611
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 if (!deprecatedHeaderSourceMapURL.isEmpty()) { 929 if (!deprecatedHeaderSourceMapURL.isEmpty()) {
930 // FIXME: add deprecated console message here. 930 // FIXME: add deprecated console message here.
931 return deprecatedHeaderSourceMapURL; 931 return deprecatedHeaderSourceMapURL;
932 } 932 }
933 return resource->response().httpHeaderField(sourceMapHttpHeader); 933 return resource->response().httpHeaderField(sourceMapHttpHeader);
934 } 934 }
935 935
936 // static 936 // static
937 DocumentLoader* InspectorPageAgent::assertDocumentLoader(ErrorString* errorStrin g, Frame* frame) 937 DocumentLoader* InspectorPageAgent::assertDocumentLoader(ErrorString* errorStrin g, Frame* frame)
938 { 938 {
939 FrameLoader* frameLoader = frame->loader(); 939 DocumentLoader* documentLoader = frame->loader().documentLoader();
940 DocumentLoader* documentLoader = frameLoader ? frameLoader->documentLoader() : 0;
941 if (!documentLoader) 940 if (!documentLoader)
942 *errorString = "No documentLoader for given frame found"; 941 *errorString = "No documentLoader for given frame found";
943 return documentLoader; 942 return documentLoader;
944 } 943 }
945 944
946 void InspectorPageAgent::loaderDetachedFromFrame(DocumentLoader* loader) 945 void InspectorPageAgent::loaderDetachedFromFrame(DocumentLoader* loader)
947 { 946 {
948 HashMap<DocumentLoader*, String>::iterator iterator = m_loaderToIdentifier.f ind(loader); 947 HashMap<DocumentLoader*, String>::iterator iterator = m_loaderToIdentifier.f ind(loader);
949 if (iterator != m_loaderToIdentifier.end()) 948 if (iterator != m_loaderToIdentifier.end())
950 m_loaderToIdentifier.remove(iterator); 949 m_loaderToIdentifier.remove(iterator);
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 if (m_ignoreScriptsEnabledNotification) 1026 if (m_ignoreScriptsEnabledNotification)
1028 return; 1027 return;
1029 1028
1030 m_frontend->scriptsEnabled(isEnabled); 1029 m_frontend->scriptsEnabled(isEnabled);
1031 } 1030 }
1032 1031
1033 PassRefPtr<TypeBuilder::Page::Frame> InspectorPageAgent::buildObjectForFrame(Fra me* frame) 1032 PassRefPtr<TypeBuilder::Page::Frame> InspectorPageAgent::buildObjectForFrame(Fra me* frame)
1034 { 1033 {
1035 RefPtr<TypeBuilder::Page::Frame> frameObject = TypeBuilder::Page::Frame::cre ate() 1034 RefPtr<TypeBuilder::Page::Frame> frameObject = TypeBuilder::Page::Frame::cre ate()
1036 .setId(frameId(frame)) 1035 .setId(frameId(frame))
1037 .setLoaderId(loaderId(frame->loader()->documentLoader())) 1036 .setLoaderId(loaderId(frame->loader().documentLoader()))
1038 .setUrl(urlWithoutFragment(frame->document()->url()).string()) 1037 .setUrl(urlWithoutFragment(frame->document()->url()).string())
1039 .setMimeType(frame->loader()->documentLoader()->responseMIMEType()) 1038 .setMimeType(frame->loader().documentLoader()->responseMIMEType())
1040 .setSecurityOrigin(frame->document()->securityOrigin()->toRawString()); 1039 .setSecurityOrigin(frame->document()->securityOrigin()->toRawString());
1041 if (frame->tree().parent()) 1040 if (frame->tree().parent())
1042 frameObject->setParentId(frameId(frame->tree().parent())); 1041 frameObject->setParentId(frameId(frame->tree().parent()));
1043 if (frame->ownerElement()) { 1042 if (frame->ownerElement()) {
1044 String name = frame->ownerElement()->getNameAttribute(); 1043 String name = frame->ownerElement()->getNameAttribute();
1045 if (name.isEmpty()) 1044 if (name.isEmpty())
1046 name = frame->ownerElement()->getAttribute(HTMLNames::idAttr); 1045 name = frame->ownerElement()->getAttribute(HTMLNames::idAttr);
1047 frameObject->setName(name); 1046 frameObject->setName(name);
1048 } 1047 }
1049 1048
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
1290 } 1289 }
1291 1290
1292 void InspectorPageAgent::setShowViewportSizeOnResize(ErrorString*, bool show, co nst bool* showGrid) 1291 void InspectorPageAgent::setShowViewportSizeOnResize(ErrorString*, bool show, co nst bool* showGrid)
1293 { 1292 {
1294 m_state->setBoolean(PageAgentState::showSizeOnResize, show); 1293 m_state->setBoolean(PageAgentState::showSizeOnResize, show);
1295 m_state->setBoolean(PageAgentState::showGridOnResize, showGrid && *showGrid) ; 1294 m_state->setBoolean(PageAgentState::showGridOnResize, showGrid && *showGrid) ;
1296 } 1295 }
1297 1296
1298 } // namespace WebCore 1297 } // namespace WebCore
1299 1298
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorOverlay.cpp ('k') | Source/core/loader/CookieJar.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698