Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Side by Side Diff: Source/core/page/NavigatorBase.cpp

Issue 22927015: Introduce NavigatorID IDL interface (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/page/NavigatorBase.h ('k') | Source/core/page/NavigatorID.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * 12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
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 "wtf/CPU.h"
31 #include "wtf/text/WTFString.h" 30 #include "wtf/text/WTFString.h"
32 31
33 #if OS(LINUX)
34 #include "sys/utsname.h"
35 #include "wtf/StdLibExtras.h"
36 #endif
37
38 #ifndef WEBCORE_NAVIGATOR_PLATFORM
39 #if OS(DARWIN) && (CPU(PPC) || CPU(PPC64))
40 #define WEBCORE_NAVIGATOR_PLATFORM "MacPPC"
41 #elif OS(DARWIN) && (CPU(X86) || CPU(X86_64))
42 #define WEBCORE_NAVIGATOR_PLATFORM "MacIntel"
43 #elif OS(WINDOWS)
44 #define WEBCORE_NAVIGATOR_PLATFORM "Win32"
45 #else
46 #define WEBCORE_NAVIGATOR_PLATFORM ""
47 #endif
48 #endif // ifndef WEBCORE_NAVIGATOR_PLATFORM
49
50 #ifndef WEBCORE_NAVIGATOR_PRODUCT 32 #ifndef WEBCORE_NAVIGATOR_PRODUCT
51 #define WEBCORE_NAVIGATOR_PRODUCT "Gecko" 33 #define WEBCORE_NAVIGATOR_PRODUCT "Gecko"
52 #endif // ifndef WEBCORE_NAVIGATOR_PRODUCT 34 #endif // ifndef WEBCORE_NAVIGATOR_PRODUCT
53 35
54 #ifndef WEBCORE_NAVIGATOR_PRODUCT_SUB 36 #ifndef WEBCORE_NAVIGATOR_PRODUCT_SUB
55 #define WEBCORE_NAVIGATOR_PRODUCT_SUB "20030107" 37 #define WEBCORE_NAVIGATOR_PRODUCT_SUB "20030107"
56 #endif // ifndef WEBCORE_NAVIGATOR_PRODUCT_SUB 38 #endif // ifndef WEBCORE_NAVIGATOR_PRODUCT_SUB
57 39
58 #ifndef WEBCORE_NAVIGATOR_VENDOR 40 #ifndef WEBCORE_NAVIGATOR_VENDOR
59 #define WEBCORE_NAVIGATOR_VENDOR "Apple Computer, Inc." 41 #define WEBCORE_NAVIGATOR_VENDOR "Apple Computer, Inc."
60 #endif // ifndef WEBCORE_NAVIGATOR_VENDOR 42 #endif // ifndef WEBCORE_NAVIGATOR_VENDOR
61 43
62 #ifndef WEBCORE_NAVIGATOR_VENDOR_SUB 44 #ifndef WEBCORE_NAVIGATOR_VENDOR_SUB
63 #define WEBCORE_NAVIGATOR_VENDOR_SUB "" 45 #define WEBCORE_NAVIGATOR_VENDOR_SUB ""
64 #endif // ifndef WEBCORE_NAVIGATOR_VENDOR_SUB 46 #endif // ifndef WEBCORE_NAVIGATOR_VENDOR_SUB
65 47
66 48
67 namespace WebCore { 49 namespace WebCore {
68 50
69 NavigatorBase::~NavigatorBase() 51 NavigatorBase::~NavigatorBase()
70 { 52 {
71 } 53 }
72 54
73 String NavigatorBase::appName() const
74 {
75 return "Netscape";
76 }
77
78 String NavigatorBase::appVersion() const
79 {
80 // Version is everything in the user agent string past the "Mozilla/" prefix .
81 const String& agent = userAgent();
82 return agent.substring(agent.find('/') + 1);
83 }
84
85 String NavigatorBase::platform() const
86 {
87 #if OS(LINUX)
88 if (!String(WEBCORE_NAVIGATOR_PLATFORM).isEmpty())
89 return WEBCORE_NAVIGATOR_PLATFORM;
90 struct utsname osname;
91 DEFINE_STATIC_LOCAL(String, platformName, (uname(&osname) >= 0 ? String(osna me.sysname) + String(" ") + String(osname.machine) : emptyString()));
92 return platformName;
93 #else
94 return WEBCORE_NAVIGATOR_PLATFORM;
95 #endif
96 }
97
98 String NavigatorBase::appCodeName() const 55 String NavigatorBase::appCodeName() const
99 { 56 {
100 return "Mozilla"; 57 return "Mozilla";
101 } 58 }
102 59
103 String NavigatorBase::product() const 60 String NavigatorBase::product() const
104 { 61 {
105 return WEBCORE_NAVIGATOR_PRODUCT; 62 return WEBCORE_NAVIGATOR_PRODUCT;
106 } 63 }
107 64
108 String NavigatorBase::productSub() const 65 String NavigatorBase::productSub() const
109 { 66 {
110 return WEBCORE_NAVIGATOR_PRODUCT_SUB; 67 return WEBCORE_NAVIGATOR_PRODUCT_SUB;
111 } 68 }
112 69
113 String NavigatorBase::vendor() const 70 String NavigatorBase::vendor() const
114 { 71 {
115 return WEBCORE_NAVIGATOR_VENDOR; 72 return WEBCORE_NAVIGATOR_VENDOR;
116 } 73 }
117 74
118 String NavigatorBase::vendorSub() const 75 String NavigatorBase::vendorSub() const
119 { 76 {
120 return WEBCORE_NAVIGATOR_VENDOR_SUB; 77 return WEBCORE_NAVIGATOR_VENDOR_SUB;
121 } 78 }
122 79
123 } // namespace WebCore 80 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/page/NavigatorBase.h ('k') | Source/core/page/NavigatorID.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698