| OLD | NEW |
| 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 "config.h" | 5 #include "config.h" |
| 6 #include "web/InspectorEmulationAgent.h" | 6 #include "web/InspectorEmulationAgent.h" |
| 7 | 7 |
| 8 #include "core/frame/FrameHost.h" | 8 #include "core/frame/FrameHost.h" |
| 9 #include "core/frame/FrameView.h" | 9 #include "core/frame/FrameView.h" |
| 10 #include "core/frame/Settings.h" | 10 #include "core/frame/Settings.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 InspectorEmulationAgent::InspectorEmulationAgent(WebViewImpl* webViewImpl) | 30 InspectorEmulationAgent::InspectorEmulationAgent(WebViewImpl* webViewImpl) |
| 31 : InspectorBaseAgent<InspectorEmulationAgent, InspectorFrontend::Emulation>(
"Emulation") | 31 : InspectorBaseAgent<InspectorEmulationAgent, InspectorFrontend::Emulation>(
"Emulation") |
| 32 , m_webViewImpl(webViewImpl) | 32 , m_webViewImpl(webViewImpl) |
| 33 { | 33 { |
| 34 m_webViewImpl->devToolsEmulator()->setEmulationAgent(this); | 34 m_webViewImpl->devToolsEmulator()->setEmulationAgent(this); |
| 35 } | 35 } |
| 36 | 36 |
| 37 InspectorEmulationAgent::~InspectorEmulationAgent() | 37 InspectorEmulationAgent::~InspectorEmulationAgent() |
| 38 { | 38 { |
| 39 m_webViewImpl->devToolsEmulator()->setEmulationAgent(nullptr); | |
| 40 } | 39 } |
| 41 | 40 |
| 42 void InspectorEmulationAgent::restore() | 41 void InspectorEmulationAgent::restore() |
| 43 { | 42 { |
| 44 ErrorString error; | 43 ErrorString error; |
| 45 setScriptExecutionDisabled(&error, m_state->getBoolean(EmulationAgentState::
scriptExecutionDisabled)); | 44 setScriptExecutionDisabled(&error, m_state->getBoolean(EmulationAgentState::
scriptExecutionDisabled)); |
| 46 setTouchEmulationEnabled(&error, m_state->getBoolean(EmulationAgentState::to
uchEventEmulationEnabled), nullptr); | 45 setTouchEmulationEnabled(&error, m_state->getBoolean(EmulationAgentState::to
uchEventEmulationEnabled), nullptr); |
| 47 setEmulatedMedia(&error, m_state->getString(EmulationAgentState::emulatedMed
ia)); | 46 setEmulatedMedia(&error, m_state->getString(EmulationAgentState::emulatedMed
ia)); |
| 48 } | 47 } |
| 49 | 48 |
| 50 void InspectorEmulationAgent::disable(ErrorString*) | 49 void InspectorEmulationAgent::disable(ErrorString*) |
| 51 { | 50 { |
| 52 ErrorString error; | 51 ErrorString error; |
| 53 setScriptExecutionDisabled(&error, false); | 52 setScriptExecutionDisabled(&error, false); |
| 54 setTouchEmulationEnabled(&error, false, nullptr); | 53 setTouchEmulationEnabled(&error, false, nullptr); |
| 55 setEmulatedMedia(&error, String()); | 54 setEmulatedMedia(&error, String()); |
| 56 } | 55 } |
| 57 | 56 |
| 57 void InspectorEmulationAgent::discardAgent() |
| 58 { |
| 59 m_webViewImpl->devToolsEmulator()->setEmulationAgent(nullptr); |
| 60 } |
| 61 |
| 58 void InspectorEmulationAgent::didCommitLoadForLocalFrame(LocalFrame* frame) | 62 void InspectorEmulationAgent::didCommitLoadForLocalFrame(LocalFrame* frame) |
| 59 { | 63 { |
| 60 if (frame == m_webViewImpl->mainFrameImpl()->frame()) | 64 if (frame == m_webViewImpl->mainFrameImpl()->frame()) |
| 61 viewportChanged(); | 65 viewportChanged(); |
| 62 } | 66 } |
| 63 | 67 |
| 64 void InspectorEmulationAgent::resetScrollAndPageScaleFactor(ErrorString*) | 68 void InspectorEmulationAgent::resetScrollAndPageScaleFactor(ErrorString*) |
| 65 { | 69 { |
| 66 m_webViewImpl->resetScrollAndScaleState(); | 70 m_webViewImpl->resetScrollAndScaleState(); |
| 67 } | 71 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 .setMaximumPageScaleFactor(m_webViewImpl->maximumPageScaleFactor()); | 117 .setMaximumPageScaleFactor(m_webViewImpl->maximumPageScaleFactor()); |
| 114 frontend()->viewportChanged(viewport); | 118 frontend()->viewportChanged(viewport); |
| 115 } | 119 } |
| 116 | 120 |
| 117 DEFINE_TRACE(InspectorEmulationAgent) | 121 DEFINE_TRACE(InspectorEmulationAgent) |
| 118 { | 122 { |
| 119 InspectorBaseAgent::trace(visitor); | 123 InspectorBaseAgent::trace(visitor); |
| 120 } | 124 } |
| 121 | 125 |
| 122 } // namespace blink | 126 } // namespace blink |
| OLD | NEW |