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

Side by Side Diff: third_party/WebKit/Source/web/DevToolsEmulator.cpp

Issue 1622633003: [DevTools] Check that mainFrameImpl() has been initalized before accessing it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "web/DevToolsEmulator.h" 5 #include "web/DevToolsEmulator.h"
6 6
7 #include "core/frame/FrameHost.h" 7 #include "core/frame/FrameHost.h"
8 #include "core/frame/FrameView.h" 8 #include "core/frame/FrameView.h"
9 #include "core/frame/Settings.h" 9 #include "core/frame/Settings.h"
10 #include "core/page/Page.h" 10 #include "core/page/Page.h"
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 m_originalMaxTouchPoints = m_webViewImpl->page()->settings().maxTouchPoi nts(); 309 m_originalMaxTouchPoints = m_webViewImpl->page()->settings().maxTouchPoi nts();
310 } 310 }
311 RuntimeEnabledFeatures::setTouchEnabled(enabled ? true : m_originalTouchEnab led); 311 RuntimeEnabledFeatures::setTouchEnabled(enabled ? true : m_originalTouchEnab led);
312 if (!m_originalDeviceSupportsTouch) { 312 if (!m_originalDeviceSupportsTouch) {
313 m_webViewImpl->page()->settings().setDeviceSupportsMouse(enabled ? false : m_originalDeviceSupportsMouse); 313 m_webViewImpl->page()->settings().setDeviceSupportsMouse(enabled ? false : m_originalDeviceSupportsMouse);
314 m_webViewImpl->page()->settings().setDeviceSupportsTouch(enabled ? true : m_originalDeviceSupportsTouch); 314 m_webViewImpl->page()->settings().setDeviceSupportsTouch(enabled ? true : m_originalDeviceSupportsTouch);
315 // Currently emulation does not provide multiple touch points. 315 // Currently emulation does not provide multiple touch points.
316 m_webViewImpl->page()->settings().setMaxTouchPoints(enabled ? 1 : m_orig inalMaxTouchPoints); 316 m_webViewImpl->page()->settings().setMaxTouchPoints(enabled ? 1 : m_orig inalMaxTouchPoints);
317 } 317 }
318 m_touchEventEmulationEnabled = enabled; 318 m_touchEventEmulationEnabled = enabled;
319 m_webViewImpl->mainFrameImpl()->frameView()->layout(); 319 // TODO(dgozman): mainFrameImpl() check in this class should be unnecessary.
320 // It is only needed when we reattach and restore InspectorEmulationAgent,
321 // which happens before everything has been setup correctly, and therefore
322 // fails during remote -> local main frame transition.
323 // We should instead route emulation through the WebViewImpl which has
324 // local main frame, and remove InspectorEmulationAgent entirely.
nasko 2016/01/26 19:43:07 WebViewImpl is not guaranteed to have local main f
dgozman 2016/01/27 17:54:44 Ah, right. But if we send the page-level IPC from
nasko 2016/01/27 17:55:57 Page-level IPCs in general should go to all proces
325 if (m_webViewImpl->mainFrameImpl())
326 m_webViewImpl->mainFrameImpl()->frameView()->layout();
320 } 327 }
321 328
322 void DevToolsEmulator::setScriptExecutionDisabled(bool scriptExecutionDisabled) 329 void DevToolsEmulator::setScriptExecutionDisabled(bool scriptExecutionDisabled)
323 { 330 {
324 m_scriptExecutionDisabled = scriptExecutionDisabled; 331 m_scriptExecutionDisabled = scriptExecutionDisabled;
325 m_webViewImpl->page()->settings().setScriptEnabled(m_scriptExecutionDisabled ? false : m_embedderScriptEnabled); 332 m_webViewImpl->page()->settings().setScriptEnabled(m_scriptExecutionDisabled ? false : m_embedderScriptEnabled);
326 } 333 }
327 334
328 bool DevToolsEmulator::handleInputEvent(const WebInputEvent& inputEvent) 335 bool DevToolsEmulator::handleInputEvent(const WebInputEvent& inputEvent)
329 { 336 {
(...skipping 24 matching lines...) Expand all
354 m_lastPinchAnchorCss.clear(); 361 m_lastPinchAnchorCss.clear();
355 m_lastPinchAnchorDip.clear(); 362 m_lastPinchAnchorDip.clear();
356 } 363 }
357 return true; 364 return true;
358 } 365 }
359 366
360 return false; 367 return false;
361 } 368 }
362 369
363 } // namespace blink 370 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698