Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
|
arv (Not doing code reviews)
2013/08/20 13:40:44
This came up before... are you using git mv and it
| |
| 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | |
| 4 * Copyright (C) 2013 Samsung Electronics. All rights reserved. | 3 * Copyright (C) 2013 Samsung Electronics. All rights reserved. |
| 5 * | 4 * |
| 6 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 8 * met: | 7 * met: |
| 9 * | 8 * |
| 10 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 11 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| 12 * * Redistributions in binary form must reproduce the above | 11 * * Redistributions in binary form must reproduce the above |
| 13 * copyright notice, this list of conditions and the following disclaimer | 12 * copyright notice, this list of conditions and the following disclaimer |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 31 */ | 30 */ |
| 32 | 31 |
| 33 #include "config.h" | 32 #include "config.h" |
| 34 #include "core/page/DOMWindowTimers.h" | 33 #include "NavigatorID.h" |
| 35 | 34 |
| 36 #include "core/dom/EventTarget.h" | 35 #include "core/page/NavigatorBase.h" |
| 37 #include "core/page/DOMTimer.h" | 36 #include "wtf/CPU.h" |
| 37 | |
| 38 #if OS(LINUX) | |
| 39 #include "sys/utsname.h" | |
| 40 #include "wtf/StdLibExtras.h" | |
| 41 #endif | |
| 42 | |
| 43 #ifndef WEBCORE_NAVIGATOR_PLATFORM | |
| 44 #if OS(DARWIN) && (CPU(PPC) || CPU(PPC64)) | |
| 45 #define WEBCORE_NAVIGATOR_PLATFORM "MacPPC" | |
| 46 #elif OS(DARWIN) && (CPU(X86) || CPU(X86_64)) | |
| 47 #define WEBCORE_NAVIGATOR_PLATFORM "MacIntel" | |
| 48 #elif OS(WINDOWS) | |
| 49 #define WEBCORE_NAVIGATOR_PLATFORM "Win32" | |
| 50 #else | |
| 51 #define WEBCORE_NAVIGATOR_PLATFORM "" | |
| 52 #endif | |
| 53 #endif // ifndef WEBCORE_NAVIGATOR_PLATFORM | |
| 38 | 54 |
| 39 namespace WebCore { | 55 namespace WebCore { |
| 40 | 56 |
| 41 namespace DOMWindowTimers { | 57 String NavigatorID::appName(const NavigatorBase*) |
| 42 | |
| 43 int setTimeout(EventTarget* eventTarget, PassOwnPtr<ScheduledAction> action, int timeout) | |
| 44 { | 58 { |
| 45 return DOMTimer::install(eventTarget->scriptExecutionContext(), action, time out, true); | 59 return "Netscape"; |
| 46 } | 60 } |
| 47 | 61 |
| 48 int setInterval(EventTarget* eventTarget, PassOwnPtr<ScheduledAction> action, in t timeout) | 62 String NavigatorID::appVersion(const NavigatorBase* navigator) |
| 49 { | 63 { |
| 50 return DOMTimer::install(eventTarget->scriptExecutionContext(), action, time out, false); | 64 // Version is everything in the user agent string past the "Mozilla/" prefix . |
| 65 const String& agent = navigator->userAgent(); | |
| 66 return agent.substring(agent.find('/') + 1); | |
| 51 } | 67 } |
| 52 | 68 |
| 53 void clearTimeout(EventTarget* eventTarget, int timeoutID) | 69 String NavigatorID::userAgent(const NavigatorBase* navigator) |
| 54 { | 70 { |
| 55 if (ScriptExecutionContext* context = eventTarget->scriptExecutionContext()) | 71 return navigator->userAgent(); |
| 56 DOMTimer::removeByID(context, timeoutID); | |
| 57 } | 72 } |
| 58 | 73 |
| 59 void clearInterval(EventTarget* eventTarget, int timeoutID) | 74 String NavigatorID::platform(const NavigatorBase*) |
| 60 { | 75 { |
| 61 if (ScriptExecutionContext* context = eventTarget->scriptExecutionContext()) | 76 #if OS(LINUX) |
| 62 DOMTimer::removeByID(context, timeoutID); | 77 if (!String(WEBCORE_NAVIGATOR_PLATFORM).isEmpty()) |
| 78 return WEBCORE_NAVIGATOR_PLATFORM; | |
| 79 struct utsname osname; | |
| 80 DEFINE_STATIC_LOCAL(String, platformName, (uname(&osname) >= 0 ? String(osna me.sysname) + String(" ") + String(osname.machine) : emptyString())); | |
| 81 return platformName; | |
| 82 #else | |
| 83 return WEBCORE_NAVIGATOR_PLATFORM; | |
| 84 #endif | |
| 63 } | 85 } |
| 64 | 86 |
| 65 } // namespace DOMWindowTimers | |
| 66 | |
| 67 } // namespace WebCore | 87 } // namespace WebCore |
| OLD | NEW |