Chromium Code Reviews| Index: Source/core/page/NavigatorID.cpp |
| diff --git a/Source/core/page/DOMWindowTimers.cpp b/Source/core/page/NavigatorID.cpp |
| similarity index 54% |
| copy from Source/core/page/DOMWindowTimers.cpp |
| copy to Source/core/page/NavigatorID.cpp |
| index 499a7981588b53667b198322dfdde02062f07e74..593d59ed532cd4433398c1f45d97600182fa6ec5 100644 |
| --- a/Source/core/page/DOMWindowTimers.cpp |
| +++ b/Source/core/page/NavigatorID.cpp |
| @@ -1,6 +1,5 @@ |
| /* |
| - * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. |
| - * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
| + * 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
|
| * Copyright (C) 2013 Samsung Electronics. All rights reserved. |
| * |
| * Redistribution and use in source and binary forms, with or without |
| @@ -31,37 +30,58 @@ |
| */ |
| #include "config.h" |
| -#include "core/page/DOMWindowTimers.h" |
| +#include "NavigatorID.h" |
| -#include "core/dom/EventTarget.h" |
| -#include "core/page/DOMTimer.h" |
| +#include "core/page/NavigatorBase.h" |
| +#include "wtf/CPU.h" |
| -namespace WebCore { |
| +#if OS(LINUX) |
| +#include "sys/utsname.h" |
| +#include "wtf/StdLibExtras.h" |
| +#endif |
| + |
| +#ifndef WEBCORE_NAVIGATOR_PLATFORM |
| +#if OS(DARWIN) && (CPU(PPC) || CPU(PPC64)) |
| +#define WEBCORE_NAVIGATOR_PLATFORM "MacPPC" |
| +#elif OS(DARWIN) && (CPU(X86) || CPU(X86_64)) |
| +#define WEBCORE_NAVIGATOR_PLATFORM "MacIntel" |
| +#elif OS(WINDOWS) |
| +#define WEBCORE_NAVIGATOR_PLATFORM "Win32" |
| +#else |
| +#define WEBCORE_NAVIGATOR_PLATFORM "" |
| +#endif |
| +#endif // ifndef WEBCORE_NAVIGATOR_PLATFORM |
| -namespace DOMWindowTimers { |
| +namespace WebCore { |
| -int setTimeout(EventTarget* eventTarget, PassOwnPtr<ScheduledAction> action, int timeout) |
| +String NavigatorID::appName(const NavigatorBase*) |
| { |
| - return DOMTimer::install(eventTarget->scriptExecutionContext(), action, timeout, true); |
| + return "Netscape"; |
| } |
| -int setInterval(EventTarget* eventTarget, PassOwnPtr<ScheduledAction> action, int timeout) |
| +String NavigatorID::appVersion(const NavigatorBase* navigator) |
| { |
| - return DOMTimer::install(eventTarget->scriptExecutionContext(), action, timeout, false); |
| + // Version is everything in the user agent string past the "Mozilla/" prefix. |
| + const String& agent = navigator->userAgent(); |
| + return agent.substring(agent.find('/') + 1); |
| } |
| -void clearTimeout(EventTarget* eventTarget, int timeoutID) |
| +String NavigatorID::userAgent(const NavigatorBase* navigator) |
| { |
| - if (ScriptExecutionContext* context = eventTarget->scriptExecutionContext()) |
| - DOMTimer::removeByID(context, timeoutID); |
| + return navigator->userAgent(); |
| } |
| -void clearInterval(EventTarget* eventTarget, int timeoutID) |
| +String NavigatorID::platform(const NavigatorBase*) |
| { |
| - if (ScriptExecutionContext* context = eventTarget->scriptExecutionContext()) |
| - DOMTimer::removeByID(context, timeoutID); |
| +#if OS(LINUX) |
| + if (!String(WEBCORE_NAVIGATOR_PLATFORM).isEmpty()) |
| + return WEBCORE_NAVIGATOR_PLATFORM; |
| + struct utsname osname; |
| + DEFINE_STATIC_LOCAL(String, platformName, (uname(&osname) >= 0 ? String(osname.sysname) + String(" ") + String(osname.machine) : emptyString())); |
| + return platformName; |
| +#else |
| + return WEBCORE_NAVIGATOR_PLATFORM; |
| +#endif |
| } |
| -} // namespace DOMWindowTimers |
| - |
| } // namespace WebCore |