diff options
author | chromium@hybridsource.org <chromium@hybridsource.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-25 23:44:58 +0000 |
---|---|---|
committer | chromium@hybridsource.org <chromium@hybridsource.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-25 23:44:58 +0000 |
commit | 2ec8df5602bedf518d0119005690b101d5b598ef (patch) | |
tree | 04b9d44fdc22ceab2d10a02108765729062241c4 /ui | |
parent | 88efcce0d60e09489d8a3761f4c8fd0d4b51c625 (diff) | |
download | chromium_src-2ec8df5602bedf518d0119005690b101d5b598ef.zip chromium_src-2ec8df5602bedf518d0119005690b101d5b598ef.tar.gz chromium_src-2ec8df5602bedf518d0119005690b101d5b598ef.tar.bz2 |
Made the OS_LINUX ifdefs in ui/ and webkit/ directories more cross-platform, so that these files can be used on multiple POSIX platforms.
Review URL: http://codereview.chromium.org/6990051
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86742 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/base/clipboard/clipboard_unittest.cc | 6 | ||||
-rw-r--r-- | ui/base/l10n/l10n_util.cc | 2 | ||||
-rw-r--r-- | ui/gfx/font_unittest.cc | 4 | ||||
-rw-r--r-- | ui/gfx/gl/gl_bindings.h | 13 | ||||
-rw-r--r-- | ui/gfx/gl/gl_context_egl.cc | 2 | ||||
-rw-r--r-- | ui/gfx/gl/gl_surface_egl.cc | 4 | ||||
-rw-r--r-- | ui/gfx/image.cc | 16 | ||||
-rw-r--r-- | ui/gfx/image.h | 4 | ||||
-rw-r--r-- | ui/gfx/image_unittest.cc | 2 | ||||
-rw-r--r-- | ui/gfx/image_unittest_util.cc | 6 | ||||
-rw-r--r-- | ui/gfx/image_unittest_util.h | 2 | ||||
-rw-r--r-- | ui/gfx/native_widget_types.h | 4 | ||||
-rw-r--r-- | ui/views/events/accelerator.cc | 4 | ||||
-rw-r--r-- | ui/views/focus/accelerator_handler.h | 2 | ||||
-rw-r--r-- | ui/views/focus/focus_manager.cc | 2 |
15 files changed, 36 insertions, 37 deletions
diff --git a/ui/base/clipboard/clipboard_unittest.cc b/ui/base/clipboard/clipboard_unittest.cc index a486ed1..5707a7e 100644 --- a/ui/base/clipboard/clipboard_unittest.cc +++ b/ui/base/clipboard/clipboard_unittest.cc @@ -142,7 +142,7 @@ TEST_F(ClipboardTest, TrickyHTMLTest) { #endif // defined(OS_WIN) } -#if defined(OS_LINUX) +#if defined(OS_POSIX) && !defined(OS_MACOSX) // Regression test for crbug.com/56298 (pasting empty HTML crashes Linux). TEST_F(ClipboardTest, EmptyHTMLTest) { Clipboard clipboard; @@ -239,11 +239,11 @@ TEST_F(ClipboardTest, URLTest) { clipboard.ReadAsciiText(Clipboard::BUFFER_STANDARD, &ascii_text); EXPECT_EQ(UTF16ToUTF8(url), ascii_text); -#if defined(OS_LINUX) +#if defined(OS_POSIX) && !defined(OS_MACOSX) ascii_text.clear(); clipboard.ReadAsciiText(Clipboard::BUFFER_SELECTION, &ascii_text); EXPECT_EQ(UTF16ToUTF8(url), ascii_text); -#endif // defined(OS_LINUX) +#endif } TEST_F(ClipboardTest, SharedBitmapTest) { diff --git a/ui/base/l10n/l10n_util.cc b/ui/base/l10n/l10n_util.cc index dc5f8d6..3dbce9a 100644 --- a/ui/base/l10n/l10n_util.cc +++ b/ui/base/l10n/l10n_util.cc @@ -320,7 +320,7 @@ bool CheckAndResolveLocale(const std::string& locale, // if "foo bar" is RTL. So this function prepends the necessary RLM in such // cases. void AdjustParagraphDirectionality(string16* paragraph) { -#if defined(OS_LINUX) +#if defined(OS_POSIX) && !defined(OS_MACOSX) if (base::i18n::IsRTL() && base::i18n::StringContainsStrongRTLChars(*paragraph)) { paragraph->insert(0, 1, static_cast<char16>(base::i18n::kRightToLeftMark)); diff --git a/ui/gfx/font_unittest.cc b/ui/gfx/font_unittest.cc index 7ea01db..b8de407 100644 --- a/ui/gfx/font_unittest.cc +++ b/ui/gfx/font_unittest.cc @@ -7,7 +7,7 @@ #include "base/utf_string_conversions.h" #include "testing/gtest/include/gtest/gtest.h" -#if defined(OS_LINUX) +#if defined(OS_POSIX) && !defined(OS_MACOSX) #include <pango/pango.h> #elif defined(OS_WIN) #include "ui/gfx/platform_font_win.h" @@ -22,7 +22,7 @@ class FontTest : public testing::Test { // Fulfills the memory management contract as outlined by the comment at // gfx::Font::GetNativeFont(). void FreeIfNecessary(gfx::NativeFont font) { -#if defined(OS_LINUX) +#if defined(OS_POSIX) && !defined(OS_MACOSX) pango_font_description_free(font); #endif } diff --git a/ui/gfx/gl/gl_bindings.h b/ui/gfx/gl/gl_bindings.h index 8c16a97..c478d70 100644 --- a/ui/gfx/gl/gl_bindings.h +++ b/ui/gfx/gl/gl_bindings.h @@ -22,7 +22,9 @@ // The standard OpenGL native extension headers are also included. #if defined(OS_WIN) #include <GL/wglext.h> -#elif defined(OS_LINUX) +#elif defined(OS_MACOSX) +#include <OpenGL/OpenGL.h> +#elif defined(USE_X11) #include <GL/glx.h> #include <GL/glxext.h> @@ -31,9 +33,6 @@ #undef Bool #undef None #undef Status - -#elif defined(OS_MACOSX) -#include <OpenGL/OpenGL.h> #endif #if defined(OS_WIN) @@ -52,7 +51,7 @@ typedef struct osmesa_context *OSMesaContext; typedef void (*OSMESAproc)(); -#if defined(OS_WIN) || defined(OS_LINUX) +#if !defined(OS_MACOSX) // Forward declare EGL types. typedef unsigned int EGLBoolean; @@ -75,7 +74,7 @@ typedef Pixmap EGLNativePixmapType; typedef Window EGLNativeWindowType; #endif -#endif // OS_WIN || OS_LINUX +#endif // !OS_MACOSX #include "gl_bindings_autogen_gl.h" #include "gl_bindings_autogen_osmesa.h" @@ -83,7 +82,7 @@ typedef Window EGLNativeWindowType; #if defined(OS_WIN) #include "gl_bindings_autogen_egl.h" #include "gl_bindings_autogen_wgl.h" -#elif defined(OS_LINUX) +#elif defined(USE_X11) #include "gl_bindings_autogen_egl.h" #include "gl_bindings_autogen_glx.h" #endif diff --git a/ui/gfx/gl/gl_context_egl.cc b/ui/gfx/gl/gl_context_egl.cc index d15dd17..14701c0 100644 --- a/ui/gfx/gl/gl_context_egl.cc +++ b/ui/gfx/gl/gl_context_egl.cc @@ -15,7 +15,7 @@ // it brings in #defines that cause conflicts. #include "ui/gfx/gl/gl_bindings.h" -#if defined(OS_LINUX) +#if defined(USE_X11) extern "C" { #include <X11/Xlib.h> } diff --git a/ui/gfx/gl/gl_surface_egl.cc b/ui/gfx/gl/gl_surface_egl.cc index 55cbc55..285f003 100644 --- a/ui/gfx/gl/gl_surface_egl.cc +++ b/ui/gfx/gl/gl_surface_egl.cc @@ -14,7 +14,7 @@ // it brings in #defines that cause conflicts. #include "ui/gfx/gl/gl_bindings.h" -#if defined(OS_LINUX) +#if defined(USE_X11) extern "C" { #include <X11/Xlib.h> } @@ -38,7 +38,7 @@ bool GLSurfaceEGL::InitializeOneOff() { if (initialized) return true; -#ifdef OS_LINUX +#if defined(USE_X11) EGLNativeDisplayType native_display = XOpenDisplay(NULL); #else EGLNativeDisplayType native_display = EGL_DEFAULT_DISPLAY; diff --git a/ui/gfx/image.cc b/ui/gfx/image.cc index 272eb79..6e1af44 100644 --- a/ui/gfx/image.cc +++ b/ui/gfx/image.cc @@ -10,7 +10,7 @@ #include "base/stl_util-inl.h" #include "third_party/skia/include/core/SkBitmap.h" -#if defined(OS_LINUX) +#if defined(TOOLKIT_USES_GTK) #include <gdk-pixbuf/gdk-pixbuf.h> #include <glib-object.h> #include "ui/gfx/canvas_skia.h" @@ -30,7 +30,7 @@ namespace internal { bool NSImageToSkBitmaps(NSImage* image, std::vector<const SkBitmap*>* bitmaps); #endif -#if defined(OS_LINUX) +#if defined(TOOLKIT_USES_GTK) const SkBitmap* GdkPixbufToSkBitmap(GdkPixbuf* pixbuf) { gfx::CanvasSkia canvas(gdk_pixbuf_get_width(pixbuf), gdk_pixbuf_get_height(pixbuf), @@ -62,7 +62,7 @@ class ImageRep { return reinterpret_cast<ImageRepSkia*>(this); } -#if defined(OS_LINUX) +#if defined(TOOLKIT_USES_GTK) ImageRepGdk* AsImageRepGdk() { CHECK_EQ(type_, Image::kImageRepGdk); return reinterpret_cast<ImageRepGdk*>(this); @@ -110,7 +110,7 @@ class ImageRepSkia : public ImageRep { DISALLOW_COPY_AND_ASSIGN(ImageRepSkia); }; -#if defined(OS_LINUX) +#if defined(TOOLKIT_USES_GTK) class ImageRepGdk : public ImageRep { public: explicit ImageRepGdk(GdkPixbuf* pixbuf) @@ -207,7 +207,7 @@ Image::Image(const std::vector<const SkBitmap*>& bitmaps) AddRepresentation(rep); } -#if defined(OS_LINUX) +#if defined(TOOLKIT_USES_GTK) Image::Image(GdkPixbuf* pixbuf) : storage_(new internal::ImageStorage(Image::kImageRepGdk)) { internal::ImageRepGdk* rep = new internal::ImageRepGdk(pixbuf); @@ -243,7 +243,7 @@ Image::operator const SkBitmap&() const { return *(this->operator const SkBitmap*()); } -#if defined(OS_LINUX) +#if defined(TOOLKIT_USES_GTK) Image::operator GdkPixbuf*() const { internal::ImageRep* rep = GetRepresentation(Image::kImageRepGdk); return rep->AsImageRepGdk()->pixbuf(); @@ -295,7 +295,7 @@ internal::ImageRep* Image::GetRepresentation( // Handle native-to-Skia conversion. if (rep_type == Image::kImageRepSkia) { internal::ImageRepSkia* rep = NULL; -#if defined(OS_LINUX) +#if defined(TOOLKIT_USES_GTK) if (storage_->default_representation_type() == Image::kImageRepGdk) { internal::ImageRepGdk* pixbuf_rep = default_rep->AsImageRepGdk(); rep = new internal::ImageRepSkia( @@ -318,7 +318,7 @@ internal::ImageRep* Image::GetRepresentation( if (default_rep->type() == Image::kImageRepSkia) { internal::ImageRepSkia* skia_rep = default_rep->AsImageRepSkia(); internal::ImageRep* native_rep = NULL; -#if defined(OS_LINUX) +#if defined(TOOLKIT_USES_GTK) if (rep_type == Image::kImageRepGdk) { GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(skia_rep->bitmap()); native_rep = new internal::ImageRepGdk(pixbuf); diff --git a/ui/gfx/image.h b/ui/gfx/image.h index df088fe..d9117ed 100644 --- a/ui/gfx/image.h +++ b/ui/gfx/image.h @@ -58,7 +58,7 @@ class Image { // of bitmaps, one for each resolution. explicit Image(const std::vector<const SkBitmap*>& bitmaps); -#if defined(OS_LINUX) +#if defined(TOOLKIT_USES_GTK) // Does not increase |pixbuf|'s reference count; expects to take ownership. explicit Image(GdkPixbuf* pixbuf); #elif defined(OS_MACOSX) @@ -81,7 +81,7 @@ class Image { // Conversion handlers. operator const SkBitmap*() const ; operator const SkBitmap&() const; -#if defined(OS_LINUX) +#if defined(TOOLKIT_USES_GTK) operator GdkPixbuf*() const; #elif defined(OS_MACOSX) operator NSImage*() const; diff --git a/ui/gfx/image_unittest.cc b/ui/gfx/image_unittest.cc index b617efd..e3de074 100644 --- a/ui/gfx/image_unittest.cc +++ b/ui/gfx/image_unittest.cc @@ -8,7 +8,7 @@ #include "ui/gfx/image.h" #include "ui/gfx/image_unittest_util.h" -#if defined(OS_LINUX) +#if defined(TOOLKIT_USES_GTK) #include <gtk/gtk.h> #include "ui/gfx/gtk_util.h" #elif defined(OS_MACOSX) diff --git a/ui/gfx/image_unittest_util.cc b/ui/gfx/image_unittest_util.cc index bb1265b..170a525 100644 --- a/ui/gfx/image_unittest_util.cc +++ b/ui/gfx/image_unittest_util.cc @@ -10,7 +10,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "third_party/skia/include/core/SkBitmap.h" -#if defined(OS_LINUX) +#if defined(TOOLKIT_USES_GTK) #include "ui/gfx/gtk_util.h" #elif defined(OS_MACOSX) #include "base/mac/mac_util.h" @@ -34,7 +34,7 @@ PlatformImage CreatePlatformImage() { NSImage* image = gfx::SkBitmapToNSImage(*(bitmap.get())); base::mac::NSObjectRetain(image); return image; -#elif defined(OS_LINUX) && !defined(TOOLKIT_VIEWS) +#elif defined(TOOLKIT_GTK) return gfx::GdkPixbufFromSkBitmap(bitmap.get()); #else return bitmap.release(); @@ -44,7 +44,7 @@ PlatformImage CreatePlatformImage() { gfx::Image::RepresentationType GetPlatformRepresentationType() { #if defined(OS_MACOSX) return gfx::Image::kImageRepCocoa; -#elif defined(OS_LINUX) && !defined(TOOLKIT_VIEWS) +#elif defined(TOOLKIT_GTK) return gfx::Image::kImageRepGdk; #else return gfx::Image::kImageRepSkia; diff --git a/ui/gfx/image_unittest_util.h b/ui/gfx/image_unittest_util.h index f087f90..b85c4a4 100644 --- a/ui/gfx/image_unittest_util.h +++ b/ui/gfx/image_unittest_util.h @@ -15,7 +15,7 @@ namespace test { #if defined(OS_MACOSX) typedef NSImage* PlatformImage; -#elif defined(OS_LINUX) && !defined(TOOLKIT_VIEWS) +#elif defined(TOOLKIT_GTK) typedef GdkPixbuf* PlatformImage; #else typedef const SkBitmap* PlatformImage; diff --git a/ui/gfx/native_widget_types.h b/ui/gfx/native_widget_types.h index ba530d9..d5846a4 100644 --- a/ui/gfx/native_widget_types.h +++ b/ui/gfx/native_widget_types.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -97,7 +97,7 @@ typedef GdkRegion* NativeRegion; #if defined(OS_MACOSX) typedef NSImage NativeImageType; -#elif defined(OS_LINUX) && !defined(TOOLKIT_VIEWS) +#elif defined(TOOLKIT_GTK) typedef GdkPixbuf NativeImageType; #else typedef SkBitmap NativeImageType; diff --git a/ui/views/events/accelerator.cc b/ui/views/events/accelerator.cc index 1e8592f..c80f63e 100644 --- a/ui/views/events/accelerator.cc +++ b/ui/views/events/accelerator.cc @@ -6,7 +6,7 @@ #if defined(OS_WIN) #include <windows.h> -#elif defined(OS_LINUX) +#elif defined(TOOLKIT_USES_GTK) #include <gdk/gdk.h> #endif @@ -99,7 +99,7 @@ string16 GetShortcutTextForAccelerator(const Accelerator& accelerator) { else key = LOWORD(::MapVirtualKeyW(accelerator.key_code(), MAPVK_VK_TO_CHAR)); shortcut += key; -#elif defined(OS_LINUX) +#elif defined(TOOLKIT_USES_GTK) const gchar* name = NULL; switch (accelerator.key_code()) { case ui::VKEY_OEM_2: diff --git a/ui/views/focus/accelerator_handler.h b/ui/views/focus/accelerator_handler.h index 3f129ba..c241d0e 100644 --- a/ui/views/focus/accelerator_handler.h +++ b/ui/views/focus/accelerator_handler.h @@ -8,7 +8,7 @@ #include "build/build_config.h" -#if defined(OS_LINUX) +#if defined(TOOLKIT_USES_GTK) #include <gdk/gdk.h> #endif diff --git a/ui/views/focus/focus_manager.cc b/ui/views/focus/focus_manager.cc index 8961bca..6e1e953 100644 --- a/ui/views/focus/focus_manager.cc +++ b/ui/views/focus/focus_manager.cc @@ -8,7 +8,7 @@ #include "build/build_config.h" -#if defined(OS_LINUX) +#if defined(TOOLKIT_USES_GTK) #include <gtk/gtk.h> #endif |