summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorpvalchev@google.com <pvalchev@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-23 01:37:15 +0000
committerpvalchev@google.com <pvalchev@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-23 01:37:15 +0000
commitb05be39e20ae9d70bc54c7511d8199517294a2dd (patch)
tree24750b9f4e7ce4061740c08027cea3855572c1af /app
parent53adb9a6d5c506d8df8a08adc092acd524a79753 (diff)
downloadchromium_src-b05be39e20ae9d70bc54c7511d8199517294a2dd.zip
chromium_src-b05be39e20ae9d70bc54c7511d8199517294a2dd.tar.gz
chromium_src-b05be39e20ae9d70bc54c7511d8199517294a2dd.tar.bz2
OpenBSD/FreeBSD ifdefs and GYP changes for app/ directory
- Use OS_POSIX && !OS_MACOSX defines to capture Linux/*BSD as they have many similarities, use other defines instead of OS_LINUX where sensible. Based on original work by Sprewell and Ben Laurie on FreeBSD port Review URL: http://codereview.chromium.org/548126 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36931 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app')
-rw-r--r--app/app.gyp2
-rw-r--r--app/app_base.gypi4
-rw-r--r--app/clipboard/clipboard.cc4
-rw-r--r--app/clipboard/clipboard.h14
-rw-r--r--app/clipboard/clipboard_unittest.cc4
-rw-r--r--app/drag_drop_types.h2
-rw-r--r--app/gfx/blit.cc6
-rw-r--r--app/gfx/canvas.h4
-rw-r--r--app/gfx/font.h12
-rw-r--r--app/gfx/insets.h4
-rw-r--r--app/l10n_util.cc8
-rw-r--r--app/l10n_util_unittest.cc8
-rw-r--r--app/os_exchange_data.h4
-rw-r--r--app/resource_bundle_posix.cc2
-rw-r--r--app/resources/app_resources.grd4
-rw-r--r--app/theme_provider.h36
16 files changed, 58 insertions, 60 deletions
diff --git a/app/app.gyp b/app/app.gyp
index dcabe1d..460696e 100644
--- a/app/app.gyp
+++ b/app/app.gyp
@@ -64,7 +64,7 @@
'..',
],
'conditions': [
- ['OS=="linux"', {
+ ['OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
'dependencies': [
'../build/linux/system.gyp:gtk',
'../tools/xdisplaycheck/xdisplaycheck.gyp:xdisplaycheck',
diff --git a/app/app_base.gypi b/app/app_base.gypi
index a0a7544..6b4eed0 100644
--- a/app/app_base.gypi
+++ b/app/app_base.gypi
@@ -43,7 +43,7 @@
'win_util_path.cc',
],
}],
- ['OS!="linux"', {
+ ['OS!="linux" and OS!="freebsd" and OS!="openbsd"', {
'sources!': [
'gfx/gtk_util.cc',
'gfx/gtk_util.h',
@@ -198,7 +198,7 @@
'throb_animation.h',
],
'conditions': [
- ['OS=="linux"', {
+ ['OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
'dependencies': [
# font_gtk.cc uses fontconfig.
# TODO(evanm): I think this is wrong; it should just use GTK.
diff --git a/app/clipboard/clipboard.cc b/app/clipboard/clipboard.cc
index 4103c3a..a2050a0 100644
--- a/app/clipboard/clipboard.cc
+++ b/app/clipboard/clipboard.cc
@@ -67,12 +67,12 @@ void Clipboard::DispatchObject(ObjectType type, const ObjectMapParams& params) {
WriteBitmap(&(params[0].front()), &(params[1].front()));
break;
-#if defined(OS_WIN) || defined(OS_LINUX)
+#if !defined(OS_MACOSX)
case CBF_DATA:
WriteData(&(params[0].front()), params[0].size(),
&(params[1].front()), params[1].size());
break;
-#endif // defined(OS_WIN) || defined(OS_LINUX)
+#endif // !defined(OS_MACOSX)
default:
NOTREACHED();
diff --git a/app/clipboard/clipboard.h b/app/clipboard/clipboard.h
index 80a35e6..faaa00c 100644
--- a/app/clipboard/clipboard.h
+++ b/app/clipboard/clipboard.h
@@ -76,7 +76,7 @@ class Clipboard {
// functions accept a buffer parameter.
enum Buffer {
BUFFER_STANDARD,
-#if defined(OS_LINUX)
+#if defined(USE_X11)
BUFFER_SELECTION,
#endif
};
@@ -85,7 +85,7 @@ class Clipboard {
switch (buffer) {
case BUFFER_STANDARD:
return true;
-#if defined(OS_LINUX)
+#if defined(USE_X11)
case BUFFER_SELECTION:
return true;
#endif
@@ -112,11 +112,11 @@ class Clipboard {
// can use.
void WriteObjects(const ObjectMap& objects, base::ProcessHandle process);
- // On Linux, we need to know when the clipboard is set to a URL. Most
+ // On Linux/BSD, we need to know when the clipboard is set to a URL. Most
// platforms don't care.
-#if !defined(OS_LINUX)
+#if defined(OS_WIN) || defined(OS_MACOSX)
void DidWriteURL(const std::string& utf8_text) {}
-#else // !defined(OS_LINUX)
+#else // !defined(OS_WIN) && !defined(OS_MACOSX)
void DidWriteURL(const std::string& utf8_text);
#endif
@@ -193,7 +193,7 @@ class Clipboard {
void WriteBitmap(const char* pixel_data, const char* size_data);
-#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_FREEBSD)
+#if !defined(OS_MACOSX)
// |format_name| is an ASCII string and should be NULL-terminated.
// TODO(estade): port to mac.
void WriteData(const char* format_name, size_t format_len,
@@ -226,7 +226,7 @@ class Clipboard {
// True if we can create a window.
bool create_window_;
-#elif defined(USE_X11)
+#elif !defined(OS_MACOSX)
// The public API is via WriteObjects() which dispatches to multiple
// Write*() calls, but on GTK we must write all the clipboard types
// in a single GTK call. To support this we store the current set
diff --git a/app/clipboard/clipboard_unittest.cc b/app/clipboard/clipboard_unittest.cc
index 6f19d97..81f400d 100644
--- a/app/clipboard/clipboard_unittest.cc
+++ b/app/clipboard/clipboard_unittest.cc
@@ -130,7 +130,7 @@ TEST_F(ClipboardTest, TrickyHTMLTest) {
}
// TODO(estade): Port the following test (decide what target we use for urls)
-#if !defined(OS_LINUX)
+#if !defined(OS_POSIX) || defined(OS_MACOSX)
TEST_F(ClipboardTest, BookmarkTest) {
Clipboard clipboard;
@@ -213,7 +213,7 @@ TEST_F(ClipboardTest, URLTest) {
#endif // defined(OS_LINUX)
}
-#if defined(OS_WIN) || defined(OS_LINUX)
+#if defined(OS_WIN) || (defined(OS_POSIX) && !defined(OS_MACOSX))
TEST_F(ClipboardTest, DataTest) {
Clipboard clipboard;
const char* format = "chromium/x-test-format";
diff --git a/app/drag_drop_types.h b/app/drag_drop_types.h
index 011d386..c3b2692 100644
--- a/app/drag_drop_types.h
+++ b/app/drag_drop_types.h
@@ -21,7 +21,7 @@ class DragDropTypes {
#if defined(OS_WIN)
static uint32 DragOperationToDropEffect(int drag_operation);
static int DropEffectToDragOperation(uint32 effect);
-#elif defined(OS_LINUX)
+#elif !defined(OS_MACOSX)
static int DragOperationToGdkDragAction(int drag_operation);
static int GdkDragActionToDragOperation(int gdk_drag_action);
#endif
diff --git a/app/gfx/blit.cc b/app/gfx/blit.cc
index 359e142..99ac09f 100644
--- a/app/gfx/blit.cc
+++ b/app/gfx/blit.cc
@@ -4,7 +4,7 @@
#include "app/gfx/blit.h"
-#if defined(OS_LINUX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
#include <cairo/cairo.h>
#endif
@@ -45,7 +45,7 @@ void BlitContextToContext(NativeDrawingContext dst_context,
scoped_cftyperef<CGImageRef> src_sub_image(
CGImageCreateWithImageInRect(src_image, src_rect.ToCGRect()));
CGContextDrawImage(dst_context, dst_rect.ToCGRect(), src_sub_image);
-#elif defined(OS_LINUX)
+#else // Linux, BSD, others
// Only translations in the source context are supported; more complex
// source context transforms will be ignored.
cairo_save(dst_context);
@@ -69,7 +69,7 @@ static NativeDrawingContext GetContextFromCanvas(
return device.getBitmapDC();
#elif defined(OS_MACOSX)
return device.GetBitmapContext();
-#elif defined(OS_LINUX)
+#else // Linux, BSD, others
return device.beginPlatformPaint();
#endif
}
diff --git a/app/gfx/canvas.h b/app/gfx/canvas.h
index e6b07a1..e59db16 100644
--- a/app/gfx/canvas.h
+++ b/app/gfx/canvas.h
@@ -14,7 +14,7 @@
#include "base/basictypes.h"
#include "skia/ext/platform_canvas.h"
-#if defined(OS_LINUX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
typedef struct _cairo cairo_t;
typedef struct _GdkPixbuf GdkPixbuf;
#endif
@@ -192,7 +192,7 @@ class Canvas : public skia::PlatformCanvas {
// Extracts a bitmap from the contents of this canvas.
SkBitmap ExtractBitmap() const;
-#if defined(OS_LINUX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
// Applies current matrix on the canvas to the cairo context. This should be
// invoked anytime you plan on drawing directly to the cairo context. Be
// sure and set the matrix back to the identity when done.
diff --git a/app/gfx/font.h b/app/gfx/font.h
index 6be42ee..f79f6d0 100644
--- a/app/gfx/font.h
+++ b/app/gfx/font.h
@@ -11,7 +11,7 @@
#if defined(OS_WIN)
typedef struct HFONT__* HFONT;
-#elif defined(OS_LINUX)
+#elif !defined(OS_MACOSX)
#include "third_party/skia/include/core/SkRefCnt.h"
class SkPaint;
class SkTypeface;
@@ -26,12 +26,10 @@ typedef struct HFONT__* NativeFont;
class NSFont;
#endif
typedef NSFont* NativeFont;
-#elif defined(OS_LINUX)
+#else
typedef struct _PangoFontDescription PangoFontDescription;
class SkTypeface;
typedef SkTypeface* NativeFont;
-#else // null port.
-#error No known OS defined
#endif
#include "base/basictypes.h"
@@ -127,7 +125,7 @@ class Font {
int vertical_dlus_to_pixels(int dlus) {
return dlus * font_ref_->height() / 8;
}
-#elif defined(OS_LINUX)
+#elif !defined(OS_MACOSX)
static Font CreateFont(PangoFontDescription* desc);
// We need a copy constructor and assignment operator to deal with
// the Skia reference counting.
@@ -210,7 +208,7 @@ class Font {
// Indirect reference to the HFontRef, which references the underlying HFONT.
scoped_refptr<HFontRef> font_ref_;
-#elif defined(OS_LINUX)
+#elif !defined(OS_MACOSX)
explicit Font(SkTypeface* typeface, const std::wstring& name,
int size, int style);
// Calculate and cache the font metrics.
@@ -249,7 +247,7 @@ class Font {
double avg_width_;
double underline_position_;
double underline_thickness_;
-#elif defined(OS_MACOSX)
+#else // OS_MACOSX
explicit Font(const std::wstring& font_name, int font_size, int style);
// Calculate and cache the font metrics.
diff --git a/app/gfx/insets.h b/app/gfx/insets.h
index 70b3683..9dddbbd 100644
--- a/app/gfx/insets.h
+++ b/app/gfx/insets.h
@@ -7,7 +7,7 @@
#include "build/build_config.h"
-#if defined(OS_LINUX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
#include <gtk/gtkstyle.h>
#endif
@@ -28,7 +28,7 @@ class Insets {
left_(left),
bottom_(bottom),
right_(right) {}
-#if defined(OS_LINUX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
explicit Insets(const GtkBorder& border)
: top_(border.top),
left_(border.left),
diff --git a/app/l10n_util.cc b/app/l10n_util.cc
index 9a24cf9..9f81006 100644
--- a/app/l10n_util.cc
+++ b/app/l10n_util.cc
@@ -387,7 +387,7 @@ std::string GetSystemLocale() {
return ret;
}
-#if defined(OS_LINUX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
// Split and normalize the language list specified by LANGUAGE environment.
// LANGUAGE environment specifies a priority list of user prefered locales for
// application UI messages. Locales are separated by ':' character. The format
@@ -458,8 +458,8 @@ std::string GetApplicationLocale(const std::wstring& pref_locale) {
// Next, try the system locale.
candidates.push_back(system_locale);
-#elif defined(OS_LINUX)
- // On Linux, we also check LANGUAGE environment variable, which is supported
+#elif defined(OS_POSIX)
+ // On POSIX, we also check LANGUAGE environment variable, which is supported
// by gettext to specify a priority list of prefered languages.
const char* env_language = ::getenv("LANGUAGE");
if (env_language)
@@ -902,7 +902,7 @@ void WrapPathWithLTRFormatting(const FilePath& path,
rtl_safe_path->append(UTF8ToUTF16(path.value()));
#elif defined(OS_WIN)
rtl_safe_path->append(path.value());
-#else // defined(OS_LINUX)
+#else // defined(OS_POSIX) && !defined(OS_MACOSX)
std::wstring wide_path = base::SysNativeMBToWide(path.value());
rtl_safe_path->append(WideToUTF16(wide_path));
#endif
diff --git a/app/l10n_util_unittest.cc b/app/l10n_util_unittest.cc
index 489e725..8cdf3c9 100644
--- a/app/l10n_util_unittest.cc
+++ b/app/l10n_util_unittest.cc
@@ -4,7 +4,7 @@
#include "build/build_config.h"
-#if defined(OS_LINUX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
#include <cstdlib>
#endif
@@ -95,7 +95,7 @@ void SetICUDefaultLocale(const std::string& locale_string) {
EXPECT_TRUE(U_SUCCESS(error_code));
}
-#if defined(OS_WIN) || defined(OS_LINUX)
+#if !defined(OS_MACOSX)
// We are disabling this test on MacOS because GetApplicationLocale() as an
// API isn't something that we'll easily be able to unit test in this manner.
// The meaning of that API, on the Mac, is "the locale used by Cocoa's main
@@ -140,7 +140,7 @@ TEST_F(L10nUtilTest, GetAppLocale) {
// Keep a copy of ICU's default locale before we overwrite it.
icu::Locale locale = icu::Locale::getDefault();
-#if defined(OS_LINUX)
+#if defined(OS_POSIX)
// Test the support of LANGUAGE environment variable.
SetICUDefaultLocale("en-US");
::setenv("LANGUAGE", "xx:fr_CA", 1);
@@ -246,7 +246,7 @@ TEST_F(L10nUtilTest, GetAppLocale) {
UErrorCode error_code = U_ZERO_ERROR;
icu::Locale::setDefault(locale, error_code);
}
-#endif // defined(OS_WIN) || defined(OS_LINUX)
+#endif // !defined(OS_MACOSX)
TEST_F(L10nUtilTest, SortStringsUsingFunction) {
std::vector<StringWrapper*> strings;
diff --git a/app/os_exchange_data.h b/app/os_exchange_data.h
index 5677409..b38e655 100644
--- a/app/os_exchange_data.h
+++ b/app/os_exchange_data.h
@@ -13,7 +13,7 @@
#if defined(OS_WIN)
#include <objidl.h>
-#elif defined(OS_LINUX)
+#elif !defined(OS_MACOSX)
#include <gtk/gtk.h>
#endif
@@ -45,7 +45,7 @@ class OSExchangeData {
// nodes are written using a CustomFormat.
#if defined(OS_WIN)
typedef CLIPFORMAT CustomFormat;
-#elif defined(OS_LINUX)
+#elif !defined(OS_MACOSX)
typedef GdkAtom CustomFormat;
#endif
diff --git a/app/resource_bundle_posix.cc b/app/resource_bundle_posix.cc
index 665df25..462240f 100644
--- a/app/resource_bundle_posix.cc
+++ b/app/resource_bundle_posix.cc
@@ -27,7 +27,7 @@ base::DataPack* LoadResourcesDataPak(FilePath resources_pak_path) {
ResourceBundle::~ResourceBundle() {
FreeImages();
-#if defined(OS_LINUX)
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
FreeGdkPixBufs();
#endif
delete locale_resources_data_;
diff --git a/app/resources/app_resources.grd b/app/resources/app_resources.grd
index a0534a1..b6b3819 100644
--- a/app/resources/app_resources.grd
+++ b/app/resources/app_resources.grd
@@ -31,8 +31,8 @@
<include name="IDR_MINIMIZE_P" file="minimize_p.png" type="BINDATA" />
</if>
- <if expr="os == 'linux2'">
- <!-- Window controls for Linux, in the style of Metacity -->
+ <if expr="os == 'linux2' or os == 'freebsd7' or os == 'openbsd4'">
+ <!-- Window controls for Linux/BSD, in the style of Metacity -->
<include name="IDR_CLOSE" file="linux_close.png" type="BINDATA" />
<include name="IDR_CLOSE_H" file="linux_close_h.png" type="BINDATA" />
<include name="IDR_CLOSE_P" file="linux_close_p.png" type="BINDATA" />
diff --git a/app/theme_provider.h b/app/theme_provider.h
index 13b421e..cd97fa8 100644
--- a/app/theme_provider.h
+++ b/app/theme_provider.h
@@ -10,10 +10,7 @@
#include "base/basictypes.h"
#include "third_party/skia/include/core/SkColor.h"
-#if defined(OS_LINUX)
-typedef struct _GdkColor GdkColor;
-typedef struct _GdkPixbuf GdkPixbuf;
-#elif defined(OS_MACOSX)
+#if defined(OS_MACOSX)
#ifdef __OBJC__
@class NSColor;
@class NSImage;
@@ -21,6 +18,9 @@ typedef struct _GdkPixbuf GdkPixbuf;
class NSColor;
class NSImage;
#endif // __OBJC__
+#elif !defined(OS_WIN)
+typedef struct _GdkColor GdkColor;
+typedef struct _GdkPixbuf GdkPixbuf;
#endif // OS_*
class Profile;
@@ -67,20 +67,7 @@ class ThemeProvider {
// implementations of ThemeProvider. Returns NULL on error.
virtual RefCountedMemory* GetRawData(int id) const = 0;
-#if defined(OS_LINUX) && !defined(TOOLKIT_VIEWS)
- // Gets the GdkPixbuf with the specified |id|. Returns a pointer to a shared
- // instance of the GdkPixbuf. This shared GdkPixbuf is owned by the theme
- // provider and should not be freed.
- //
- // The bitmap is assumed to exist. This function will log in release, and
- // assert in debug mode if it does not. On failure, this will return a
- // pointer to a shared empty placeholder bitmap so it will be visible what
- // is missing.
- virtual GdkPixbuf* GetPixbufNamed(int id) const = 0;
-
- // As above, but flips it in RTL locales.
- virtual GdkPixbuf* GetRTLEnabledPixbufNamed(int id) const = 0;
-#elif defined(OS_MACOSX)
+#if defined(OS_MACOSX)
// Gets the NSImage with the specified |id|.
//
// The bitmap is not assumed to exist. If a theme does not provide an image,
@@ -98,6 +85,19 @@ class ThemeProvider {
// The tint is not assumed to exist. If a theme does not provide a tint with
// that id, this function will return nil.
virtual NSColor* GetNSColorTint(int id) const = 0;
+#elif defined(OS_POSIX) && !defined(TOOLKIT_VIEWS)
+ // Gets the GdkPixbuf with the specified |id|. Returns a pointer to a shared
+ // instance of the GdkPixbuf. This shared GdkPixbuf is owned by the theme
+ // provider and should not be freed.
+ //
+ // The bitmap is assumed to exist. This function will log in release, and
+ // assert in debug mode if it does not. On failure, this will return a
+ // pointer to a shared empty placeholder bitmap so it will be visible what
+ // is missing.
+ virtual GdkPixbuf* GetPixbufNamed(int id) const = 0;
+
+ // As above, but flips it in RTL locales.
+ virtual GdkPixbuf* GetRTLEnabledPixbufNamed(int id) const = 0;
#endif
};