summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/clipboard.h6
-rwxr-xr-xbase/gfx/rect.cc8
-rwxr-xr-xbase/gfx/rect.h12
-rw-r--r--base/message_loop.cc8
-rw-r--r--build/common.gypi3
-rw-r--r--chrome/common/chrome_paths_linux.cc4
-rw-r--r--chrome/common/gfx/chrome_canvas.h2
-rw-r--r--chrome/common/gfx/path.h4
-rw-r--r--chrome/common/native_web_keyboard_event.h6
-rw-r--r--chrome/common/resource_bundle.cc4
-rw-r--r--chrome/common/resource_bundle.h2
-rw-r--r--chrome/common/resource_bundle_linux.cc4
-rw-r--r--chrome/views/widget/root_view.h6
-rw-r--r--skia/include/corecg/SkUserConfig.h7
-rw-r--r--webkit/glue/webcursor.h4
-rw-r--r--webkit/glue/webframe_impl.cc2
-rw-r--r--webkit/glue/webplugin_impl.cc7
-rwxr-xr-xwebkit/tools/test_shell/test_shell.cc8
-rw-r--r--webkit/tools/test_shell/test_webview_delegate.h6
-rw-r--r--webkit/tools/test_shell/webwidget_host.h16
20 files changed, 83 insertions, 36 deletions
diff --git a/base/clipboard.h b/base/clipboard.h
index 546c498..0e4363d 100644
--- a/base/clipboard.h
+++ b/base/clipboard.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -18,7 +18,9 @@ class Clipboard {
public:
typedef std::string FormatType;
#if defined(OS_LINUX)
+#if defined(TOOLKIT_GTK)
typedef struct _GtkClipboard GtkClipboard;
+#endif
typedef std::map<FormatType, std::pair<char*, size_t> > TargetMap;
#endif
@@ -195,8 +197,10 @@ class Clipboard {
void InsertMapping(const char* key, char* data, size_t data_len);
TargetMap* clipboard_data_;
+#if defined(TOOLKIT_GTK)
GtkClipboard* clipboard_;
#endif
+#endif
DISALLOW_EVIL_CONSTRUCTORS(Clipboard);
};
diff --git a/base/gfx/rect.cc b/base/gfx/rect.cc
index 3e7d782..003766b 100755
--- a/base/gfx/rect.cc
+++ b/base/gfx/rect.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -8,7 +8,7 @@
#include <windows.h>
#elif defined(OS_MACOSX)
#include <CoreGraphics/CGGeometry.h>
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_GTK)
#include <gdk/gdk.h>
#endif
@@ -74,7 +74,7 @@ Rect& Rect::operator=(const CGRect& r) {
set_height(r.size.height);
return *this;
}
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_GTK)
Rect::Rect(const GdkRectangle& r)
: origin_(r.x, r.y) {
set_width(r.width);
@@ -140,7 +140,7 @@ RECT Rect::ToRECT() const {
r.bottom = bottom();
return r;
}
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_GTK)
GdkRectangle Rect::ToGdkRectangle() const {
GdkRectangle r = {x(), y(), width(), height()};
return r;
diff --git a/base/gfx/rect.h b/base/gfx/rect.h
index 4428fec..21083b2 100755
--- a/base/gfx/rect.h
+++ b/base/gfx/rect.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -19,9 +19,7 @@
#if defined(OS_WIN)
typedef struct tagRECT RECT;
-#elif defined(OS_LINUX)
-// It's wrong to hide GDK stuff behind OS_LINUX, but until we have a different
-// linux target, this is less complex.
+#elif defined(TOOLKIT_GTK)
typedef struct _GdkRectangle GdkRectangle;
#endif
@@ -36,7 +34,7 @@ class Rect {
explicit Rect(const RECT& r);
#elif defined(OS_MACOSX)
explicit Rect(const CGRect& r);
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_GTK)
explicit Rect(const GdkRectangle& r);
#endif
Rect(const gfx::Point& origin, const gfx::Size& size);
@@ -47,7 +45,7 @@ class Rect {
Rect& operator=(const RECT& r);
#elif defined(OS_MACOSX)
Rect& operator=(const CGRect& r);
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_GTK)
Rect& operator=(const GdkRectangle& r);
#endif
@@ -99,7 +97,7 @@ class Rect {
#if defined(OS_WIN)
// Construct an equivalent Win32 RECT object.
RECT ToRECT() const;
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_GTK)
GdkRectangle ToGdkRectangle() const;
#elif defined(OS_MACOSX)
// Construct an equivalent CoreGraphics object.
diff --git a/base/message_loop.cc b/base/message_loop.cc
index b4ad2bc..d836c92 100644
--- a/base/message_loop.cc
+++ b/base/message_loop.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -19,7 +19,7 @@
#if defined(OS_POSIX)
#include "base/message_pump_libevent.h"
#endif
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_GTK)
#include "base/message_pump_glib.h"
#endif
@@ -99,7 +99,11 @@ MessageLoop::MessageLoop(Type type)
#if defined(OS_MACOSX)
pump_ = base::MessagePumpMac::Create();
#elif defined(OS_LINUX)
+#if defined(TOOLKIT_GTK)
pump_ = new base::MessagePumpForUI();
+#else
+ pump_ = new base::MessagePumpDefault();
+#endif
#endif // OS_LINUX
} else if (type_ == TYPE_IO) {
pump_ = new base::MessagePumpLibevent();
diff --git a/build/common.gypi b/build/common.gypi
index 40ce2fd..d80242c 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -47,6 +47,9 @@
}, { # else: branding!="Chrome"
'defines': ['CHROMIUM_BUILD'],
}],
+ ['OS=="linux"', {
+ 'defines': ['TOOLKIT_GTK=1'],
+ }],
['coverage!=0', {
'conditions': [
['OS=="mac"', {
diff --git a/chrome/common/chrome_paths_linux.cc b/chrome/common/chrome_paths_linux.cc
index d3ce207..b1151c5 100644
--- a/chrome/common/chrome_paths_linux.cc
+++ b/chrome/common/chrome_paths_linux.cc
@@ -4,7 +4,9 @@
#include "chrome/common/chrome_paths_internal.h"
+#if defined(TOOLKIT_GTK)
#include <glib.h>
+#endif
#include <stdlib.h>
#include "base/file_path.h"
@@ -19,9 +21,11 @@ FilePath GetHomeDir() {
if (home_dir && home_dir[0])
return FilePath(home_dir);
+#if defined(TOOLKIT_GTK)
home_dir = g_get_home_dir();
if (home_dir && home_dir[0])
return FilePath(home_dir);
+#endif
FilePath rv;
if (PathService::Get(base::DIR_TEMP, &rv))
diff --git a/chrome/common/gfx/chrome_canvas.h b/chrome/common/gfx/chrome_canvas.h
index cf6db1e..84671f1 100644
--- a/chrome/common/gfx/chrome_canvas.h
+++ b/chrome/common/gfx/chrome_canvas.h
@@ -188,7 +188,7 @@ class ChromeCanvas : public skia::PlatformCanvas {
DISALLOW_EVIL_CONSTRUCTORS(ChromeCanvas);
};
-#if defined(OS_WIN) || defined(OS_LINUX)
+#if defined(OS_WIN) || defined(TOOLKIT_GTK)
typedef skia::CanvasPaintT<ChromeCanvas> ChromeCanvasPaint;
#endif
diff --git a/chrome/common/gfx/path.h b/chrome/common/gfx/path.h
index 5003132..7d6d3a0 100644
--- a/chrome/common/gfx/path.h
+++ b/chrome/common/gfx/path.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -25,7 +25,7 @@ class Path : public SkPath {
// Creates a HRGN from the path. The caller is responsible for freeing
// resources used by this region. This only supports polygon paths.
HRGN CreateHRGN() const;
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_GTK)
// Creates a Gdkregion from the path. The caller is responsible for freeing
// resources used by this region. This only supports polygon paths.
GdkRegion* CreateGdkRegion() const;
diff --git a/chrome/common/native_web_keyboard_event.h b/chrome/common/native_web_keyboard_event.h
index 0400b41..c055528 100644
--- a/chrome/common/native_web_keyboard_event.h
+++ b/chrome/common/native_web_keyboard_event.h
@@ -16,7 +16,7 @@
#else
class NSEvent;
#endif // __OBJC__
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_GTK)
#include <gdk/gdk.h>
#endif
@@ -29,7 +29,7 @@ struct NativeWebKeyboardEvent : public WebKit::WebKeyboardEvent {
NativeWebKeyboardEvent(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
#elif defined(OS_MACOSX)
explicit NativeWebKeyboardEvent(NSEvent *event);
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_GTK)
explicit NativeWebKeyboardEvent(const GdkEventKey* event);
#endif
@@ -42,7 +42,7 @@ struct NativeWebKeyboardEvent : public WebKit::WebKeyboardEvent {
MSG os_event;
#elif defined(OS_MACOSX)
NSEvent* os_event;
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_GTK)
GdkEventKey* os_event;
#endif
};
diff --git a/chrome/common/resource_bundle.cc b/chrome/common/resource_bundle.cc
index 3ffc026..f87560d 100644
--- a/chrome/common/resource_bundle.cc
+++ b/chrome/common/resource_bundle.cc
@@ -52,7 +52,9 @@ void ResourceBundle::FreeImages() {
}
void ResourceBundle::SetThemeExtension(const Extension& e) {
+#if !defined(LINUX2)
theme_extension_.reset(new Extension(e));
+#endif
}
/* static */
@@ -63,6 +65,7 @@ SkBitmap* ResourceBundle::LoadBitmap(DataHandle data_handle, int resource_id) {
// it can handle this resource.
// TODO(erikkay): It would be nice to use something less brittle than
// resource_id here.
+#if !defined(LINUX2)
if (g_shared_instance_->theme_extension_.get()) {
FilePath path =
g_shared_instance_->theme_extension_->GetThemeResourcePath(resource_id);
@@ -84,6 +87,7 @@ SkBitmap* ResourceBundle::LoadBitmap(DataHandle data_handle, int resource_id) {
}
}
}
+#endif
if (!success)
success = LoadResourceBytes(data_handle, resource_id, &raw_data);
if (!success)
diff --git a/chrome/common/resource_bundle.h b/chrome/common/resource_bundle.h
index 2305bbc..76b9252 100644
--- a/chrome/common/resource_bundle.h
+++ b/chrome/common/resource_bundle.h
@@ -114,7 +114,7 @@ class ResourceBundle {
// Loads and returns a cursor from the app module.
HCURSOR LoadCursor(int cursor_id);
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_GTK)
// Load a theme image as a GdkPixbuf.
GdkPixbuf* LoadPixbuf(int resource_id);
#endif
diff --git a/chrome/common/resource_bundle_linux.cc b/chrome/common/resource_bundle_linux.cc
index 0a5112f..009b5d3 100644
--- a/chrome/common/resource_bundle_linux.cc
+++ b/chrome/common/resource_bundle_linux.cc
@@ -4,7 +4,9 @@
#include "chrome/common/resource_bundle.h"
+#if defined(TOOLKIT_GTK)
#include <gtk/gtk.h>
+#endif
#include "base/base_paths.h"
#include "base/data_pack.h"
@@ -120,6 +122,7 @@ std::wstring ResourceBundle::GetLocalizedString(int message_id) {
return UTF16ToWide(msg);
}
+#if defined(TOOLKIT_GTK)
GdkPixbuf* ResourceBundle::LoadPixbuf(int resource_id) {
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
std::vector<unsigned char> data;
@@ -143,3 +146,4 @@ GdkPixbuf* ResourceBundle::LoadPixbuf(int resource_id) {
return pixbuf;
}
+#endif
diff --git a/chrome/views/widget/root_view.h b/chrome/views/widget/root_view.h
index afcfd17..73d49cb 100644
--- a/chrome/views/widget/root_view.h
+++ b/chrome/views/widget/root_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -7,7 +7,7 @@
#include "build/build_config.h"
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_GTK)
#include <gtk/gtk.h>
#endif
@@ -184,7 +184,7 @@ class RootView : public View,
#if defined(OS_WIN)
// Invoked from the Widget to service a WM_PAINT call.
void OnPaint(HWND hwnd);
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_GTK)
void OnPaint(GdkEventExpose* event);
#endif
diff --git a/skia/include/corecg/SkUserConfig.h b/skia/include/corecg/SkUserConfig.h
index 34340e1..97ab2fc 100644
--- a/skia/include/corecg/SkUserConfig.h
+++ b/skia/include/corecg/SkUserConfig.h
@@ -145,12 +145,19 @@ typedef unsigned uint32_t;
#error Read the comment at this location
#endif
+#ifdef LINUX2
+#define SK_A32_SHIFT 24
+#define SK_B32_SHIFT 16
+#define SK_G32_SHIFT 8
+#define SK_R32_SHIFT 0
+#else
// For Linux we want to match the most common X visual, which is
// ARGB (in registers)
#define SK_A32_SHIFT 24
#define SK_R32_SHIFT 16
#define SK_G32_SHIFT 8
#define SK_B32_SHIFT 0
+#endif
#endif
diff --git a/webkit/glue/webcursor.h b/webkit/glue/webcursor.h
index a46f881..f2fbe62 100644
--- a/webkit/glue/webcursor.h
+++ b/webkit/glue/webcursor.h
@@ -15,7 +15,7 @@
typedef struct HINSTANCE__* HINSTANCE;
typedef struct HICON__* HICON;
typedef HICON HCURSOR;
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_GTK)
// GdkCursorType is an enum, which we can't forward-declare. :(
#include <gdk/gdkcursor.h>
#elif defined(OS_MACOSX)
@@ -71,7 +71,7 @@ class WebCursor {
// APIs on it.
void InitFromExternalCursor(HCURSOR handle);
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_GTK)
// Return the stock GdkCursorType for this cursor, or GDK_CURSOR_IS_PIXMAP
// if it's a custom cursor. Return GDK_LAST_CURSOR to indicate that the cursor
// should be set to the system default.
diff --git a/webkit/glue/webframe_impl.cc b/webkit/glue/webframe_impl.cc
index a1e5416..1c498cf 100644
--- a/webkit/glue/webframe_impl.cc
+++ b/webkit/glue/webframe_impl.cc
@@ -155,7 +155,7 @@ MSVC_POP_WARNING();
#include "webkit/glue/webtextinput_impl.h"
#include "webkit/glue/webview_impl.h"
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_GTK)
#include <gdk/gdk.h>
#endif
diff --git a/webkit/glue/webplugin_impl.cc b/webkit/glue/webplugin_impl.cc
index f674147..308e4ea 100644
--- a/webkit/glue/webplugin_impl.cc
+++ b/webkit/glue/webplugin_impl.cc
@@ -715,12 +715,15 @@ void WebPluginImpl::paint(WebCore::GraphicsContext* gc,
gc->translate(static_cast<float>(origin.x()),
static_cast<float>(origin.y()));
-#if defined(OS_WIN) || defined(OS_LINUX)
+#if defined(OS_WIN) || defined(TOOLKIT_GTK)
// Note that |context| is only used when in windowless mode.
gfx::NativeDrawingContext context =
gc->platformContext()->canvas()->beginPlatformPaint();
#elif defined(OS_MACOSX)
gfx::NativeDrawingContext context = gc->platformContext();
+#else
+ NOTIMPLEMENTED();
+ gfx::NativeDrawingContext context = NULL;
#endif
WebCore::IntRect window_rect =
@@ -729,7 +732,7 @@ void WebPluginImpl::paint(WebCore::GraphicsContext* gc,
delegate_->Paint(context, webkit_glue::FromIntRect(window_rect));
-#if defined(OS_WIN) || defined(OS_LINUX)
+#if defined(OS_WIN) || defined(TOOLKIT_GTK)
gc->platformContext()->canvas()->endPlatformPaint();
#endif
gc->restore();
diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc
index df8b087..6ce2509 100755
--- a/webkit/tools/test_shell/test_shell.cc
+++ b/webkit/tools/test_shell/test_shell.cc
@@ -574,9 +574,11 @@ void AppendToLog(const char* file, int line, const char* msg) {
logging::LogMessage(file, line).stream() << msg;
}
+#if !defined(LINUX2)
bool GetApplicationDirectory(std::wstring *path) {
return PathService::Get(base::DIR_EXE, path);
}
+#endif
GURL GetInspectorURL() {
return GURL("test-shell-resource://inspector/inspector.html");
@@ -586,9 +588,11 @@ std::string GetUIResourceProtocol() {
return "test-shell-resource";
}
+#if !defined(LINUX2)
bool GetExeDirectory(std::wstring *path) {
return PathService::Get(base::DIR_EXE, path);
}
+#endif
bool SpellCheckWord(const wchar_t* word, int word_len,
int* misspelling_start, int* misspelling_len) {
@@ -598,14 +602,17 @@ bool SpellCheckWord(const wchar_t* word, int word_len,
return true;
}
+#if !defined(LINUX2)
bool IsPluginRunningInRendererProcess() {
return true;
}
+#endif
bool GetPluginFinderURL(std::string* plugin_finder_url) {
return false;
}
+#if !defined(LINUX2)
bool IsDefaultPluginEnabled() {
return false;
}
@@ -613,5 +620,6 @@ bool IsDefaultPluginEnabled() {
std::wstring GetWebKitLocale() {
return L"en-US";
}
+#endif
} // namespace webkit_glue
diff --git a/webkit/tools/test_shell/test_webview_delegate.h b/webkit/tools/test_shell/test_webview_delegate.h
index 03d7387..15f92f5 100644
--- a/webkit/tools/test_shell/test_webview_delegate.h
+++ b/webkit/tools/test_shell/test_webview_delegate.h
@@ -16,7 +16,7 @@
#endif
#include <map>
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_GTK)
#include <gdk/gdkcursor.h>
#endif
@@ -69,7 +69,7 @@ class TestWebViewDelegate : public base::RefCounted<TestWebViewDelegate>,
#else
, select_trailing_whitespace_enabled_(false)
#endif
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_GTK)
, cursor_type_(GDK_X_CURSOR)
#endif
{
@@ -341,7 +341,7 @@ class TestWebViewDelegate : public base::RefCounted<TestWebViewDelegate>,
scoped_refptr<TestDropDelegate> drop_delegate_;
#endif
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_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/webwidget_host.h b/webkit/tools/test_shell/webwidget_host.h
index 1fd02c1..96235a9 100644
--- a/webkit/tools/test_shell/webwidget_host.h
+++ b/webkit/tools/test_shell/webwidget_host.h
@@ -8,16 +8,13 @@
#include "base/basictypes.h"
#include "base/gfx/native_widget_types.h"
#include "base/gfx/rect.h"
+#include "base/gfx/size.h"
#include "base/scoped_ptr.h"
#include "skia/ext/platform_canvas.h"
class WebWidget;
class WebWidgetDelegate;
-namespace gfx {
-class Size;
-}
-
namespace WebKit {
struct WebScreenInfo;
}
@@ -51,6 +48,9 @@ class WebWidgetHost {
#if defined(OS_WIN)
void SetCursor(HCURSOR cursor);
#endif
+#if defined(LINUX2)
+ const gfx::Size& size() const { return size_; }
+#endif
void DiscardBackingStore();
// Allow clients to update the paint rect. For example, if we get a gdk
@@ -58,6 +58,8 @@ class WebWidgetHost {
void UpdatePaintRect(const gfx::Rect& rect);
void Paint();
+ skia::PlatformCanvas* canvas() const { return canvas_.get(); }
+
WebKit::WebScreenInfo GetScreenInfo();
protected:
@@ -112,6 +114,12 @@ class WebWidgetHost {
#endif
}
+#if defined(LINUX2)
+ void ScheduleRepaint(const gfx::Rect& bounds);
+
+ gfx::Size size_;
+#endif
+
gfx::NativeView view_;
WebWidget* webwidget_;
scoped_ptr<skia::PlatformCanvas> canvas_;