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

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

Issue 26434002: Cleanup: Add more conversion helpers for usage. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Updated to ToT. Patch for landing. Created 7 years, 2 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 /* 1 /*
2 * Copyright 2010 Apple Inc. All rights reserved. 2 * Copyright 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2012 Samsung Electronics. All rights reserved. 3 * Copyright (C) 2012 Samsung Electronics. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright 10 * * Redistributions in binary form must reproduce the above copyright
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 DeviceOrientationDispatcher::instance().addDeviceOrientationController(this) ; 82 DeviceOrientationDispatcher::instance().addDeviceOrientationController(this) ;
83 } 83 }
84 84
85 void NewDeviceOrientationController::unregisterWithDispatcher() 85 void NewDeviceOrientationController::unregisterWithDispatcher()
86 { 86 {
87 DeviceOrientationDispatcher::instance().removeDeviceOrientationController(th is); 87 DeviceOrientationDispatcher::instance().removeDeviceOrientationController(th is);
88 } 88 }
89 89
90 bool NewDeviceOrientationController::isNullEvent(Event* event) 90 bool NewDeviceOrientationController::isNullEvent(Event* event)
91 { 91 {
92 ASSERT(event->type() == EventNames::deviceorientation); 92 DeviceOrientationEvent* orientationEvent = toDeviceOrientationEvent(event);
93 DeviceOrientationEvent* orientationEvent = static_cast<DeviceOrientationEven t*>(event);
94 return !orientationEvent->orientation()->canProvideEventData(); 93 return !orientationEvent->orientation()->canProvideEventData();
95 } 94 }
96 95
97 void NewDeviceOrientationController::didAddEventListener(DOMWindow* window, cons t AtomicString& eventType) 96 void NewDeviceOrientationController::didAddEventListener(DOMWindow* window, cons t AtomicString& eventType)
98 { 97 {
99 if (eventType == EventNames::deviceorientation && RuntimeEnabledFeatures::de viceOrientationEnabled()) 98 if (eventType == EventNames::deviceorientation && RuntimeEnabledFeatures::de viceOrientationEnabled())
100 startUpdating(); 99 startUpdating();
101 } 100 }
102 101
103 void NewDeviceOrientationController::didRemoveEventListener(DOMWindow* window, c onst AtomicString& eventType) 102 void NewDeviceOrientationController::didRemoveEventListener(DOMWindow* window, c onst AtomicString& eventType)
104 { 103 {
105 if (eventType == EventNames::deviceorientation) 104 if (eventType == EventNames::deviceorientation)
106 stopUpdating(); 105 stopUpdating();
107 } 106 }
108 107
109 void NewDeviceOrientationController::didRemoveAllEventListeners(DOMWindow* windo w) 108 void NewDeviceOrientationController::didRemoveAllEventListeners(DOMWindow* windo w)
110 { 109 {
111 stopUpdating(); 110 stopUpdating();
112 } 111 }
113 112
114 } // namespace WebCore 113 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698