Changeset 128770 in webkit


Ignore:
Timestamp:
Sep 17, 2012 9:35:48 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Updates to the useragent patch

[Qt] Cleanup/refactor the user agent detection code
https://bugs.webkit.org/show_bug.cgi?id=96822

Patch by Lauro Neto <lauro.neto@openbossa.org> on 2012-09-17
Reviewed by Simon Hausmann.

Replaced Q_WS_*/Q_OS_* with WTF OS/CPU detection macros.
Cleanup the check for unsupported OS.
Replaced QString.arg() usage with simple string concatenation.

  • platform/qt/UserAgentQt.cpp:

(WebCore::UserAgentQt::standardUserAgent):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r128769 r128770  
     12012-09-17  Lauro Neto  <lauro.neto@openbossa.org>
     2
     3        Updates to the useragent patch
     4
     5        [Qt] Cleanup/refactor the user agent detection code
     6        https://bugs.webkit.org/show_bug.cgi?id=96822
     7
     8        Reviewed by Simon Hausmann.
     9
     10        Replaced Q_WS_*/Q_OS_* with WTF OS/CPU detection macros.
     11        Cleanup the check for unsupported OS.
     12        Replaced QString.arg() usage with simple string concatenation.
     13
     14        * platform/qt/UserAgentQt.cpp:
     15        (WebCore::UserAgentQt::standardUserAgent):
     16
    1172012-09-17  Sheriff Bot  <webkit.review.bot@gmail.com>
    218
  • trunk/Source/WebCore/platform/qt/UserAgentQt.cpp

    r128476 r128770  
    2323#include "UserAgentQt.h"
    2424
    25 #include <QCoreApplication>
     25#include <QGuiApplication>
    2626
    2727#include <wtf/text/CString.h>
    2828#include <wtf/text/WTFString.h>
    29 #if defined Q_OS_WIN32
     29#if OS(WINDOWS)
    3030#include <SystemInfo.h>
    31 #endif // Q_OS_WIN32
     31#endif // OS(WINDOWS)
    3232
    3333namespace WebCore {
     
    6363        // Platform.
    6464        ua = ua.arg(QLatin1String(
    65 #ifdef Q_WS_MAC
     65#if OS(MAC_OS_X)
    6666            "Macintosh; "
    67 #elif defined Q_WS_QWS
    68             "QtEmbedded; "
    69 #elif defined Q_WS_WIN
     67#elif OS(WINDOWS)
    7068            // Nothing.
    71 #elif defined Q_WS_X11
    72             "X11; "
    7369#else
    74             "Unknown; "
     70            (QGuiApplication::platformName() == QLatin1String("xcb")) ? "X11; " : "Unknown; "
    7571#endif
    7672        ));
     73
    7774
    7875        // Security strength.
     
    8582        // Operating system.
    8683        ua = ua.arg(QLatin1String(
    87 #ifdef Q_OS_AIX
     84#if OS(AIX)
    8885            "AIX"
    89 #elif defined Q_OS_WIN32
     86#elif OS(WINDOWS)
    9087            windowsVersionForUAString().latin1().data()
    91 #elif defined Q_OS_DARWIN
    92 #ifdef __i386__ || __x86_64__
     88#elif OS(MAC_OS_X)
     89#ifdef CPU(X86) || CPU(X86_64)
    9390            "Intel Mac OS X"
    9491#else
     
    9693#endif
    9794
    98 #elif defined Q_OS_BSDI
    99             "BSD"
    100 #elif defined Q_OS_BSD4
    101             "BSD Four"
    102 #elif defined Q_OS_CYGWIN
    103             "Cygwin"
    104 #elif defined Q_OS_DGUX
    105             "DG/UX"
    106 #elif defined Q_OS_DYNIX
    107             "DYNIX/ptx"
    108 #elif defined Q_OS_FREEBSD
     95#elif OS(FREEBSD)
    10996            "FreeBSD"
    110 #elif defined Q_OS_HPUX
    111             "HP-UX"
    112 #elif defined Q_OS_HURD
     97#elif OS(HURD)
    11398            "GNU Hurd"
    114 #elif defined Q_OS_IRIX
    115             "SGI Irix"
    116 #elif defined Q_OS_LINUX
     99#elif OS(LINUX)
    117100
    118 #if defined(__x86_64__)
     101#if CPU(X86_64)
    119102            "Linux x86_64"
    120 #elif defined(__i386__)
     103#elif CPU(X86)
    121104            "Linux i686"
    122105#else
     
    124107#endif
    125108
    126 #elif defined Q_OS_LYNX
    127             "LynxOS"
    128 #elif defined Q_OS_NETBSD
     109#elif OS(NETBSD)
    129110            "NetBSD"
    130 #elif defined Q_OS_OS2
    131             "OS/2"
    132 #elif defined Q_OS_OPENBSD
     111#elif OS(OPENBSD)
    133112            "OpenBSD"
    134 #elif defined Q_OS_OS2EMX
    135             "OS/2"
    136 #elif defined Q_OS_OSF
    137             "HP Tru64 UNIX"
    138 #elif defined Q_OS_QNX6
    139             "QNX RTP Six"
    140 #elif defined Q_OS_QNX
     113#elif OS(QNX)
    141114            "QNX"
    142 #elif defined Q_OS_RELIANT
    143             "Reliant UNIX"
    144 #elif defined Q_OS_SCO
    145             "SCO OpenServer"
    146 #elif defined Q_OS_SOLARIS
     115#elif OS(SOLARIS)
    147116            "Sun Solaris"
    148 #elif defined Q_OS_ULTRIX
    149             "DEC Ultrix"
    150 #elif defined Q_OS_UNIX
     117#elif OS(UNIX) // FIXME Looks like all unix variants above are the only cases where OS_UNIX is set.
    151118            "UNIX BSD/SYSV system"
    152 #elif defined Q_OS_UNIXWARE
    153             "UnixWare Seven, Open UNIX Eight"
    154119#else
    155120            "Unknown"
     
    158123
    159124        // WebKit version.
    160         // FIXME "+" in the version string?
    161         QString version = QString(QLatin1String("%1.%2")).arg(QString::number(webkitMajorVersion),
    162                                                                QString::number(webkitMinorVersion));
     125        QString version = QString::number(webkitMajorVersion) + QLatin1Char('.') + QString::number(webkitMinorVersion);
    163126        ua = ua.arg(version, version);
    164127    }
Note: See TracChangeset for help on using the changeset viewer.