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

Side by Side Diff: public/platform/Platform.h

Issue 419643008: Make Screen Orientation use Platform Events in order to handle polling. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@platform_events
Patch Set: rebase Created 6 years, 4 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 (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
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 10 * * Redistributions in binary form must reproduce the above
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 break; 614 break;
615 case blink::WebPlatformEventDeviceLight: 615 case blink::WebPlatformEventDeviceLight:
616 setDeviceLightListener(static_cast<blink::WebDeviceLightListener*>(l istener)); 616 setDeviceLightListener(static_cast<blink::WebDeviceLightListener*>(l istener));
617 break; 617 break;
618 case blink::WebPlatformEventBattery: 618 case blink::WebPlatformEventBattery:
619 setBatteryStatusListener(static_cast<blink::WebBatteryStatusListener *>(listener)); 619 setBatteryStatusListener(static_cast<blink::WebBatteryStatusListener *>(listener));
620 break; 620 break;
621 case blink::WebPlatformEventGamepad: 621 case blink::WebPlatformEventGamepad:
622 setGamepadListener(static_cast<blink::WebGamepadListener*>(listener) ); 622 setGamepadListener(static_cast<blink::WebGamepadListener*>(listener) );
623 break; 623 break;
624 case blink::WebPlatformEventScreenOrientation:
625 // No backward-compatibility support here.
626 break;
624 } 627 }
625 } 628 }
626 629
627 // Request the platform to stop listening to the specified event and no 630 // Request the platform to stop listening to the specified event and no
628 // longer notify the listener, if any. 631 // longer notify the listener, if any.
629 virtual void stopListening(blink::WebPlatformEventType type) 632 virtual void stopListening(blink::WebPlatformEventType type)
630 { 633 {
631 // FIXME: this implementation is only there for backward compatibility. 634 // FIXME: this implementation is only there for backward compatibility.
632 // It should be removed when the content layer will implement this metho d. 635 // It should be removed when the content layer will implement this metho d.
633 switch (type) { 636 switch (type) {
634 case blink::WebPlatformEventDeviceMotion: 637 case blink::WebPlatformEventDeviceMotion:
635 setDeviceMotionListener(0); 638 setDeviceMotionListener(0);
636 break; 639 break;
637 case blink::WebPlatformEventDeviceOrientation: 640 case blink::WebPlatformEventDeviceOrientation:
638 setDeviceOrientationListener(0); 641 setDeviceOrientationListener(0);
639 break; 642 break;
640 case blink::WebPlatformEventDeviceLight: 643 case blink::WebPlatformEventDeviceLight:
641 setDeviceLightListener(0); 644 setDeviceLightListener(0);
642 break; 645 break;
643 case blink::WebPlatformEventBattery: 646 case blink::WebPlatformEventBattery:
644 setBatteryStatusListener(0); 647 setBatteryStatusListener(0);
645 break; 648 break;
646 case blink::WebPlatformEventGamepad: 649 case blink::WebPlatformEventGamepad:
647 setGamepadListener(0); 650 setGamepadListener(0);
648 break; 651 break;
652 case blink::WebPlatformEventScreenOrientation:
653 // No backward-compatibility support here.
654 break;
649 } 655 }
650 } 656 }
651 657
652 // Deprecated: remove when content/ is updated. 658 // Deprecated: remove when content/ is updated.
653 virtual void setDeviceMotionListener(blink::WebDeviceMotionListener*) { } 659 virtual void setDeviceMotionListener(blink::WebDeviceMotionListener*) { }
654 virtual void setDeviceOrientationListener(blink::WebDeviceOrientationListene r*) { } 660 virtual void setDeviceOrientationListener(blink::WebDeviceOrientationListene r*) { }
655 virtual void setDeviceLightListener(blink::WebDeviceLightListener*) { } 661 virtual void setDeviceLightListener(blink::WebDeviceLightListener*) { }
656 virtual void setBatteryStatusListener(blink::WebBatteryStatusListener*) { } 662 virtual void setBatteryStatusListener(blink::WebBatteryStatusListener*) { }
657 virtual void setGamepadListener(blink::WebGamepadListener*) { } 663 virtual void setGamepadListener(blink::WebGamepadListener*) { }
658 664
(...skipping 21 matching lines...) Expand all
680 virtual WebNotificationPresenter* notificationPresenter() { return 0; } 686 virtual WebNotificationPresenter* notificationPresenter() { return 0; }
681 687
682 688
683 protected: 689 protected:
684 virtual ~Platform() { } 690 virtual ~Platform() { }
685 }; 691 };
686 692
687 } // namespace blink 693 } // namespace blink
688 694
689 #endif 695 #endif
OLDNEW
« no previous file with comments | « Source/modules/screen_orientation/ScreenOrientationDispatcher.cpp ('k') | public/platform/WebPlatformEventType.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698