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

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

Issue 336553003: Change Page::m_mainFrame to be a Frame. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 6 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
« no previous file with comments | « Source/core/inspector/InspectorOverlay.cpp ('k') | Source/core/inspector/PageDebuggerAgent.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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 *error = "Script not found"; 466 *error = "Script not found";
467 return; 467 return;
468 } 468 }
469 scripts->remove(identifier); 469 scripts->remove(identifier);
470 } 470 }
471 471
472 void InspectorPageAgent::reload(ErrorString*, const bool* const optionalIgnoreCa che, const String* optionalScriptToEvaluateOnLoad, const String* optionalScriptP reprocessor) 472 void InspectorPageAgent::reload(ErrorString*, const bool* const optionalIgnoreCa che, const String* optionalScriptToEvaluateOnLoad, const String* optionalScriptP reprocessor)
473 { 473 {
474 m_pendingScriptToEvaluateOnLoadOnce = optionalScriptToEvaluateOnLoad ? *opti onalScriptToEvaluateOnLoad : ""; 474 m_pendingScriptToEvaluateOnLoadOnce = optionalScriptToEvaluateOnLoad ? *opti onalScriptToEvaluateOnLoad : "";
475 m_pendingScriptPreprocessor = optionalScriptPreprocessor ? *optionalScriptPr eprocessor : ""; 475 m_pendingScriptPreprocessor = optionalScriptPreprocessor ? *optionalScriptPr eprocessor : "";
476 m_page->mainFrame()->loader().reload(optionalIgnoreCache && *optionalIgnoreC ache ? EndToEndReload : NormalReload); 476 m_page->deprecatedLocalMainFrame()->loader().reload(optionalIgnoreCache && * optionalIgnoreCache ? EndToEndReload : NormalReload);
477 } 477 }
478 478
479 void InspectorPageAgent::navigate(ErrorString*, const String& url) 479 void InspectorPageAgent::navigate(ErrorString*, const String& url)
480 { 480 {
481 UserGestureIndicator indicator(DefinitelyProcessingNewUserGesture); 481 UserGestureIndicator indicator(DefinitelyProcessingNewUserGesture);
482 LocalFrame* frame = m_page->mainFrame(); 482 LocalFrame* frame = m_page->deprecatedLocalMainFrame();
483 FrameLoadRequest request(frame->document(), ResourceRequest(frame->document( )->completeURL(url))); 483 FrameLoadRequest request(frame->document(), ResourceRequest(frame->document( )->completeURL(url)));
484 frame->loader().load(request); 484 frame->loader().load(request);
485 } 485 }
486 486
487 static PassRefPtr<TypeBuilder::Page::Cookie> buildObjectForCookie(const Cookie& cookie) 487 static PassRefPtr<TypeBuilder::Page::Cookie> buildObjectForCookie(const Cookie& cookie)
488 { 488 {
489 return TypeBuilder::Page::Cookie::create() 489 return TypeBuilder::Page::Cookie::create()
490 .setName(cookie.name) 490 .setName(cookie.name)
491 .setValue(cookie.value) 491 .setValue(cookie.value)
492 .setDomain(cookie.domain) 492 .setDomain(cookie.domain)
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 { 606 {
607 KURL parsedURL(ParsedURLString, url); 607 KURL parsedURL(ParsedURLString, url);
608 for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traver seNext(m_page->mainFrame())) { 608 for (Frame* frame = m_page->mainFrame(); frame; frame = frame->tree().traver seNext(m_page->mainFrame())) {
609 if (frame->isLocalFrame()) 609 if (frame->isLocalFrame())
610 WebCore::deleteCookie(toLocalFrame(frame)->document(), parsedURL, co okieName); 610 WebCore::deleteCookie(toLocalFrame(frame)->document(), parsedURL, co okieName);
611 } 611 }
612 } 612 }
613 613
614 void InspectorPageAgent::getResourceTree(ErrorString*, RefPtr<TypeBuilder::Page: :FrameResourceTree>& object) 614 void InspectorPageAgent::getResourceTree(ErrorString*, RefPtr<TypeBuilder::Page: :FrameResourceTree>& object)
615 { 615 {
616 object = buildObjectForFrameTree(m_page->mainFrame()); 616 object = buildObjectForFrameTree(m_page->deprecatedLocalMainFrame());
617 } 617 }
618 618
619 void InspectorPageAgent::getResourceContent(ErrorString* errorString, const Stri ng& frameId, const String& url, String* content, bool* base64Encoded) 619 void InspectorPageAgent::getResourceContent(ErrorString* errorString, const Stri ng& frameId, const String& url, String* content, bool* base64Encoded)
620 { 620 {
621 LocalFrame* frame = assertFrame(errorString, frameId); 621 LocalFrame* frame = assertFrame(errorString, frameId);
622 if (!frame) 622 if (!frame)
623 return; 623 return;
624 resourceContent(errorString, frame, KURL(ParsedURLString, url), content, bas e64Encoded); 624 resourceContent(errorString, frame, KURL(ParsedURLString, url), content, bas e64Encoded);
625 } 625 }
626 626
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 HashMap<LocalFrame*, String>::iterator iterator = m_frameToIdentifier.find(f rame); 882 HashMap<LocalFrame*, String>::iterator iterator = m_frameToIdentifier.find(f rame);
883 if (iterator != m_frameToIdentifier.end()) { 883 if (iterator != m_frameToIdentifier.end()) {
884 m_frontend->frameDetached(iterator->value); 884 m_frontend->frameDetached(iterator->value);
885 m_identifierToFrame.remove(iterator->value); 885 m_identifierToFrame.remove(iterator->value);
886 m_frameToIdentifier.remove(iterator); 886 m_frameToIdentifier.remove(iterator);
887 } 887 }
888 } 888 }
889 889
890 LocalFrame* InspectorPageAgent::mainFrame() 890 LocalFrame* InspectorPageAgent::mainFrame()
891 { 891 {
892 return m_page->mainFrame(); 892 return m_page->deprecatedLocalMainFrame();
893 } 893 }
894 894
895 LocalFrame* InspectorPageAgent::frameForId(const String& frameId) 895 LocalFrame* InspectorPageAgent::frameForId(const String& frameId)
896 { 896 {
897 return frameId.isEmpty() ? 0 : m_identifierToFrame.get(frameId); 897 return frameId.isEmpty() ? 0 : m_identifierToFrame.get(frameId);
898 } 898 }
899 899
900 String InspectorPageAgent::frameId(LocalFrame* frame) 900 String InspectorPageAgent::frameId(LocalFrame* frame)
901 { 901 {
902 if (!frame) 902 if (!frame)
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 if (!m_touchEmulationEnabled) { 1190 if (!m_touchEmulationEnabled) {
1191 m_originalTouchEnabled = RuntimeEnabledFeatures::touchEnabled(); 1191 m_originalTouchEnabled = RuntimeEnabledFeatures::touchEnabled();
1192 m_originalDeviceSupportsMouse = m_page->settings().deviceSupportsMouse() ; 1192 m_originalDeviceSupportsMouse = m_page->settings().deviceSupportsMouse() ;
1193 m_originalDeviceSupportsTouch = m_page->settings().deviceSupportsTouch() ; 1193 m_originalDeviceSupportsTouch = m_page->settings().deviceSupportsTouch() ;
1194 } 1194 }
1195 RuntimeEnabledFeatures::setTouchEnabled(enabled ? true : m_originalTouchEnab led); 1195 RuntimeEnabledFeatures::setTouchEnabled(enabled ? true : m_originalTouchEnab led);
1196 m_page->settings().setDeviceSupportsMouse(enabled ? false : m_originalDevice SupportsMouse); 1196 m_page->settings().setDeviceSupportsMouse(enabled ? false : m_originalDevice SupportsMouse);
1197 m_page->settings().setDeviceSupportsTouch(enabled ? true : m_originalDeviceS upportsTouch); 1197 m_page->settings().setDeviceSupportsTouch(enabled ? true : m_originalDeviceS upportsTouch);
1198 m_touchEmulationEnabled = enabled; 1198 m_touchEmulationEnabled = enabled;
1199 m_client->setTouchEventEmulationEnabled(enabled); 1199 m_client->setTouchEventEmulationEnabled(enabled);
1200 m_page->mainFrame()->view()->layout(); 1200 m_page->deprecatedLocalMainFrame()->view()->layout();
1201 } 1201 }
1202 1202
1203 void InspectorPageAgent::hasTouchInputs(ErrorString*, bool* result) 1203 void InspectorPageAgent::hasTouchInputs(ErrorString*, bool* result)
1204 { 1204 {
1205 *result = m_touchEmulationEnabled ? m_originalDeviceSupportsTouch : m_page-> settings().deviceSupportsTouch(); 1205 *result = m_touchEmulationEnabled ? m_originalDeviceSupportsTouch : m_page-> settings().deviceSupportsTouch();
1206 } 1206 }
1207 1207
1208 void InspectorPageAgent::setTouchEmulationEnabled(ErrorString* error, bool enabl ed) 1208 void InspectorPageAgent::setTouchEmulationEnabled(ErrorString* error, bool enabl ed)
1209 { 1209 {
1210 if (m_state->getBoolean(PageAgentState::touchEventEmulationEnabled) == enabl ed) 1210 if (m_state->getBoolean(PageAgentState::touchEventEmulationEnabled) == enabl ed)
(...skipping 13 matching lines...) Expand all
1224 1224
1225 void InspectorPageAgent::setEmulatedMedia(ErrorString*, const String& media) 1225 void InspectorPageAgent::setEmulatedMedia(ErrorString*, const String& media)
1226 { 1226 {
1227 String currentMedia = m_state->getString(PageAgentState::pageAgentEmulatedMe dia); 1227 String currentMedia = m_state->getString(PageAgentState::pageAgentEmulatedMe dia);
1228 if (media == currentMedia) 1228 if (media == currentMedia)
1229 return; 1229 return;
1230 1230
1231 m_state->setString(PageAgentState::pageAgentEmulatedMedia, media); 1231 m_state->setString(PageAgentState::pageAgentEmulatedMedia, media);
1232 Document* document = 0; 1232 Document* document = 0;
1233 if (m_page->mainFrame()) 1233 if (m_page->mainFrame())
1234 document = m_page->mainFrame()->document(); 1234 document = m_page->deprecatedLocalMainFrame()->document();
1235 if (document) { 1235 if (document) {
1236 document->mediaQueryAffectingValueChanged(); 1236 document->mediaQueryAffectingValueChanged();
1237 document->styleResolverChanged(); 1237 document->styleResolverChanged();
1238 document->updateLayout(); 1238 document->updateLayout();
1239 } 1239 }
1240 } 1240 }
1241 1241
1242 bool InspectorPageAgent::applyViewportStyleOverride(StyleResolver* resolver) 1242 bool InspectorPageAgent::applyViewportStyleOverride(StyleResolver* resolver)
1243 { 1243 {
1244 if (!m_deviceMetricsOverridden || !m_emulateViewportEnabled) 1244 if (!m_deviceMetricsOverridden || !m_emulateViewportEnabled)
(...skipping 25 matching lines...) Expand all
1270 } 1270 }
1271 1271
1272 void InspectorPageAgent::setShowViewportSizeOnResize(ErrorString*, bool show, co nst bool* showGrid) 1272 void InspectorPageAgent::setShowViewportSizeOnResize(ErrorString*, bool show, co nst bool* showGrid)
1273 { 1273 {
1274 m_state->setBoolean(PageAgentState::showSizeOnResize, show); 1274 m_state->setBoolean(PageAgentState::showSizeOnResize, show);
1275 m_state->setBoolean(PageAgentState::showGridOnResize, showGrid && *showGrid) ; 1275 m_state->setBoolean(PageAgentState::showGridOnResize, showGrid && *showGrid) ;
1276 } 1276 }
1277 1277
1278 } // namespace WebCore 1278 } // namespace WebCore
1279 1279
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorOverlay.cpp ('k') | Source/core/inspector/PageDebuggerAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698