OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "modules/device_orientation/DeviceOrientationInspectorAgent.h" | 6 #include "modules/device_orientation/DeviceOrientationInspectorAgent.h" |
7 | 7 |
8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
9 #include "core/frame/LocalFrame.h" | 9 #include "core/frame/LocalFrame.h" |
10 #include "core/inspector/InspectorController.h" | 10 #include "core/inspector/InspectorController.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 } | 34 } |
35 | 35 |
36 DeviceOrientationInspectorAgent::DeviceOrientationInspectorAgent(Page& page) | 36 DeviceOrientationInspectorAgent::DeviceOrientationInspectorAgent(Page& page) |
37 : InspectorBaseAgent<DeviceOrientationInspectorAgent>("DeviceOrientation") | 37 : InspectorBaseAgent<DeviceOrientationInspectorAgent>("DeviceOrientation") |
38 , m_page(page) | 38 , m_page(page) |
39 { | 39 { |
40 } | 40 } |
41 | 41 |
42 DeviceOrientationController& DeviceOrientationInspectorAgent::controller() | 42 DeviceOrientationController& DeviceOrientationInspectorAgent::controller() |
43 { | 43 { |
44 ASSERT(m_page.mainFrame()->document()); | 44 ASSERT(toLocalFrame(m_page.mainFrame())->document()); |
45 return DeviceOrientationController::from(*m_page.mainFrame()->document()); | 45 return DeviceOrientationController::from(*m_page.deprecatedLocalMainFrame()-
>document()); |
46 } | 46 } |
47 | 47 |
48 void DeviceOrientationInspectorAgent::setDeviceOrientationOverride(ErrorString*
error, double alpha, double beta, double gamma) | 48 void DeviceOrientationInspectorAgent::setDeviceOrientationOverride(ErrorString*
error, double alpha, double beta, double gamma) |
49 { | 49 { |
50 m_state->setBoolean(DeviceOrientationInspectorAgentState::overrideEnabled, t
rue); | 50 m_state->setBoolean(DeviceOrientationInspectorAgentState::overrideEnabled, t
rue); |
51 m_state->setDouble(DeviceOrientationInspectorAgentState::alpha, alpha); | 51 m_state->setDouble(DeviceOrientationInspectorAgentState::alpha, alpha); |
52 m_state->setDouble(DeviceOrientationInspectorAgentState::beta, beta); | 52 m_state->setDouble(DeviceOrientationInspectorAgentState::beta, beta); |
53 m_state->setDouble(DeviceOrientationInspectorAgentState::gamma, gamma); | 53 m_state->setDouble(DeviceOrientationInspectorAgentState::gamma, gamma); |
54 controller().setOverride(DeviceOrientationData::create(true, alpha, true, be
ta, true, gamma).get()); | 54 controller().setOverride(DeviceOrientationData::create(true, alpha, true, be
ta, true, gamma).get()); |
55 } | 55 } |
(...skipping 21 matching lines...) Expand all Loading... |
77 } | 77 } |
78 | 78 |
79 void DeviceOrientationInspectorAgent::didCommitLoadForMainFrame() | 79 void DeviceOrientationInspectorAgent::didCommitLoadForMainFrame() |
80 { | 80 { |
81 // New document in main frame - apply override there. | 81 // New document in main frame - apply override there. |
82 // No need to cleanup previous one, as it's already gone. | 82 // No need to cleanup previous one, as it's already gone. |
83 restore(); | 83 restore(); |
84 } | 84 } |
85 | 85 |
86 } // namespace WebCore | 86 } // namespace WebCore |
OLD | NEW |