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

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

Issue 219463003: Screen Orientation API: cleanup, simplify and fix implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 8 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/ScreenOrientationDispatcher.h" 6 #include "modules/screen_orientation/ScreenOrientationDispatcher.h"
7 7
8 #include "modules/screen_orientation/ScreenOrientationController.h" 8 #include "modules/screen_orientation/ScreenOrientationController.h"
9 #include "public/platform/Platform.h" 9 #include "public/platform/Platform.h"
10 #include "wtf/TemporaryChange.h" 10 #include "wtf/TemporaryChange.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 ++i; 64 ++i;
65 } 65 }
66 } 66 }
67 67
68 m_needsPurge = false; 68 m_needsPurge = false;
69 69
70 if (m_controllers.isEmpty()) 70 if (m_controllers.isEmpty())
71 stopListening(); 71 stopListening();
72 } 72 }
73 73
74 void ScreenOrientationDispatcher::didChangeScreenOrientation(blink::WebScreenOri entation orientation) 74 void ScreenOrientationDispatcher::didChangeScreenOrientation(blink::WebScreenOri entationType orientation)
75 { 75 {
76 { 76 {
77 TemporaryChange<bool> changeIsDispatching(m_isDispatching, true); 77 TemporaryChange<bool> changeIsDispatching(m_isDispatching, true);
78 // Don't fire controllers removed or added during event dispatch. 78 // Don't fire controllers removed or added during event dispatch.
79 size_t size = m_controllers.size(); 79 size_t size = m_controllers.size();
80 for (size_t i = 0; i < size; ++i) { 80 for (size_t i = 0; i < size; ++i) {
81 if (m_controllers[i]) 81 if (m_controllers[i])
82 static_cast<ScreenOrientationController*>(m_controllers[i])->did ChangeScreenOrientation(orientation); 82 static_cast<ScreenOrientationController*>(m_controllers[i])->did ChangeScreenOrientation(orientation);
83 } 83 }
84 } 84 }
85 85
86 if (m_needsPurge) 86 if (m_needsPurge)
87 purgeControllers(); 87 purgeControllers();
88 } 88 }
89 89
90 void ScreenOrientationDispatcher::startListening() 90 void ScreenOrientationDispatcher::startListening()
91 { 91 {
92 blink::Platform::current()->setScreenOrientationListener(this); 92 blink::Platform::current()->setScreenOrientationListener(this);
93 } 93 }
94 94
95 void ScreenOrientationDispatcher::stopListening() 95 void ScreenOrientationDispatcher::stopListening()
96 { 96 {
97 blink::Platform::current()->setScreenOrientationListener(0); 97 blink::Platform::current()->setScreenOrientationListener(0);
98 } 98 }
99 99
100 } // namespace WebCore 100 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698