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

Side by Side Diff: Source/modules/device_orientation/DeviceOrientationInspectorAgent.cpp

Issue 1186823014: [bindings] Eliminate custom bindings for DeviceOrientationEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Initialize the constructor to be null Created 5 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
« no previous file with comments | « Source/modules/device_orientation/DeviceOrientationEvent.idl ('k') | 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 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/frame/LocalFrame.h" 8 #include "core/frame/LocalFrame.h"
9 #include "core/inspector/InspectorState.h" 9 #include "core/inspector/InspectorState.h"
10 #include "core/page/Page.h" 10 #include "core/page/Page.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 ASSERT(toLocalFrame(m_page.mainFrame())->document()); 42 ASSERT(toLocalFrame(m_page.mainFrame())->document());
43 return DeviceOrientationController::from(*m_page.deprecatedLocalMainFrame()- >document()); 43 return DeviceOrientationController::from(*m_page.deprecatedLocalMainFrame()- >document());
44 } 44 }
45 45
46 void DeviceOrientationInspectorAgent::setDeviceOrientationOverride(ErrorString* error, double alpha, double beta, double gamma) 46 void DeviceOrientationInspectorAgent::setDeviceOrientationOverride(ErrorString* error, double alpha, double beta, double gamma)
47 { 47 {
48 m_state->setBoolean(DeviceOrientationInspectorAgentState::overrideEnabled, t rue); 48 m_state->setBoolean(DeviceOrientationInspectorAgentState::overrideEnabled, t rue);
49 m_state->setDouble(DeviceOrientationInspectorAgentState::alpha, alpha); 49 m_state->setDouble(DeviceOrientationInspectorAgentState::alpha, alpha);
50 m_state->setDouble(DeviceOrientationInspectorAgentState::beta, beta); 50 m_state->setDouble(DeviceOrientationInspectorAgentState::beta, beta);
51 m_state->setDouble(DeviceOrientationInspectorAgentState::gamma, gamma); 51 m_state->setDouble(DeviceOrientationInspectorAgentState::gamma, gamma);
52 controller().setOverride(DeviceOrientationData::create(true, alpha, true, be ta, true, gamma)); 52 controller().setOverride(DeviceOrientationData::create(alpha, beta, gamma));
53 } 53 }
54 54
55 void DeviceOrientationInspectorAgent::clearDeviceOrientationOverride(ErrorString * error) 55 void DeviceOrientationInspectorAgent::clearDeviceOrientationOverride(ErrorString * error)
56 { 56 {
57 m_state->setBoolean(DeviceOrientationInspectorAgentState::overrideEnabled, f alse); 57 m_state->setBoolean(DeviceOrientationInspectorAgentState::overrideEnabled, f alse);
58 controller().clearOverride(); 58 controller().clearOverride();
59 } 59 }
60 60
61 void DeviceOrientationInspectorAgent::disable(ErrorString*) 61 void DeviceOrientationInspectorAgent::disable(ErrorString*)
62 { 62 {
63 m_state->setBoolean(DeviceOrientationInspectorAgentState::overrideEnabled, f alse); 63 m_state->setBoolean(DeviceOrientationInspectorAgentState::overrideEnabled, f alse);
64 controller().clearOverride(); 64 controller().clearOverride();
65 } 65 }
66 66
67 void DeviceOrientationInspectorAgent::restore() 67 void DeviceOrientationInspectorAgent::restore()
68 { 68 {
69 if (m_state->getBoolean(DeviceOrientationInspectorAgentState::overrideEnable d)) { 69 if (m_state->getBoolean(DeviceOrientationInspectorAgentState::overrideEnable d)) {
70 double alpha = m_state->getDouble(DeviceOrientationInspectorAgentState:: alpha); 70 double alpha = m_state->getDouble(DeviceOrientationInspectorAgentState:: alpha);
71 double beta = m_state->getDouble(DeviceOrientationInspectorAgentState::b eta); 71 double beta = m_state->getDouble(DeviceOrientationInspectorAgentState::b eta);
72 double gamma = m_state->getDouble(DeviceOrientationInspectorAgentState:: gamma); 72 double gamma = m_state->getDouble(DeviceOrientationInspectorAgentState:: gamma);
73 controller().setOverride(DeviceOrientationData::create(true, alpha, true , beta, true, gamma)); 73 controller().setOverride(DeviceOrientationData::create(alpha, beta, gamm a));
74 } 74 }
75 } 75 }
76 76
77 void DeviceOrientationInspectorAgent::didCommitLoadForLocalFrame(LocalFrame* fra me) 77 void DeviceOrientationInspectorAgent::didCommitLoadForLocalFrame(LocalFrame* fra me)
78 { 78 {
79 // FIXME(dgozman): adapt this for out-of-process iframes. 79 // FIXME(dgozman): adapt this for out-of-process iframes.
80 if (frame != m_page.mainFrame()) 80 if (frame != m_page.mainFrame())
81 return; 81 return;
82 82
83 // New document in main frame - apply override there. 83 // New document in main frame - apply override there.
84 // No need to cleanup previous one, as it's already gone. 84 // No need to cleanup previous one, as it's already gone.
85 restore(); 85 restore();
86 } 86 }
87 87
88 } // namespace blink 88 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/device_orientation/DeviceOrientationEvent.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698