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

Side by Side Diff: Source/modules/screen_orientation/ScreenOrientation.cpp

Issue 364253007: Revert of [screen-orientation] Expose orientation info in OrientationInformation interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 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
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/screen_orientation/ScreenOrientation.h" 6 #include "modules/screen_orientation/ScreenOrientation.h"
7 7
8 #include "bindings/core/v8/ScriptPromise.h" 8 #include "bindings/core/v8/ScriptPromise.h"
9 #include "bindings/core/v8/ScriptPromiseResolver.h" 9 #include "bindings/core/v8/ScriptPromiseResolver.h"
10 #include "core/dom/DOMException.h" 10 #include "core/dom/DOMException.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 supplement = new ScreenOrientation(screen); 109 supplement = new ScreenOrientation(screen);
110 provideTo(screen, supplementName(), adoptPtrWillBeNoop(supplement)); 110 provideTo(screen, supplementName(), adoptPtrWillBeNoop(supplement));
111 } 111 }
112 return *supplement; 112 return *supplement;
113 } 113 }
114 114
115 ScreenOrientation::~ScreenOrientation() 115 ScreenOrientation::~ScreenOrientation()
116 { 116 {
117 } 117 }
118 118
119 OrientationInformation* ScreenOrientation::orientation(Screen& screen) 119 const AtomicString& ScreenOrientation::orientation(Screen& screen)
120 { 120 {
121 ScreenOrientation& screenOrientation = ScreenOrientation::from(screen); 121 ScreenOrientation& screenOrientation = ScreenOrientation::from(screen);
122 if (!screenOrientation.frame()) { 122 if (!screenOrientation.frame()) {
123 return 0; 123 // FIXME: we should try to return a better guess, like the latest known value.
124 return orientationTypeToString(blink::WebScreenOrientationPortraitPrimar y);
124 } 125 }
125 return ScreenOrientationController::from(*screenOrientation.frame()).orienta tion(); 126 ScreenOrientationController& controller = ScreenOrientationController::from( *screenOrientation.frame());
127 return orientationTypeToString(controller.orientation());
126 } 128 }
127 129
128 ScriptPromise ScreenOrientation::lockOrientation(ScriptState* state, Screen& scr een, const AtomicString& lockString) 130 ScriptPromise ScreenOrientation::lockOrientation(ScriptState* state, Screen& scr een, const AtomicString& lockString)
129 { 131 {
130 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(state ); 132 RefPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(state );
131 ScriptPromise promise = resolver->promise(); 133 ScriptPromise promise = resolver->promise();
132 134
133 ScreenOrientation& screenOrientation = ScreenOrientation::from(screen); 135 ScreenOrientation& screenOrientation = ScreenOrientation::from(screen);
134 Document* document = screenOrientation.document(); 136 Document* document = screenOrientation.document();
135 137
(...skipping 16 matching lines...) Expand all
152 void ScreenOrientation::unlockOrientation(Screen& screen) 154 void ScreenOrientation::unlockOrientation(Screen& screen)
153 { 155 {
154 ScreenOrientation& screenOrientation = ScreenOrientation::from(screen); 156 ScreenOrientation& screenOrientation = ScreenOrientation::from(screen);
155 if (!screenOrientation.frame()) 157 if (!screenOrientation.frame())
156 return; 158 return;
157 159
158 ScreenOrientationController::from(*screenOrientation.frame()).unlockOrientat ion(); 160 ScreenOrientationController::from(*screenOrientation.frame()).unlockOrientat ion();
159 } 161 }
160 162
161 } // namespace WebCore 163 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/modules/screen_orientation/ScreenOrientation.h ('k') | Source/modules/screen_orientation/ScreenOrientation.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698