Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 11 matching lines...) Expand all Loading... | |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "modules/donottrack/NavigatorDoNotTrack.h" | 32 #include "modules/pointerevents/NavigatorPointerEvents.h" |
| 33 | 33 |
| 34 #include "core/loader/FrameLoader.h" | 34 #include "core/loader/FrameLoader.h" |
| 35 #include "core/loader/FrameLoaderClient.h" | 35 #include "core/loader/FrameLoaderClient.h" |
| 36 #include "core/page/Frame.h" | 36 #include "core/page/Frame.h" |
| 37 #include "core/page/Navigator.h" | 37 #include "core/page/Navigator.h" |
| 38 #include "wtf/PassOwnPtr.h" | 38 #include "wtf/PassOwnPtr.h" |
| 39 | 39 |
| 40 namespace WebCore { | 40 namespace WebCore { |
| 41 | 41 |
| 42 NavigatorDoNotTrack::NavigatorDoNotTrack(Frame* frame) | 42 NavigatorPointerEvents::NavigatorPointerEvents(Frame* frame) |
| 43 : DOMWindowProperty(frame) | 43 : DOMWindowProperty(frame) |
| 44 { | 44 { |
| 45 } | 45 } |
| 46 | 46 |
| 47 NavigatorDoNotTrack::~NavigatorDoNotTrack() | 47 NavigatorPointerEvents::~NavigatorPointerEvents() |
| 48 { | 48 { |
| 49 } | 49 } |
| 50 | 50 |
| 51 const char* NavigatorDoNotTrack::supplementName() | 51 const char* NavigatorPointerEvents::supplementName() |
| 52 { | 52 { |
| 53 return "NavigatorDoNotTrack"; | 53 return "NavigatorPointerEvents"; |
| 54 } | 54 } |
| 55 | 55 |
| 56 NavigatorDoNotTrack* NavigatorDoNotTrack::from(Navigator* navigator) | 56 NavigatorPointerEvents* NavigatorPointerEvents::from(Navigator* navigator) |
| 57 { | 57 { |
| 58 NavigatorDoNotTrack* supplement = static_cast<NavigatorDoNotTrack*>(Suppleme nt<Navigator>::from(navigator, supplementName())); | 58 NavigatorPointerEvents* supplement = static_cast<NavigatorPointerEvents*>(Su pplement<Navigator>::from(navigator, supplementName())); |
| 59 if (!supplement) { | 59 if (!supplement) { |
| 60 supplement = new NavigatorDoNotTrack(navigator->frame()); | 60 supplement = new NavigatorPointerEvents(navigator->frame()); |
| 61 provideTo(navigator, supplementName(), adoptPtr(supplement)); | 61 provideTo(navigator, supplementName(), adoptPtr(supplement)); |
| 62 } | 62 } |
| 63 return supplement; | 63 return supplement; |
| 64 } | 64 } |
| 65 | 65 |
| 66 String NavigatorDoNotTrack::doNotTrack(Navigator* navigator) | 66 bool NavigatorPointerEvents::pointerEnabled(Navigator* navigator) |
| 67 { | 67 { |
| 68 return NavigatorDoNotTrack::from(navigator)->doNotTrack(); | 68 return NavigatorPointerEvents::from(navigator)->pointerEnabled(); |
|
Rick Byers
2013/08/07 13:46:51
As discussed, I wouldn't put pointerEnabled in her
| |
| 69 } | 69 } |
| 70 | 70 |
| 71 String NavigatorDoNotTrack::doNotTrack() | 71 bool NavigatorPointerEvents::pointerEnabled() |
| 72 { | 72 { |
| 73 return frame() ? frame()->loader()->client()->doNotTrackValue() : String(); | 73 return false; |
| 74 } | |
| 75 | |
| 76 long NavigatorPointerEvents::maxTouchPoints(Navigator* navigator) | |
| 77 { | |
| 78 return NavigatorPointerEvents::from(navigator)->maxTouchPoints(); | |
| 79 } | |
| 80 | |
| 81 long NavigatorPointerEvents::maxTouchPoints() | |
| 82 { | |
| 83 #if OS(WINDOWS) | |
| 84 return GetSystemMetrics(SM_MAXIMUMTOUCHES); | |
|
Rick Byers
2013/08/07 13:46:51
I suspect this won't work in the sandbox, and it r
| |
| 85 #else | |
| 86 return 0; | |
|
Rick Byers
2013/08/07 13:46:51
On platforms where we don't know the answer it's b
| |
| 87 #endif | |
| 74 } | 88 } |
| 75 | 89 |
| 76 } // namespace WebCore | 90 } // namespace WebCore |
| OLD | NEW |