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

Side by Side Diff: Source/WebCore/page/DOMWindow.cpp

Issue 13866007: WebKit & WebCore part of the device motion implementation using the platform layer. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@devicemotion-webcore
Patch Set: fixed Eric's comments. Created 7 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 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
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 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 1604 matching lines...) Expand 10 before | Expand all | Expand 10 after
1615 else if (eventType == eventNames().storageEvent) 1615 else if (eventType == eventNames().storageEvent)
1616 didAddStorageEventListener(this); 1616 didAddStorageEventListener(this);
1617 } 1617 }
1618 1618
1619 if (eventType == eventNames().unloadEvent) 1619 if (eventType == eventNames().unloadEvent)
1620 addUnloadEventListener(this); 1620 addUnloadEventListener(this);
1621 else if (eventType == eventNames().beforeunloadEvent && allowsBeforeUnloadLi steners(this)) 1621 else if (eventType == eventNames().beforeunloadEvent && allowsBeforeUnloadLi steners(this))
1622 addBeforeUnloadEventListener(this); 1622 addBeforeUnloadEventListener(this);
1623 #if ENABLE(DEVICE_ORIENTATION) 1623 #if ENABLE(DEVICE_ORIENTATION)
1624 else if (eventType == eventNames().devicemotionEvent && RuntimeEnabledFeatur es::deviceMotionEnabled()) { 1624 else if (eventType == eventNames().devicemotionEvent && RuntimeEnabledFeatur es::deviceMotionEnabled()) {
1625 DeviceMotionController::shared().addDeviceEventListener(this); 1625 if (DeviceMotionController* controller = DeviceMotionController::from(pa ge()))
1626 controller->addDeviceEventListener(this);
1626 } else if (eventType == eventNames().deviceorientationEvent && RuntimeEnable dFeatures::deviceOrientationEnabled()) { 1627 } else if (eventType == eventNames().deviceorientationEvent && RuntimeEnable dFeatures::deviceOrientationEnabled()) {
1627 if (DeviceOrientationController* controller = DeviceOrientationControlle r::from(page())) 1628 if (DeviceOrientationController* controller = DeviceOrientationControlle r::from(page()))
1628 controller->addDeviceEventListener(this); 1629 controller->addDeviceEventListener(this);
1629 } 1630 }
1630 #endif 1631 #endif
1631 1632
1632 #if ENABLE(PROXIMITY_EVENTS) 1633 #if ENABLE(PROXIMITY_EVENTS)
1633 else if (eventType == eventNames().webkitdeviceproximityEvent) { 1634 else if (eventType == eventNames().webkitdeviceproximityEvent) {
1634 if (DeviceProximityController* controller = DeviceProximityController::f rom(page())) 1635 if (DeviceProximityController* controller = DeviceProximityController::f rom(page()))
1635 controller->addDeviceEventListener(this); 1636 controller->addDeviceEventListener(this);
(...skipping 14 matching lines...) Expand all
1650 else if (eventNames().isTouchEventType(eventType)) 1651 else if (eventNames().isTouchEventType(eventType))
1651 document->didRemoveTouchEventHandler(document); 1652 document->didRemoveTouchEventHandler(document);
1652 } 1653 }
1653 1654
1654 if (eventType == eventNames().unloadEvent) 1655 if (eventType == eventNames().unloadEvent)
1655 removeUnloadEventListener(this); 1656 removeUnloadEventListener(this);
1656 else if (eventType == eventNames().beforeunloadEvent && allowsBeforeUnloadLi steners(this)) 1657 else if (eventType == eventNames().beforeunloadEvent && allowsBeforeUnloadLi steners(this))
1657 removeBeforeUnloadEventListener(this); 1658 removeBeforeUnloadEventListener(this);
1658 #if ENABLE(DEVICE_ORIENTATION) 1659 #if ENABLE(DEVICE_ORIENTATION)
1659 else if (eventType == eventNames().devicemotionEvent) { 1660 else if (eventType == eventNames().devicemotionEvent) {
1660 DeviceMotionController::shared().removeDeviceEventListener(this); 1661 if (DeviceOrientationController* controller = DeviceOrientationControlle r::from(page()))
1662 controller->removeDeviceEventListener(this);
1661 } else if (eventType == eventNames().deviceorientationEvent) { 1663 } else if (eventType == eventNames().deviceorientationEvent) {
1662 if (DeviceOrientationController* controller = DeviceOrientationControlle r::from(page())) 1664 if (DeviceOrientationController* controller = DeviceOrientationControlle r::from(page()))
1663 controller->removeDeviceEventListener(this); 1665 controller->removeDeviceEventListener(this);
1664 } 1666 }
1665 #endif 1667 #endif
1666 1668
1667 #if ENABLE(PROXIMITY_EVENTS) 1669 #if ENABLE(PROXIMITY_EVENTS)
1668 else if (eventType == eventNames().webkitdeviceproximityEvent) { 1670 else if (eventType == eventNames().webkitdeviceproximityEvent) {
1669 if (DeviceProximityController* controller = DeviceProximityController::f rom(page())) 1671 if (DeviceProximityController* controller = DeviceProximityController::f rom(page()))
1670 controller->removeDeviceEventListener(this); 1672 controller->removeDeviceEventListener(this);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1714 InspectorInstrumentation::didDispatchEventOnWindow(cookie); 1716 InspectorInstrumentation::didDispatchEventOnWindow(cookie);
1715 1717
1716 return result; 1718 return result;
1717 } 1719 }
1718 1720
1719 void DOMWindow::removeAllEventListeners() 1721 void DOMWindow::removeAllEventListeners()
1720 { 1722 {
1721 EventTarget::removeAllEventListeners(); 1723 EventTarget::removeAllEventListeners();
1722 1724
1723 #if ENABLE(DEVICE_ORIENTATION) 1725 #if ENABLE(DEVICE_ORIENTATION)
1724 DeviceMotionController::shared().removeAllDeviceEventListeners(this); 1726 if (DeviceOrientationController* controller = DeviceOrientationController::f rom(page()))
1727 controller->removeAllDeviceEventListeners(this);
1725 if (DeviceOrientationController* controller = DeviceOrientationController::f rom(page())) 1728 if (DeviceOrientationController* controller = DeviceOrientationController::f rom(page()))
1726 controller->removeAllDeviceEventListeners(this); 1729 controller->removeAllDeviceEventListeners(this);
1727 #endif 1730 #endif
1728 #if ENABLE(TOUCH_EVENTS) 1731 #if ENABLE(TOUCH_EVENTS)
1729 if (Document* document = this->document()) 1732 if (Document* document = this->document())
1730 document->didRemoveEventTargetNode(document); 1733 document->didRemoveEventTargetNode(document);
1731 #endif 1734 #endif
1732 1735
1733 #if ENABLE(PROXIMITY_EVENTS) 1736 #if ENABLE(PROXIMITY_EVENTS)
1734 if (DeviceProximityController* controller = DeviceProximityController::from( page())) 1737 if (DeviceProximityController* controller = DeviceProximityController::from( page()))
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
1993 WindowFeatures windowFeatures(dialogFeaturesString, screenAvailableRect(m_fr ame->view())); 1996 WindowFeatures windowFeatures(dialogFeaturesString, screenAvailableRect(m_fr ame->view()));
1994 Frame* dialogFrame = createWindow(urlString, emptyAtom, windowFeatures, 1997 Frame* dialogFrame = createWindow(urlString, emptyAtom, windowFeatures,
1995 activeWindow, firstFrame, m_frame, function, functionContext); 1998 activeWindow, firstFrame, m_frame, function, functionContext);
1996 if (!dialogFrame) 1999 if (!dialogFrame)
1997 return; 2000 return;
1998 2001
1999 dialogFrame->page()->chrome()->runModal(); 2002 dialogFrame->page()->chrome()->runModal();
2000 } 2003 }
2001 2004
2002 } // namespace WebCore 2005 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698