summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-31 01:03:52 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-31 01:03:52 +0000
commit10a6e77b356565b7c8d18812747b261f0605aae4 (patch)
tree669258341cb2099c6be4d7d5909bcebb0307dcc4
parentb7b412a5ee120091770e9c8bd10b5cb17a8a9aa4 (diff)
downloadchromium_src-10a6e77b356565b7c8d18812747b261f0605aae4.zip
chromium_src-10a6e77b356565b7c8d18812747b261f0605aae4.tar.gz
chromium_src-10a6e77b356565b7c8d18812747b261f0605aae4.tar.bz2
bsds: views/ and webkit/ support for FreeBSD/OpenBSD
- add a TOOLKIT_USES_GTK #define to catch GTK and Views+GTK - lots of ifdef twiddling Review URL: http://codereview.chromium.org/519030 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35402 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--build/build_config.h6
-rw-r--r--views/view.cc2
-rw-r--r--views/views.gyp6
-rw-r--r--webkit/default_plugin/plugin_impl.h4
-rw-r--r--webkit/glue/plugins/nphostapi.h2
-rw-r--r--webkit/glue/plugins/plugin_host.cc9
-rw-r--r--webkit/glue/plugins/plugin_lib.cc6
-rw-r--r--webkit/glue/plugins/plugin_lib.h4
-rw-r--r--webkit/glue/plugins/plugin_list.h4
-rw-r--r--webkit/glue/plugins/test/plugin_javascript_open_popup.cc4
-rw-r--r--webkit/glue/resource_fetcher_unittest.cc17
-rw-r--r--webkit/glue/webclipboard_impl.cc2
-rw-r--r--webkit/glue/webdevtoolsfrontend_impl.cc10
-rw-r--r--webkit/glue/webkit_glue.cc8
-rw-r--r--webkit/glue/webkit_resources.grd2
-rw-r--r--webkit/glue/webkitclient_impl.cc3
-rw-r--r--webkit/tools/layout_tests/layout_package/platform_utils.py2
-rw-r--r--webkit/tools/npapi_layout_test_plugin/main.cpp16
-rw-r--r--webkit/tools/test_shell/keyboard_unittest.cc6
-rw-r--r--webkit/tools/test_shell/media_leak_test.cc2
-rw-r--r--webkit/tools/test_shell/mock_webclipboard_impl.cc2
-rw-r--r--webkit/tools/test_shell/plugin_tests.cc2
-rw-r--r--webkit/tools/test_shell/test_shell.cc4
-rw-r--r--webkit/tools/test_shell/test_shell.gyp16
-rw-r--r--webkit/tools/test_shell/test_shell_request_context.cc3
-rw-r--r--webkit/tools/test_shell/test_webview_delegate.cc2
-rw-r--r--webkit/tools/test_shell/test_webview_delegate.h4
-rw-r--r--webkit/tools/test_shell/webview_host.h7
-rw-r--r--webkit/tools/test_shell/webwidget_host.h4
29 files changed, 85 insertions, 74 deletions
diff --git a/build/build_config.h b/build/build_config.h
index d8cea82..da7a37f 100644
--- a/build/build_config.h
+++ b/build/build_config.h
@@ -36,6 +36,12 @@
#error Please add support for your platform in build/build_config.h
#endif
+// A flag derived from the above flags, used to cover GTK code in
+// both TOOLKIT_GTK and TOOLKIT_VIEWS.
+#if defined(TOOLKIT_GTK) || (defined(TOOLKIT_VIEWS) && !defined(OS_WIN))
+#define TOOLKIT_USES_GTK 1
+#endif
+
#if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_OPENBSD)
#define USE_NSS 1 // Use NSS for crypto.
#define USE_X11 1 // Use X for graphics.
diff --git a/views/view.cc b/views/view.cc
index 123fe86..248622b 100644
--- a/views/view.cc
+++ b/views/view.cc
@@ -433,7 +433,7 @@ bool View::HitTest(const gfx::Point& l) const {
// TODO: can this use SkRegion's contains instead?
#if defined(OS_WIN)
return !!PtInRegion(rgn, l.x(), l.y());
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_USES_GTK)
return gdk_region_point_in(rgn.Get(), l.x(), l.y());
#endif
}
diff --git a/views/views.gyp b/views/views.gyp
index c48e5de..2697eec 100644
--- a/views/views.gyp
+++ b/views/views.gyp
@@ -13,7 +13,7 @@
['exclude', '/(gtk|win|x11)_[^/]*\\.cc$'],
],
'conditions': [
- ['OS=="linux"', {'sources/': [
+ ['OS=="linux" or OS=="freebsd" or OS=="openbsd"', {'sources/': [
['include', '/gtk/'],
['include', '_(gtk|linux|posix|skia|x)\\.cc$'],
['include', '/(gtk|x11)_[^/]*\\.cc$'],
@@ -297,7 +297,7 @@
'../chrome/third_party/wtl/include',
],
'conditions': [
- ['OS=="linux"', {
+ ['OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
'dependencies': [
'../build/linux/system.gyp:gtk',
'../build/linux/system.gyp:x11',
@@ -375,7 +375,7 @@
'<(SHARED_INTERMEDIATE_DIR)/app/app_resources/app_resources.rc',
],
'conditions': [
- ['OS=="linux"', {
+ ['OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
'dependencies': [
'../build/linux/system.gyp:gtk',
'../chrome/chrome.gyp:packed_resources',
diff --git a/webkit/default_plugin/plugin_impl.h b/webkit/default_plugin/plugin_impl.h
index 1bf9558..723cb05 100644
--- a/webkit/default_plugin/plugin_impl.h
+++ b/webkit/default_plugin/plugin_impl.h
@@ -4,8 +4,8 @@
#if defined(OS_WIN)
#include "webkit/default_plugin/plugin_impl_win.h"
-#elif defined (OS_MACOSX)
+#elif defined(OS_MACOSX)
#include "webkit/default_plugin/plugin_impl_mac.h"
-#elif defined (OS_LINUX)
+#elif defined(TOOLKIT_USES_GTK)
#include "webkit/default_plugin/plugin_impl_gtk.h"
#endif
diff --git a/webkit/glue/plugins/nphostapi.h b/webkit/glue/plugins/nphostapi.h
index 7985a57..115c2d7 100644
--- a/webkit/glue/plugins/nphostapi.h
+++ b/webkit/glue/plugins/nphostapi.h
@@ -309,7 +309,7 @@ typedef struct _NPNetscapeFuncs {
//
// NPAPI library entry points
//
-#if defined(OS_LINUX) || defined(OS_FREEBSD)
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
typedef NPError (API_CALL * NP_InitializeFunc)(NPNetscapeFuncs* pNFuncs,
NPPluginFuncs* pPFuncs);
#else
diff --git a/webkit/glue/plugins/plugin_host.cc b/webkit/glue/plugins/plugin_host.cc
index 0c6e54d..3274937 100644
--- a/webkit/glue/plugins/plugin_host.cc
+++ b/webkit/glue/plugins/plugin_host.cc
@@ -705,24 +705,22 @@ NPError NPN_GetValue(NPP id, NPNVariable variable, void* value) {
}
break;
}
+ #if !defined(OS_MACOSX) // OS X doesn't have windowed plugins.
case NPNVnetscapeWindow: {
- #if defined(OS_WIN) || defined(OS_LINUX)
scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id);
gfx::PluginWindowHandle handle = plugin->window_handle();
*((void**)value) = (void*)handle;
rv = NPERR_NO_ERROR;
- #else
- NOTIMPLEMENTED();
- #endif
break;
}
+ #endif
case NPNVjavascriptEnabledBool: {
// yes, JS is enabled.
*((void**)value) = (void*)1;
rv = NPERR_NO_ERROR;
break;
}
- #if defined(OS_LINUX)
+ #if defined(TOOLKIT_USES_GTK)
case NPNVToolkit:
// Tell them we are GTK2. (The alternative is GTK 1.2.)
*reinterpret_cast<int*>(value) = NPNVGtk2;
@@ -730,7 +728,6 @@ NPError NPN_GetValue(NPP id, NPNVariable variable, void* value) {
break;
case NPNVSupportsXEmbedBool:
- // Yes, we support XEmbed.
*reinterpret_cast<NPBool*>(value) = TRUE;
rv = NPERR_NO_ERROR;
break;
diff --git a/webkit/glue/plugins/plugin_lib.cc b/webkit/glue/plugins/plugin_lib.cc
index 0e5ccf6..2768fc7 100644
--- a/webkit/glue/plugins/plugin_lib.cc
+++ b/webkit/glue/plugins/plugin_lib.cc
@@ -103,7 +103,7 @@ NPError PluginLib::NP_Initialize() {
if (host == 0)
return NPERR_GENERIC_ERROR;
-#if defined(OS_LINUX) || defined(OS_FREEBSD)
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
NPError rv = entry_points_.np_initialize(host->host_functions(),
&plugin_funcs_);
#else
@@ -176,7 +176,7 @@ bool PluginLib::Load() {
if (entry_points_.np_initialize == 0)
rv = false;
-#if !defined(OS_LINUX) && !defined(OS_FREEBSD)
+#if defined(OS_WIN) || defined(OS_MACOSX)
entry_points_.np_getentrypoints =
(NP_GetEntryPointsFunc)base::GetFunctionPointerFromNativeLibrary(
library, "NP_GetEntryPoints");
@@ -196,7 +196,7 @@ bool PluginLib::Load() {
if (rv) {
plugin_funcs_.size = sizeof(plugin_funcs_);
plugin_funcs_.version = (NP_VERSION_MAJOR << 8) | NP_VERSION_MINOR;
-#if !defined(OS_LINUX) && !defined(OS_FREEBSD) && !defined(OS_MACOSX)
+#if !defined(OS_POSIX)
if (entry_points_.np_getentrypoints(&plugin_funcs_) != NPERR_NO_ERROR)
rv = false;
#else
diff --git a/webkit/glue/plugins/plugin_lib.h b/webkit/glue/plugins/plugin_lib.h
index 6af8f9c..7dded2f 100644
--- a/webkit/glue/plugins/plugin_lib.h
+++ b/webkit/glue/plugins/plugin_lib.h
@@ -33,9 +33,9 @@ class PluginLib : public base::RefCounted<PluginLib> {
// Returns false if the library couldn't be found, or if it's not a plugin.
static bool ReadWebPluginInfo(const FilePath& filename, WebPluginInfo* info);
-#if defined(OS_LINUX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
// Parse the result of an NP_GetMIMEDescription() call.
- // This API is only used on Linux, and is exposed here for testing.
+ // This API is only used on Unixes, and is exposed here for testing.
static void ParseMIMEDescription(const std::string& description,
std::vector<WebPluginMimeType>* mime_types);
#endif
diff --git a/webkit/glue/plugins/plugin_list.h b/webkit/glue/plugins/plugin_list.h
index ec82fd0..e16f5ea 100644
--- a/webkit/glue/plugins/plugin_list.h
+++ b/webkit/glue/plugins/plugin_list.h
@@ -31,9 +31,9 @@ namespace NPAPI {
class PluginInstance;
// This struct holds entry points into a plugin. The entry points are
-// slightly different between Linux and other platforms.
+// slightly different between Win/Mac and Unixes.
struct PluginEntryPoints {
-#if !defined(OS_LINUX) && !defined(OS_FREEBSD)
+#if !defined(OS_POSIX) || defined(OS_MACOSX)
NP_GetEntryPointsFunc np_getentrypoints;
#endif
NP_InitializeFunc np_initialize;
diff --git a/webkit/glue/plugins/test/plugin_javascript_open_popup.cc b/webkit/glue/plugins/test/plugin_javascript_open_popup.cc
index 558aa71..0d3f0c0 100644
--- a/webkit/glue/plugins/test/plugin_javascript_open_popup.cc
+++ b/webkit/glue/plugins/test/plugin_javascript_open_popup.cc
@@ -5,7 +5,7 @@
#include "build/build_config.h"
#include "webkit/glue/plugins/test/plugin_javascript_open_popup.h"
-#if defined(OS_LINUX)
+#if defined(USE_X11)
#include "third_party/npapi/bindings/npapi_x11.h"
#endif
#include "webkit/glue/plugins/test/plugin_client.h"
@@ -63,7 +63,7 @@ bool ExecuteJavascriptPopupWindowTargetPluginTest::CheckWindow(
return false;
}
-#elif defined(OS_LINUX)
+#elif defined(USE_X11)
// This code blindly follows the same sorts of verifications done on
// the Windows side. Does it make sense on X? Maybe not really, but
// it can't hurt to do extra validations.
diff --git a/webkit/glue/resource_fetcher_unittest.cc b/webkit/glue/resource_fetcher_unittest.cc
index e1022a0..f83cebc 100644
--- a/webkit/glue/resource_fetcher_unittest.cc
+++ b/webkit/glue/resource_fetcher_unittest.cc
@@ -2,18 +2,19 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#if defined(OS_LINUX)
-#include <gtk/gtk.h>
-#endif
+#include "webkit/glue/resource_fetcher.h"
#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h"
#include "third_party/WebKit/WebKit/chromium/public/WebURLResponse.h"
#include "third_party/WebKit/WebKit/chromium/public/WebView.h"
#include "webkit/glue/unittest_test_server.h"
-#include "webkit/glue/resource_fetcher.h"
#include "webkit/tools/test_shell/simple_resource_loader_bridge.h"
#include "webkit/tools/test_shell/test_shell_test.h"
+#if defined(TOOLKIT_USES_GTK)
+#include <gtk/gtk.h>
+#endif
+
using WebKit::WebFrame;
using WebKit::WebURLResponse;
using webkit_glue::ResourceFetcher;
@@ -76,7 +77,7 @@ class FetcherDelegate {
#if defined(OS_WIN)
timer_id_ = ::SetTimer(NULL, NULL, interval,
&FetcherDelegate::TimerCallback);
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_USES_GTK)
timer_id_ = g_timeout_add(interval, &FetcherDelegate::TimerCallback, NULL);
#elif defined(OS_MACOSX)
// CFAbsoluteTime is in seconds and |interval| is in ms, so make sure we
@@ -93,7 +94,7 @@ class FetcherDelegate {
void DestroyTimer() {
#if defined(OS_WIN)
::KillTimer(NULL, timer_id_);
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_USES_GTK)
g_source_remove(timer_id_);
#elif defined(OS_MACOSX)
CFRunLoopRemoveTimer(CFRunLoopGetCurrent(), timer_id_,
@@ -108,7 +109,7 @@ class FetcherDelegate {
DWORD ms) {
instance_->TimerFired();
}
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_USES_GTK)
static gboolean TimerCallback(gpointer data) {
instance_->TimerFired();
return true;
@@ -137,7 +138,7 @@ class FetcherDelegate {
private:
#if defined(OS_WIN)
UINT_PTR timer_id_;
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_USES_GTK)
guint timer_id_;
#elif defined(OS_MACOSX)
CFRunLoopTimerRef timer_id_;
diff --git a/webkit/glue/webclipboard_impl.cc b/webkit/glue/webclipboard_impl.cc
index 4d73652..cf9cdbd 100644
--- a/webkit/glue/webclipboard_impl.cc
+++ b/webkit/glue/webclipboard_impl.cc
@@ -173,7 +173,7 @@ bool WebClipboardImpl::ConvertBufferType(Buffer buffer,
*result = Clipboard::BUFFER_STANDARD;
break;
case BufferSelection:
-#if defined(OS_LINUX)
+#if defined(USE_X11)
*result = Clipboard::BUFFER_SELECTION;
break;
#endif
diff --git a/webkit/glue/webdevtoolsfrontend_impl.cc b/webkit/glue/webdevtoolsfrontend_impl.cc
index 8949fca..0eb9399 100644
--- a/webkit/glue/webdevtoolsfrontend_impl.cc
+++ b/webkit/glue/webdevtoolsfrontend_impl.cc
@@ -390,11 +390,15 @@ v8::Handle<v8::Value> WebDevToolsFrontendImpl::JsLoaded(
// static
v8::Handle<v8::Value> WebDevToolsFrontendImpl::JsPlatform(
const v8::Arguments& args) {
-#if defined OS_MACOSX
+#if defined(OS_MACOSX)
return v8String("mac-leopard");
-#elif defined OS_LINUX
+#elif defined(OS_LINUX)
return v8String("linux");
-#else
+#elif defined(OS_FREEBSD)
+ return v8String("freebsd");
+#elif defined(OS_OPENBSD)
+ return v8String("openbsd");
+#elif defined(OS_WIN)
return v8String("windows");
#endif
}
diff --git a/webkit/glue/webkit_glue.cc b/webkit/glue/webkit_glue.cc
index 0b3c39b..38c0e12 100644
--- a/webkit/glue/webkit_glue.cc
+++ b/webkit/glue/webkit_glue.cc
@@ -8,7 +8,7 @@
#if defined(OS_WIN)
#include <objidl.h>
#include <mlang.h>
-#elif defined(OS_LINUX) || defined(OS_FREEBSD)
+#elif defined(OS_POSIX) && !defined(OS_MACOSX)
#include <sys/utsname.h>
#endif
@@ -368,7 +368,7 @@ std::string BuildOSCpuInfo() {
&os_minor_version,
&os_bugfix_version);
#endif
-#if !defined(OS_WIN) && !defined(OS_MACOSX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
// Should work on any Posix system.
struct utsname unixinfo;
uname(&unixinfo);
@@ -421,7 +421,7 @@ void BuildUserAgent(bool mimic_chrome1, bool mimic_windows,
"Windows";
#elif defined(OS_MACOSX)
"Macintosh";
-#elif defined(OS_LINUX)
+#elif defined(USE_X11)
"X11"; // strange, but that's what Firefox uses
#else
"?";
@@ -499,7 +499,7 @@ const std::string& GetUserAgent(const GURL& url) {
BuildUserAgent(true, false, &g_user_agent->mimic_chrome1_user_agent);
return g_user_agent->mimic_chrome1_user_agent;
}
-#if defined(OS_LINUX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
else if (MatchPatternASCII(url.host(), "*.mail.yahoo.com")) {
// mail.yahoo.com is ok with Windows Chrome but not Linux Chrome.
// http://bugs.chromium.org/11136
diff --git a/webkit/glue/webkit_resources.grd b/webkit/glue/webkit_resources.grd
index c867271..3c9f380 100644
--- a/webkit/glue/webkit_resources.grd
+++ b/webkit/glue/webkit_resources.grd
@@ -30,7 +30,7 @@
<include name="IDR_MEDIA_SLIDER_THUMB" file="resources\media_slider_thumb.png" type="BINDATA" />
<include name="IDR_MEDIA_VOLUME_SLIDER_THUMB" file="resources\media_volume_slider_thumb.png" type="BINDATA" />
- <if expr="os == 'linux2'">
+ <if expr="os == 'linux2' or os == 'freebsd7' or os == 'openbsd4'">
<include name="IDR_LINUX_CHECKBOX_OFF" file="resources\linux-checkbox-off.png" type="BINDATA" />
<include name="IDR_LINUX_CHECKBOX_ON" file="resources\linux-checkbox-on.png" type="BINDATA" />
<include name="IDR_LINUX_CHECKBOX_DISABLED_OFF" file="resources\linux-checkbox-disabled-off.png" type="BINDATA" />
diff --git a/webkit/glue/webkitclient_impl.cc b/webkit/glue/webkitclient_impl.cc
index c7673cf..f6b7952 100644
--- a/webkit/glue/webkitclient_impl.cc
+++ b/webkit/glue/webkitclient_impl.cc
@@ -208,7 +208,8 @@ WebData WebKitClientImpl::loadResource(const char* name) {
{ "mediaSoundDisabled", IDR_MEDIA_SOUND_DISABLED },
{ "mediaSliderThumb", IDR_MEDIA_SLIDER_THUMB },
{ "mediaVolumeSliderThumb", IDR_MEDIA_VOLUME_SLIDER_THUMB },
-#if defined(OS_LINUX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
+ // TODO(port): rename these to "skia" instead of "Linux".
{ "linuxCheckboxOff", IDR_LINUX_CHECKBOX_OFF },
{ "linuxCheckboxOn", IDR_LINUX_CHECKBOX_ON },
{ "linuxCheckboxDisabledOff", IDR_LINUX_CHECKBOX_DISABLED_OFF },
diff --git a/webkit/tools/layout_tests/layout_package/platform_utils.py b/webkit/tools/layout_tests/layout_package/platform_utils.py
index 2b6755b..64ccce2 100644
--- a/webkit/tools/layout_tests/layout_package/platform_utils.py
+++ b/webkit/tools/layout_tests/layout_package/platform_utils.py
@@ -21,5 +21,5 @@ if sys.platform in ('cygwin', 'win32'):
from platform_utils_win import *
elif sys.platform == 'darwin':
from platform_utils_mac import *
-elif sys.platform in ('linux', 'linux2'):
+elif sys.platform in ('linux', 'linux2', 'freebsd7', 'openbsd4'):
from platform_utils_linux import *
diff --git a/webkit/tools/npapi_layout_test_plugin/main.cpp b/webkit/tools/npapi_layout_test_plugin/main.cpp
index 1b41f7e6..a644d03 100644
--- a/webkit/tools/npapi_layout_test_plugin/main.cpp
+++ b/webkit/tools/npapi_layout_test_plugin/main.cpp
@@ -49,21 +49,21 @@
#define EXPORT
#endif
-#if defined(OS_LINUX)
+#if defined(USE_X11)
#include <X11/Xlib.h>
#endif
// Plugin entry points
extern "C" {
EXPORT NPError NPAPI NP_Initialize(NPNetscapeFuncs *browserFuncs
-#if defined(OS_LINUX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
, NPPluginFuncs *pluginFuncs
#endif
);
EXPORT NPError NPAPI NP_GetEntryPoints(NPPluginFuncs *pluginFuncs);
EXPORT void NPAPI NP_Shutdown(void);
-#if defined(OS_LINUX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
EXPORT NPError NPAPI NP_GetValue(NPP instance, NPPVariable variable, void *value);
EXPORT const char* NPAPI NP_GetMIMEDescription(void);
#endif
@@ -71,13 +71,13 @@ extern "C" {
// Plugin entry points
EXPORT NPError NPAPI NP_Initialize(NPNetscapeFuncs *browserFuncs
-#if defined(OS_LINUX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
, NPPluginFuncs *pluginFuncs
#endif
)
{
browser = browserFuncs;
-#if defined(OS_LINUX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
return NP_GetEntryPoints(pluginFuncs);
#else
return NPERR_NO_ERROR;
@@ -318,7 +318,7 @@ int16 NPP_HandleEvent(NPP instance, void *event)
fflush(stdout);
-#elif defined(OS_LINUX)
+#elif defined(USE_X11)
XEvent* evt = static_cast<XEvent*>(event);
XButtonPressedEvent* bpress_evt = reinterpret_cast<XButtonPressedEvent*>(evt);
XButtonReleasedEvent* brelease_evt = reinterpret_cast<XButtonReleasedEvent*>(evt);
@@ -445,7 +445,7 @@ NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value)
NPError err = NPERR_NO_ERROR;
switch (variable) {
-#if defined(OS_LINUX)
+#if defined(USE_X11)
case NPPVpluginNameString:
*((const char **)value) = "WebKit Test PlugIn";
break;
@@ -478,7 +478,7 @@ NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value)
return NPERR_GENERIC_ERROR;
}
-#if defined(OS_LINUX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
EXPORT NPError NPAPI NP_GetValue(NPP instance, NPPVariable variable, void *value)
{
return NPP_GetValue(instance, variable, value);
diff --git a/webkit/tools/test_shell/keyboard_unittest.cc b/webkit/tools/test_shell/keyboard_unittest.cc
index 65ac39b..6c0e139 100644
--- a/webkit/tools/test_shell/keyboard_unittest.cc
+++ b/webkit/tools/test_shell/keyboard_unittest.cc
@@ -64,10 +64,10 @@ class KeyboardTest : public testing::Test {
// platforms, but meta (command) on Mac.
const char* InterpretOSModifierKeyPress(char key_code) {
WebKeyboardEvent keyboard_event;
-#if defined(OS_WIN) || defined(OS_LINUX)
- WebInputEvent::Modifiers os_modifier = WebInputEvent::ControlKey;
-#elif defined(OS_MACOSX)
+#if defined(OS_MACOSX)
WebInputEvent::Modifiers os_modifier = WebInputEvent::MetaKey;
+#else
+ WebInputEvent::Modifiers os_modifier = WebInputEvent::ControlKey;
#endif
SetupKeyDownEvent(&keyboard_event, key_code, os_modifier);
return InterpretKeyEvent(keyboard_event, PlatformKeyboardEvent::RawKeyDown);
diff --git a/webkit/tools/test_shell/media_leak_test.cc b/webkit/tools/test_shell/media_leak_test.cc
index e56054b..1332b67 100644
--- a/webkit/tools/test_shell/media_leak_test.cc
+++ b/webkit/tools/test_shell/media_leak_test.cc
@@ -12,7 +12,7 @@
class MediaLeakTest : public TestShellTest {
};
-#if defined(OS_WIN) || defined(OS_LINUX)
+#if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MACOSX))
// This test plays a Theora video file for 1 second. It tries to expose
// memory leaks during a normal playback.
diff --git a/webkit/tools/test_shell/mock_webclipboard_impl.cc b/webkit/tools/test_shell/mock_webclipboard_impl.cc
index 867d076..d161291 100644
--- a/webkit/tools/test_shell/mock_webclipboard_impl.cc
+++ b/webkit/tools/test_shell/mock_webclipboard_impl.cc
@@ -33,7 +33,7 @@ bool MockWebClipboardImpl::isFormatAvailable(Format format, Buffer buffer) {
case BufferStandard:
break;
case BufferSelection:
-#if defined(OS_LINUX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
break;
#endif
default:
diff --git a/webkit/tools/test_shell/plugin_tests.cc b/webkit/tools/test_shell/plugin_tests.cc
index 4dc58da..816a846 100644
--- a/webkit/tools/test_shell/plugin_tests.cc
+++ b/webkit/tools/test_shell/plugin_tests.cc
@@ -26,7 +26,7 @@ using WebKit::WebString;
#define TEST_PLUGIN_NAME "npapi_test_plugin.dll"
#elif defined(OS_MACOSX)
#define TEST_PLUGIN_NAME "npapi_test_plugin.plugin"
-#elif defined(OS_LINUX)
+#elif defined(OS_POSIX)
#define TEST_PLUGIN_NAME "libnpapi_test_plugin.so"
#endif
diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc
index 9793381..1745f37 100644
--- a/webkit/tools/test_shell/test_shell.cc
+++ b/webkit/tools/test_shell/test_shell.cc
@@ -300,10 +300,10 @@ std::string TestShell::DumpImage(skia::PlatformCanvas* canvas,
#if defined(OS_WIN)
bool discard_transparency = true;
device.makeOpaque(0, 0, src_bmp.width(), src_bmp.height());
-#elif defined(OS_LINUX)
- bool discard_transparency = true;
#elif defined(OS_MACOSX)
bool discard_transparency = false;
+#elif defined(OS_POSIX)
+ bool discard_transparency = true;
#endif
// Compute MD5 sum. We should have done this before calling
diff --git a/webkit/tools/test_shell/test_shell.gyp b/webkit/tools/test_shell/test_shell.gyp
index 3b78abf..bb27787 100644
--- a/webkit/tools/test_shell/test_shell.gyp
+++ b/webkit/tools/test_shell/test_shell.gyp
@@ -134,7 +134,7 @@
'npapi_test_plugin',
],
}],
- ['OS=="linux"', {
+ ['OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
'dependencies': [
'test_shell_resources',
'../../../build/linux/system.gyp:gtk',
@@ -148,7 +148,7 @@
['exclude', '_x11\\.cc$'],
],
}],
- ['OS=="linux"', {
+ ['OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
# See below TODO in the Windows branch.
'copies': [
{
@@ -212,7 +212,7 @@
'pak_path': '<(INTERMEDIATE_DIR)/repack/test_shell.pak',
},
'conditions': [
- ['OS=="linux"', {
+ ['OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
'actions': [
{
'action_name': 'test_shell_repack',
@@ -295,7 +295,7 @@
'<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_strings_en-US.rc',
],
}],
- ['OS=="linux"', {
+ ['OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
'conditions': [
['linux_use_tcmalloc==1', {
'dependencies': [
@@ -445,7 +445,7 @@
],
'sources': [ '<@(test_shell_windows_resource_files)' ],
}],
- ['OS=="linux"', {
+ ['OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
'dependencies': [
'test_shell_pak',
'../../../build/linux/system.gyp:gtk',
@@ -557,7 +557,7 @@
],
},
}],
- ['OS=="linux" and (target_arch=="x64" or target_arch=="arm")', {
+ ['(OS=="linux" or OS=="freebsd" or OS=="openbsd") and (target_arch=="x64" or target_arch=="arm")', {
# Shared libraries need -fPIC on x86-64
'cflags': ['-fPIC']
}],
@@ -659,7 +659,7 @@
'../../glue/plugins/test/plugin_windowless_test.cc',
],
}],
- ['OS=="linux" and (target_arch=="x64" or target_arch=="arm")', {
+ ['(OS=="linux" or OS=="freebsd" or OS=="openbsd") and (target_arch=="x64" or target_arch=="arm")', {
# Shared libraries need -fPIC on x86-64
'cflags': ['-fPIC']
}],
@@ -667,7 +667,7 @@
},
],
}],
- ['OS=="linux"', {
+ ['OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
'targets': [
{
'target_name': 'test_shell_resources',
diff --git a/webkit/tools/test_shell/test_shell_request_context.cc b/webkit/tools/test_shell/test_shell_request_context.cc
index d7055b6f..678b375 100644
--- a/webkit/tools/test_shell/test_shell_request_context.cc
+++ b/webkit/tools/test_shell/test_shell_request_context.cc
@@ -37,7 +37,7 @@ void TestShellRequestContext::Init(
accept_language_ = "en-us,en";
accept_charset_ = "iso-8859-1,*,utf-8";
-#if defined(OS_LINUX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
// Use no proxy to avoid ProxyConfigServiceLinux.
// Enabling use of the ProxyConfigServiceLinux requires:
// -Calling from a thread with a TYPE_UI MessageLoop,
@@ -45,6 +45,7 @@ void TestShellRequestContext::Init(
// -Keep in mind that proxy auto configuration is also
// non-functional on linux in this context because of v8 threading
// issues.
+ // TODO(port): rename "linux" to some nonspecific unix.
scoped_ptr<net::ProxyConfigService> proxy_config_service(
new net::ProxyConfigServiceFixed(net::ProxyConfig()));
#else
diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc
index 3252ace..d283df5 100644
--- a/webkit/tools/test_shell/test_webview_delegate.cc
+++ b/webkit/tools/test_shell/test_webview_delegate.cc
@@ -975,7 +975,7 @@ TestWebViewDelegate::TestWebViewDelegate(TestShell* shell)
page_id_(-1),
last_page_id_updated_(-1),
using_fake_rect_(false),
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_USES_GTK)
cursor_type_(GDK_X_CURSOR),
#endif
smart_insert_delete_enabled_(true),
diff --git a/webkit/tools/test_shell/test_webview_delegate.h b/webkit/tools/test_shell/test_webview_delegate.h
index 079cb5a..25ec35e 100644
--- a/webkit/tools/test_shell/test_webview_delegate.h
+++ b/webkit/tools/test_shell/test_webview_delegate.h
@@ -18,7 +18,7 @@
#include <map>
#include <string>
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_USES_GTK)
#include <gdk/gdkcursor.h>
#endif
@@ -352,7 +352,7 @@ class TestWebViewDelegate : public WebKit::WebViewClient,
scoped_refptr<TestDropDelegate> drop_delegate_;
#endif
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_USES_GTK)
// The type of cursor the window is currently using.
// Used for judging whether a new SetCursor call is actually changing the
// cursor.
diff --git a/webkit/tools/test_shell/webview_host.h b/webkit/tools/test_shell/webview_host.h
index f9fd21a..ed783dd 100644
--- a/webkit/tools/test_shell/webview_host.h
+++ b/webkit/tools/test_shell/webview_host.h
@@ -11,7 +11,8 @@
#include "base/basictypes.h"
#include "base/gfx/rect.h"
#include "webkit/tools/test_shell/webwidget_host.h"
-#if defined(OS_LINUX)
+
+#if defined(TOOLKIT_USES_GTK)
#include "webkit/glue/plugins/gtk_plugin_container_manager.h"
#endif
@@ -34,7 +35,7 @@ class WebViewHost : public WebWidgetHost {
WebKit::WebView* webview() const;
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_USES_GTK)
// Create a new plugin parent container for a given plugin XID.
void CreatePluginContainer(gfx::PluginWindowHandle id);
@@ -55,7 +56,7 @@ class WebViewHost : public WebWidgetHost {
}
#endif
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_USES_GTK)
// Helper class that creates and moves plugin containers.
GtkPluginContainerManager plugin_container_manager_;
#endif
diff --git a/webkit/tools/test_shell/webwidget_host.h b/webkit/tools/test_shell/webwidget_host.h
index cf66ed8..86188c0 100644
--- a/webkit/tools/test_shell/webwidget_host.h
+++ b/webkit/tools/test_shell/webwidget_host.h
@@ -94,7 +94,7 @@ class WebWidgetHost {
void KeyEvent(NSEvent *);
void SetFocus(bool enable);
protected:
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_USES_GTK)
public:
// ---------------------------------------------------------------------------
// This is needed on Linux because the GtkWidget creation is the same between
@@ -139,7 +139,7 @@ class WebWidgetHost {
bool track_mouse_leave_;
#endif
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_GTK)
// Since GtkWindow resize is asynchronous, we have to stash the dimensions,
// so that the backing store doesn't have to wait for sizing to take place.
gfx::Size logical_size_;