| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 * | 24 * |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 #include "config.h" | 27 #include "config.h" |
| 28 #include "core/page/NavigatorBase.h" | 28 #include "core/page/NavigatorBase.h" |
| 29 | 29 |
| 30 #include "core/platform/network/NetworkStateNotifier.h" | 30 #include "core/platform/network/NetworkStateNotifier.h" |
| 31 #include "wtf/CPU.h" | |
| 32 #include "wtf/text/WTFString.h" | 31 #include "wtf/text/WTFString.h" |
| 33 | 32 |
| 34 #if OS(LINUX) | |
| 35 #include "sys/utsname.h" | |
| 36 #include "wtf/StdLibExtras.h" | |
| 37 #endif | |
| 38 | |
| 39 #ifndef WEBCORE_NAVIGATOR_PLATFORM | |
| 40 #if OS(DARWIN) && (CPU(PPC) || CPU(PPC64)) | |
| 41 #define WEBCORE_NAVIGATOR_PLATFORM "MacPPC" | |
| 42 #elif OS(DARWIN) && (CPU(X86) || CPU(X86_64)) | |
| 43 #define WEBCORE_NAVIGATOR_PLATFORM "MacIntel" | |
| 44 #elif OS(WINDOWS) | |
| 45 #define WEBCORE_NAVIGATOR_PLATFORM "Win32" | |
| 46 #else | |
| 47 #define WEBCORE_NAVIGATOR_PLATFORM "" | |
| 48 #endif | |
| 49 #endif // ifndef WEBCORE_NAVIGATOR_PLATFORM | |
| 50 | |
| 51 #ifndef WEBCORE_NAVIGATOR_PRODUCT | 33 #ifndef WEBCORE_NAVIGATOR_PRODUCT |
| 52 #define WEBCORE_NAVIGATOR_PRODUCT "Gecko" | 34 #define WEBCORE_NAVIGATOR_PRODUCT "Gecko" |
| 53 #endif // ifndef WEBCORE_NAVIGATOR_PRODUCT | 35 #endif // ifndef WEBCORE_NAVIGATOR_PRODUCT |
| 54 | 36 |
| 55 #ifndef WEBCORE_NAVIGATOR_PRODUCT_SUB | 37 #ifndef WEBCORE_NAVIGATOR_PRODUCT_SUB |
| 56 #define WEBCORE_NAVIGATOR_PRODUCT_SUB "20030107" | 38 #define WEBCORE_NAVIGATOR_PRODUCT_SUB "20030107" |
| 57 #endif // ifndef WEBCORE_NAVIGATOR_PRODUCT_SUB | 39 #endif // ifndef WEBCORE_NAVIGATOR_PRODUCT_SUB |
| 58 | 40 |
| 59 #ifndef WEBCORE_NAVIGATOR_VENDOR | 41 #ifndef WEBCORE_NAVIGATOR_VENDOR |
| 60 #define WEBCORE_NAVIGATOR_VENDOR "Apple Computer, Inc." | 42 #define WEBCORE_NAVIGATOR_VENDOR "Apple Computer, Inc." |
| 61 #endif // ifndef WEBCORE_NAVIGATOR_VENDOR | 43 #endif // ifndef WEBCORE_NAVIGATOR_VENDOR |
| 62 | 44 |
| 63 #ifndef WEBCORE_NAVIGATOR_VENDOR_SUB | 45 #ifndef WEBCORE_NAVIGATOR_VENDOR_SUB |
| 64 #define WEBCORE_NAVIGATOR_VENDOR_SUB "" | 46 #define WEBCORE_NAVIGATOR_VENDOR_SUB "" |
| 65 #endif // ifndef WEBCORE_NAVIGATOR_VENDOR_SUB | 47 #endif // ifndef WEBCORE_NAVIGATOR_VENDOR_SUB |
| 66 | 48 |
| 67 | 49 |
| 68 namespace WebCore { | 50 namespace WebCore { |
| 69 | 51 |
| 70 NavigatorBase::~NavigatorBase() | 52 NavigatorBase::~NavigatorBase() |
| 71 { | 53 { |
| 72 } | 54 } |
| 73 | 55 |
| 74 String NavigatorBase::appName() const | |
| 75 { | |
| 76 return "Netscape"; | |
| 77 } | |
| 78 | |
| 79 String NavigatorBase::appVersion() const | |
| 80 { | |
| 81 // Version is everything in the user agent string past the "Mozilla/" prefix
. | |
| 82 const String& agent = userAgent(); | |
| 83 return agent.substring(agent.find('/') + 1); | |
| 84 } | |
| 85 | |
| 86 String NavigatorBase::platform() const | |
| 87 { | |
| 88 #if OS(LINUX) | |
| 89 if (!String(WEBCORE_NAVIGATOR_PLATFORM).isEmpty()) | |
| 90 return WEBCORE_NAVIGATOR_PLATFORM; | |
| 91 struct utsname osname; | |
| 92 DEFINE_STATIC_LOCAL(String, platformName, (uname(&osname) >= 0 ? String(osna
me.sysname) + String(" ") + String(osname.machine) : emptyString())); | |
| 93 return platformName; | |
| 94 #else | |
| 95 return WEBCORE_NAVIGATOR_PLATFORM; | |
| 96 #endif | |
| 97 } | |
| 98 | |
| 99 String NavigatorBase::appCodeName() const | 56 String NavigatorBase::appCodeName() const |
| 100 { | 57 { |
| 101 return "Mozilla"; | 58 return "Mozilla"; |
| 102 } | 59 } |
| 103 | 60 |
| 104 String NavigatorBase::product() const | 61 String NavigatorBase::product() const |
| 105 { | 62 { |
| 106 return WEBCORE_NAVIGATOR_PRODUCT; | 63 return WEBCORE_NAVIGATOR_PRODUCT; |
| 107 } | 64 } |
| 108 | 65 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 120 { | 77 { |
| 121 return WEBCORE_NAVIGATOR_VENDOR_SUB; | 78 return WEBCORE_NAVIGATOR_VENDOR_SUB; |
| 122 } | 79 } |
| 123 | 80 |
| 124 bool NavigatorBase::onLine() const | 81 bool NavigatorBase::onLine() const |
| 125 { | 82 { |
| 126 return networkStateNotifier().onLine(); | 83 return networkStateNotifier().onLine(); |
| 127 } | 84 } |
| 128 | 85 |
| 129 } // namespace WebCore | 86 } // namespace WebCore |
| OLD | NEW |