OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010-2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2010-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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 : m_hostId(client->hostIdentifier()) | 200 : m_hostId(client->hostIdentifier()) |
201 , m_client(client) | 201 , m_client(client) |
202 , m_webViewImpl(webViewImpl) | 202 , m_webViewImpl(webViewImpl) |
203 , m_attached(false) | 203 , m_attached(false) |
204 , m_generatingEvent(false) | 204 , m_generatingEvent(false) |
205 , m_deviceMetricsEnabled(false) | 205 , m_deviceMetricsEnabled(false) |
206 , m_emulateViewportEnabled(false) | 206 , m_emulateViewportEnabled(false) |
207 , m_originalViewportEnabled(false) | 207 , m_originalViewportEnabled(false) |
208 , m_isOverlayScrollbarsEnabled(false) | 208 , m_isOverlayScrollbarsEnabled(false) |
209 , m_touchEventEmulationEnabled(false) | 209 , m_touchEventEmulationEnabled(false) |
210 , m_originalTouchEnabled(false) | |
211 , m_originalDeviceSupportsMouse(false) | |
212 { | 210 { |
213 ASSERT(m_hostId > 0); | 211 ASSERT(m_hostId > 0); |
214 ClientMessageLoopAdapter::ensureClientMessageLoopCreated(m_client); | 212 ClientMessageLoopAdapter::ensureClientMessageLoopCreated(m_client); |
215 } | 213 } |
216 | 214 |
217 WebDevToolsAgentImpl::~WebDevToolsAgentImpl() | 215 WebDevToolsAgentImpl::~WebDevToolsAgentImpl() |
218 { | 216 { |
219 ClientMessageLoopAdapter::inspectedViewClosed(m_webViewImpl); | 217 ClientMessageLoopAdapter::inspectedViewClosed(m_webViewImpl); |
220 if (m_attached) | 218 if (m_attached) |
221 blink::Platform::current()->currentThread()->removeTaskObserver(this); | 219 blink::Platform::current()->currentThread()->removeTaskObserver(this); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 params.deviceScaleFactor = deviceScaleFactor; | 375 params.deviceScaleFactor = deviceScaleFactor; |
378 params.viewSize = WebSize(width, height); | 376 params.viewSize = WebSize(width, height); |
379 params.fitToView = fitWindow; | 377 params.fitToView = fitWindow; |
380 params.viewInsets = WebSize(10, 10); | 378 params.viewInsets = WebSize(10, 10); |
381 m_client->enableDeviceEmulation(params); | 379 m_client->enableDeviceEmulation(params); |
382 } | 380 } |
383 } | 381 } |
384 | 382 |
385 void WebDevToolsAgentImpl::setTouchEventEmulationEnabled(bool enabled) | 383 void WebDevToolsAgentImpl::setTouchEventEmulationEnabled(bool enabled) |
386 { | 384 { |
387 if (m_touchEventEmulationEnabled == enabled) | |
388 return; | |
389 | |
390 if (!m_touchEventEmulationEnabled) { | |
391 m_originalTouchEnabled = RuntimeEnabledFeatures::touchEnabled(); | |
392 if (m_webViewImpl->page()) | |
393 m_originalDeviceSupportsMouse = m_webViewImpl->page()->settings().de
viceSupportsMouse(); | |
394 } | |
395 RuntimeEnabledFeatures::setTouchEnabled(enabled ? true : m_originalTouchEnab
led); | |
396 if (m_webViewImpl->page()) | |
397 m_webViewImpl->page()->settings().setDeviceSupportsMouse(enabled ? false
: m_originalDeviceSupportsMouse); | |
398 m_client->setTouchEventEmulationEnabled(enabled, m_emulateViewportEnabled); | 385 m_client->setTouchEventEmulationEnabled(enabled, m_emulateViewportEnabled); |
399 m_touchEventEmulationEnabled = enabled; | 386 m_touchEventEmulationEnabled = enabled; |
400 m_webViewImpl->mainFrameImpl()->frame()->view()->layout(); | |
401 } | 387 } |
402 | 388 |
403 void WebDevToolsAgentImpl::enableViewportEmulation() | 389 void WebDevToolsAgentImpl::enableViewportEmulation() |
404 { | 390 { |
405 if (m_emulateViewportEnabled) | 391 if (m_emulateViewportEnabled) |
406 return; | 392 return; |
407 m_emulateViewportEnabled = true; | 393 m_emulateViewportEnabled = true; |
408 m_isOverlayScrollbarsEnabled = RuntimeEnabledFeatures::overlayScrollbarsEnab
led(); | 394 m_isOverlayScrollbarsEnabled = RuntimeEnabledFeatures::overlayScrollbarsEnab
led(); |
409 RuntimeEnabledFeatures::setOverlayScrollbarsEnabled(true); | 395 RuntimeEnabledFeatures::setOverlayScrollbarsEnabled(true); |
410 m_originalViewportEnabled = RuntimeEnabledFeatures::cssViewportEnabled(); | 396 m_originalViewportEnabled = RuntimeEnabledFeatures::cssViewportEnabled(); |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke
ndDispatcher::kDebugger_removeBreakpointCmd) | 705 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke
ndDispatcher::kDebugger_removeBreakpointCmd) |
720 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke
ndDispatcher::kDebugger_setBreakpointsActiveCmd); | 706 || commandName == InspectorBackendDispatcher::commandName(InspectorBacke
ndDispatcher::kDebugger_setBreakpointsActiveCmd); |
721 } | 707 } |
722 | 708 |
723 void WebDevToolsAgent::processPendingMessages() | 709 void WebDevToolsAgent::processPendingMessages() |
724 { | 710 { |
725 PageScriptDebugServer::shared().runPendingTasks(); | 711 PageScriptDebugServer::shared().runPendingTasks(); |
726 } | 712 } |
727 | 713 |
728 } // namespace blink | 714 } // namespace blink |
OLD | NEW |