head	1.5;
access;
symbols
	RELEASE_7_4_0:1.4
	RELEASE_8_2_0:1.4
	RELEASE_6_EOL:1.2;
locks; strict;
comment	@# @;


1.5
date	2011.04.01.16.45.01;	author rene;	state dead;
branches;
next	1.4;

1.4
date	2010.12.05.20.00.51;	author itetcu;	state Exp;
branches;
next	1.3;

1.3
date	2010.12.05.10.09.28;	author rene;	state Exp;
branches;
next	1.2;

1.2
date	2010.11.13.09.22.45;	author rene;	state Exp;
branches;
next	1.1;

1.1
date	2010.10.13.18.54.31;	author rene;	state Exp;
branches;
next	;


desc
@@


1.5
log
@Update to 10.0.648.204, which is the latest release from the Stable series.

There are still some problems with it on 8.X (and presumably 7.X), see
pkg-message for a possible workaround.

This would not have been possible without:
- portmgr@@ for drawing me into this in October last year
- beat@@ for providing a development repository
- dhw@@ for creating the freebsd-chromium list
- all the patch contributors and testers on the freebsd-chromium list
@
text
@diff --git a/app/app_base.gypi b/app/app_base.gypi
index adefed7..ee12622 100644
--- app/app_base.gypi
+++ app/app_base.gypi
@@@@ -194,7 +194,7 @@@@
         'surface/io_surface_support_mac.cc',
         'surface/io_surface_support_mac.h',
         'surface/transport_dib.h',
-        'surface/transport_dib_linux.cc',
+        'surface/transport_dib_freebsd.cc',
         'surface/transport_dib_mac.cc',
         'surface/transport_dib_win.cc',
         'table_model.cc',
@@@@ -296,7 +296,7 @@@@
             'os_exchange_data.cc',
           ],
         }],
-        ['OS=="linux"', {
+        ['OS=="linux" or OS=="freebsd"', {
           'sources': [
             'gfx/gl/gl_context_egl.cc',
             'gfx/gl/gl_context_egl.h',
@@@@ -319,7 +319,6 @@@@
             'link_settings': {
               'libraries': [
                 '-lX11',
-                '-ldl',
               ],
             },
           },
diff --git a/app/gfx/gl/gl_bindings.h b/app/gfx/gl/gl_bindings.h
index e384bfd..2bf33de 100644
--- app/gfx/gl/gl_bindings.h
+++ app/gfx/gl/gl_bindings.h
@@@@ -18,7 +18,7 @@@@
 // The standard OpenGL native extension headers are also included.
 #if defined(OS_WIN)
 #include <GL/wglext.h>
-#elif defined(OS_LINUX)
+#elif defined(OS_NIX)
 #include <GL/glx.h>
 #include <GL/glxext.h>
 
@@@@ -42,7 +42,7 @@@@
 typedef struct osmesa_context *OSMesaContext;
 typedef void (*OSMESAproc)();
 
-#if defined(OS_WIN) || defined(OS_LINUX)
+#if defined(OS_WIN) || defined(OS_NIX)
 
 // Forward declare EGL types.
 typedef unsigned int EGLBoolean;
@@@@ -65,7 +65,7 @@@@ typedef Pixmap   EGLNativePixmapType;
 typedef Window   EGLNativeWindowType;
 #endif
 
-#endif  // OS_WIN || OS_LINUX
+#endif  // OS_WIN || OS_NIX
 
 #include "gl_bindings_autogen_gl.h"
 #include "gl_bindings_autogen_osmesa.h"
@@@@ -73,7 +73,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(OS_NIX)
 #include "gl_bindings_autogen_egl.h"
 #include "gl_bindings_autogen_glx.h"
 #endif
diff --git a/app/gfx/gl/gl_context_egl.cc b/app/gfx/gl/gl_context_egl.cc
index 1d05eb0..c988081 100644
--- app/gfx/gl/gl_context_egl.cc
+++ app/gfx/gl/gl_context_egl.cc
@@@@ -5,7 +5,7 @@@@
 #include <EGL/egl.h>
 
 #include "build/build_config.h"
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
 #include "app/x11_util.h"
 #define EGL_HAS_PBUFFERS 1
 #endif
@@@@ -28,7 +28,7 @@@@ bool BaseEGLContext::InitializeOneOff() {
   if (initialized)
     return true;
 
-#ifdef OS_LINUX
+#ifdef OS_NIX
   EGLNativeDisplayType native_display = x11_util::GetXDisplay();
 #else
   EGLNativeDisplayType native_display = EGL_DEFAULT_DISPLAY;
diff --git a/app/surface/transport_dib.h b/app/surface/transport_dib.h
index c392c5f..eb19d04 100644
--- app/surface/transport_dib.h
+++ app/surface/transport_dib.h
@@@@ -7,7 +7,7 @@@@
 
 #include "base/basictypes.h"
 
-#if defined(OS_WIN) || defined(OS_MACOSX)
+#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_FREEBSD)
 #include "base/shared_memory.h"
 #endif
 
@@@@ -80,7 +80,7 @@@@ class TransportDIB {
     static int fake_handle = 10;
     return reinterpret_cast<Handle>(fake_handle++);
   }
-#elif defined(OS_MACOSX)
+#elif defined(OS_MACOSX) || defined(OS_FREEBSD)
   typedef base::SharedMemoryHandle Handle;
   // On Mac, the inode number of the backing file is used as an id.
   typedef base::SharedMemoryId Id;
@@@@ -95,7 +95,7 @@@@ class TransportDIB {
     static int fake_handle = 10;
     return Handle(fake_handle++, false);
   }
-#elif defined(USE_X11)
+#elif defined(OS_LINUX)
   typedef int Handle;  // These two ints are SysV IPC shared memory keys
   typedef int Id;
 
@@@@ -161,11 +161,12 @@@@ class TransportDIB {
 
  private:
   TransportDIB();
-#if defined(OS_WIN) || defined(OS_MACOSX)
+#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_FREEBSD)
   explicit TransportDIB(base::SharedMemoryHandle dib);
   base::SharedMemory shared_memory_;
   uint32 sequence_num_;
-#elif defined(USE_X11)
+#endif
+#if defined(USE_X11)
   int key_;  // SysV shared memory id
   void* address_;  // mapped address
   XSharedMemoryId x_shm_;  // X id for the shared segment
diff --git a/app/surface/transport_dib_freebsd.cc b/app/surface/transport_dib_freebsd.cc
new file mode 100644
index 0000000..b49ba71
--- /dev/null
+++ app/surface/transport_dib_freebsd.cc
@@@@ -0,0 +1,86 @@@@
+// 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.
+
+#include "app/surface/transport_dib.h"
+
+#include <unistd.h>
+#include <sys/stat.h>
+
+#include "base/eintr_wrapper.h"
+#include "base/shared_memory.h"
+#include "skia/ext/platform_canvas.h"
+
+TransportDIB::TransportDIB()
+    : size_(0) {
+}
+
+TransportDIB::TransportDIB(TransportDIB::Handle dib)
+    : shared_memory_(dib, false /* read write */),
+      size_(0) {
+}
+
+TransportDIB::~TransportDIB() {
+}
+
+// static
+TransportDIB* TransportDIB::Create(size_t size, uint32 sequence_num) {
+  TransportDIB* dib = new TransportDIB;
+  if (!dib->shared_memory_.Create(L"", false /* read write */,
+                                  false /* do not open existing */, size)) {
+    delete dib;
+    return NULL;
+  }
+
+  dib->size_ = size;
+  return dib;
+}
+
+// static
+TransportDIB* TransportDIB::Map(TransportDIB::Handle handle) {
+  if (!is_valid(handle))
+    return NULL;
+
+  TransportDIB* dib = new TransportDIB(handle);
+  struct stat st;
+  if ((fstat(handle.fd, &st) != 0) ||
+      (!dib->shared_memory_.Map(st.st_size))) {
+    delete dib;
+    HANDLE_EINTR(close(handle.fd));
+    return NULL;
+  }
+
+  dib->size_ = st.st_size;
+
+  return dib;
+}
+
+bool TransportDIB::is_valid(Handle dib) {
+  return dib.fd >= 0;
+}
+
+skia::PlatformCanvas* TransportDIB::GetPlatformCanvas(int w, int h) {
+  return new skia::PlatformCanvas(w, h, true,
+                                  reinterpret_cast<uint8_t*>(memory()));
+}
+
+void* TransportDIB::memory() const {
+  return shared_memory_.memory();
+}
+
+TransportDIB::Id TransportDIB::id() const {
+  return shared_memory_.id();
+}
+
+TransportDIB::Handle TransportDIB::handle() const {
+  return shared_memory_.handle();
+}
+
+XID TransportDIB::MapToX(Display* display) {
+  if (!x_shm_) {
+    x_shm_ = x11_util::AttachSharedMemory(display, key_);
+    display_ = display;
+  }
+
+  return x_shm_;
+}
diff --git a/app/surface/transport_dib_linux.cc b/app/surface/transport_dib_linux.cc
index 26cad3f..b5feed5 100644
--- app/surface/transport_dib_linux.cc
+++ app/surface/transport_dib_linux.cc
@@@@ -28,6 +28,9 @@@@ TransportDIB::TransportDIB()
 TransportDIB::~TransportDIB() {
   if (address_ != kInvalidAddress) {
     shmdt(address_);
+#if defined(OS_FREEBSD)
+    shmctl(key_, IPC_RMID, 0);
+#endif
     address_ = kInvalidAddress;
   }
 
@@@@ -53,7 +56,13 @@@@ TransportDIB* TransportDIB::Create(size_t size, uint32 sequence_num) {
   // Here we mark the shared memory for deletion. Since we attached it in the
   // line above, it doesn't actually get deleted but, if we crash, this means
   // that the kernel will automatically clean it up for us.
+#if !defined(OS_FREEBSD)
+// BSD: A shmctl IPC_RMID call here renders all future shared memory calls for
+// BSD: a particular key to fail on FreeBSD, so I moved this call to the
+// BSD: destructor.  Of course, this means chromium crashes on FreeBSD don't
+// BSD: clean up shared memory.
   shmctl(shmkey, IPC_RMID, 0);
+#endif
   if (address == kInvalidAddress)
     return NULL;
 
diff --git a/app/test_suite.h b/app/test_suite.h
index 3a738b2..bf876dd 100644
--- app/test_suite.h
+++ app/test_suite.h
@@@@ -48,14 +48,14 @@@@ class AppTestSuite : public TestSuite {
     mac_util::SetOverrideAppBundlePath(path);
 #endif  // OS_MACOSX
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
     FilePath pak_dir;
     PathService::Get(base::DIR_MODULE, &pak_dir);
     pak_dir = pak_dir.AppendASCII("app_unittests_strings");
     PathService::Override(app::DIR_LOCALES, pak_dir);
     PathService::Override(app::FILE_RESOURCES_PAK,
                           pak_dir.AppendASCII("app_resources.pak"));
-#endif  // OS_LINUX
+#endif  // OS_NIX
 
     // Force unittests to run using en-US so if we test against string
     // output, it'll pass regardless of the system language.
diff --git a/base/base.gyp b/base/base.gyp
index d2c9a68..8d2e294 100644
--- base/base.gyp
+++ base/base.gyp
@@@@ -230,6 +230,13 @@@@
         'test/test_file_util_posix.cc',
         'test/test_file_util_win.cc',
       ],
+      'conditions': [
+        [ 'OS == "freebsd"', {
+            # fdatasync is not implemented on FreeBSD
+            'sources/': [ ['exclude', '^test/test_file_util_linux.cc$'] ],
+          },
+        ],
+      ],
     },
     {
       'target_name': 'test_support_perf',
diff --git a/base/base.gypi b/base/base.gypi
index ff05d2a..307d902 100644
--- base/base.gypi
+++ base/base.gypi
@@@@ -319,8 +319,6 @@@@
           [ 'OS != "linux"', {
               'sources!': [
                 # Not automatically excluded by the *linux.cc rules.
-                'gtk_util.cc',
-                'gtk_util.h',
                 'linux_util.cc',
                 'setproctitle_linux.c',
                 'setproctitle_linux.h',
@@@@ -556,6 +554,9 @@@@
           ],
         },],
         [ 'OS == "freebsd" or OS == "openbsd"', {
+          'sources!': [
+            'process_linux.cc',
+          ],
           'link_settings': {
             'libraries': [
               '-L/usr/local/lib -lexecinfo',
@@@@ -630,7 +631,7 @@@@
         },
       ],
     }],
-    [ 'OS == "linux" and internal_pdf', {
+    [ '(OS == "linux" or OS == "freebsd") and internal_pdf', {
       'targets': [
         {
           'target_name': 'base_fpic',
diff --git a/base/debug_util_posix.cc b/base/debug_util_posix.cc
index 110cb20..4894cc7 100644
--- base/debug_util_posix.cc
+++ base/debug_util_posix.cc
@@@@ -225,8 +225,8 @@@@ bool DebugUtil::BeingDebugged() {
 
 bool DebugUtil::BeingDebugged() {
   // TODO(benl): can we determine this under FreeBSD?
-  NOTIMPLEMENTED();
-  return false;
+  LOG(WARNING) << "Don't know how to do this";
+  return true;
 }
 
 #endif  // defined(OS_FREEBSD)
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc
index 434c859..10d3200 100644
--- base/file_util_posix.cc
+++ base/file_util_posix.cc
@@@@ -777,7 +777,11 @@@@ bool GetTempDir(FilePath* path) {
 }
 
 bool GetShmemTempDir(FilePath* path) {
+#if defined(OS_LINUX)
   *path = FilePath("/dev/shm");
+#else
+  *path = FilePath("/tmp");
+#endif
   return true;
 }
 
diff --git a/base/leak_annotations.h b/base/leak_annotations.h
index a402acf..85b4c7e 100644
--- base/leak_annotations.h
+++ base/leak_annotations.h
@@@@ -7,7 +7,7 @@@@
 
 #include "build/build_config.h"
 
-#if defined(OS_LINUX) && defined(USE_HEAPCHECKER)
+#if defined(OS_NIX) && defined(USE_HEAPCHECKER)
 
 #include "third_party/tcmalloc/chromium/src/google/heap-checker.h"
 
diff --git a/base/profiler.cc b/base/profiler.cc
index e291117..a6f1486 100644
--- base/profiler.cc
+++ base/profiler.cc
@@@@ -5,7 +5,7 @@@@
 #include "base/profiler.h"
 #include "base/string_util.h"
 
-#if defined(USE_TCMALLOC) && defined(OS_LINUX)
+#if defined(USE_TCMALLOC) && defined(OS_NIX)
 #include "third_party/tcmalloc/chromium/src/google/profiler.h"
 #endif
 
@@@@ -24,7 +24,7 @@@@ namespace base {
 void Profiler::StartRecording() {
 #ifdef QUANTIFY
   QuantifyStartRecordingData();
-#elif defined(USE_TCMALLOC) && defined(OS_LINUX)
+#elif defined(USE_TCMALLOC) && defined(OS_NIX)
   ProfilerStart("chrome-profile");
 #endif
 }
@@@@ -32,13 +32,13 @@@@ void Profiler::StartRecording() {
 void Profiler::StopRecording() {
 #ifdef QUANTIFY
   QuantifyStopRecordingData();
-#elif defined(USE_TCMALLOC) && defined(OS_LINUX)
+#elif defined(USE_TCMALLOC) && defined(OS_NIX)
   ProfilerStop();
 #endif
 }
 
 void Profiler::Flush() {
-#if defined(USE_TCMALLOC) && defined(OS_LINUX)
+#if defined(USE_TCMALLOC) && defined(OS_NIX)
   ProfilerFlush();
 #endif
 }
diff --git a/base/test/test_suite.h b/base/test/test_suite.h
index ff6f131..17d52c0 100644
--- base/test/test_suite.h
+++ base/test/test_suite.h
@@@@ -63,7 +63,7 @@@@ class TestSuite {
 #if defined(OS_POSIX) && !defined(OS_MACOSX)
     g_thread_init(NULL);
     gtk_init_check(&argc, &argv);
-#endif  // defined(OS_LINUX)
+#endif  // defined(OS_POSIX) && !defined(OS_MACOSX)
     // Don't add additional code to this constructor.  Instead add it to
     // Initialize().  See bug 6436.
   }
diff --git a/base/worker_pool_linux.cc b/base/worker_pool_linux.cc
index b9c85b3..3dc08b9 100644
--- base/worker_pool_linux.cc
+++ base/worker_pool_linux.cc
@@@@ -17,7 +17,7 @@@@ namespace {
 const int kIdleSecondsBeforeExit = 10 * 60;
 // A stack size of 64 KB is too small for the CERT_PKIXVerifyCert
 // function of NSS because of NSS bug 439169.
-const int kWorkerThreadStackSize = 128 * 1024;
+const int kWorkerThreadStackSize = 256 * 1024;
 
 class WorkerPoolImpl {
  public:
diff --git a/build/build_config.h b/build/build_config.h
index c0a7bee..32e215c 100644
--- build/build_config.h
+++ build/build_config.h
@@@@ -47,6 +47,7 @@@@
 
 #if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_OPENBSD) || \
     defined(OS_SOLARIS)
+#define OS_NIX 1
 #define USE_NSS 1  // Use NSS for crypto.
 #define USE_X11 1  // Use X for graphics.
 #endif
@@@@ -61,12 +62,12 @@@@
 #endif
 
 // Use tcmalloc
-#if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(NO_TCMALLOC)
+#if (defined(OS_WIN) || defined(OS_NIX)) && !defined(NO_TCMALLOC)
 #define USE_TCMALLOC 1
 #endif
 
 // Use heapchecker.
-#if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(NO_HEAPCHECKER)
+#if (defined(OS_WIN) || defined(OS_NIX)) && !defined(NO_HEAPCHECKER)
 #define USE_HEAPCHECKER 1
 #endif
 
diff --git a/build/common.gypi b/build/common.gypi
index 8a9fd97..8f9abe4 100644
--- build/common.gypi
+++ build/common.gypi
@@@@ -106,7 +106,7 @@@@
       'linux_fpic%': 0,
 
       # Python version.
-      'python_ver%': '2.5',
+      'python_ver%': '2.6',
 
       # Set ARM-v7 compilation flags
       'armv7%': 0,
@@@@ -208,7 +208,7 @@@@
 
     # Whether proprietary audio/video codecs are assumed to be included with
     # this build (only meaningful if branding!=Chrome).
-    'proprietary_codecs%': 0,
+    'proprietary_codecs%': 1,
 
     # TODO(bradnelson): eliminate this when possible.
     # To allow local gyp files to prevent release.vsprops from being included.
@@@@ -246,21 +246,21 @@@@
     'linux_use_debugallocation%': 0,
 
     # Disable TCMalloc's heapchecker.
-    'linux_use_heapchecker%': 0,
+    'linux_use_heapchecker%': 1,
 
     # Set to 1 to turn on seccomp sandbox by default.
     # (Note: this is ignored for official builds.)
     'linux_use_seccomp_sandbox%': 0,
 
     # Set to 1 to link against libgnome-keyring instead of using dlopen().
-    'linux_link_gnome_keyring%': 0,
+    'linux_link_gnome_keyring%': 1,
 
     # Set to select the Title Case versions of strings in GRD files.
     'use_titlecase_in_grd_files%': 0,
 
     # Used to disable Native Client at compile time, for platforms where it
     # isn't supported
-    'disable_nacl%': 0,
+    'disable_nacl%': 1,
 
     # Set Thumb compilation flags.
     'arm_thumb%': 0,
@@@@ -279,13 +279,16 @@@@
     # whether to compile in the sources for the GPU plugin / process.
     'enable_gpu%': 1,
 
+    # Use GConf, the GNOME configuration system.
+    'use_gconf%': 1,
+
     'conditions': [
       ['OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
         # This will set gcc_version to XY if you are running gcc X.Y.*.
         # This is used to tweak build flags for gcc 4.4.
         'gcc_version%': '<!(python <(DEPTH)/build/compiler_version.py)',
         # Figure out the python architecture to decide if we build pyauto.
-        'python_arch%': '<!(<(DEPTH)/build/linux/python_arch.sh <(sysroot)/usr/lib/libpython<(python_ver).so.1.0)',
+        'python_arch%': '<!(<(DEPTH)/build/linux/python_arch.sh <(sysroot)/usr/local/lib/libpython<(python_ver).so.1)',
         'conditions': [
           ['branding=="Chrome" or linux_chromium_breakpad==1', {
             'linux_breakpad%': 1,
@@@@ -576,7 +576,7 @@@@
               ['exclude', '/(gtk|x11)_[^/]*\\.cc$'],
             ],
           }],
-          ['OS!="linux"', {
+          ['OS!="linux" and OS!="freebsd" and OS!="openbsd"', {
             'sources/': [
               ['exclude', '_linux(_unittest)?\\.cc$'],
               ['exclude', '/linux/'],
diff --git a/build/features_override.gypi b/build/features_override.gypi
index 2e19776..b12261d 100644
--- build/features_override.gypi
+++ build/features_override.gypi
@@@@ -61,7 +61,7 @@@@
     'enable_svg%': '<(enable_svg)',
     'enable_touch_events%': '<(enable_touch_events)',
     'conditions': [
-      ['OS=="win" or OS=="linux" or use_accelerated_compositing==1', {
+      ['OS=="win" or OS=="linux" or OS=="freebsd" or use_accelerated_compositing==1', {
         'feature_defines': [
          'WTF_USE_ACCELERATED_COMPOSITING=1',
          'ENABLE_3D_RENDERING=1',
diff --git a/build/linux/python_arch.sh b/build/linux/python_arch.sh
index f364469..a6c3f43 100755
--- build/linux/python_arch.sh
+++ build/linux/python_arch.sh
@@@@ -1,4 +1,4 @@@@
-#!/bin/bash
+#!/usr/bin/env bash
 # Copyright (c) 2010 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.
@@@@ -10,12 +10,7 @@@@
 #  python_arch.sh /path/to/sysroot/usr/lib/libpython2.4.so.1.0
 #
 
-python=$(readlink -f "$1")
-if [ ! -r "$python" ]; then
-  echo unknown
-  exit 0;
-fi
-file_out=$(file "$python")
+file_out=$(file "$1")
 if [ $? -ne 0 ]; then
   echo unknown
   exit 0;
diff --git a/build/linux/system.gyp b/build/linux/system.gyp
index 876579a..23d1c6c 100644
--- build/linux/system.gyp
+++ build/linux/system.gyp
@@@@ -188,11 +188,14 @@@@
       'target_name': 'gconf',
       'type': 'settings',
       'conditions': [
-        ['_toolset=="target"', {
+        ['use_gconf==1 and _toolset=="target"', {
           'direct_dependent_settings': {
             'cflags': [
               '<!@@(<(pkg-config) --cflags gconf-2.0)',
             ],
+            'defines': [
+              'USE_GCONF',
+            ],
           },
           'link_settings': {
             'ldflags': [
@@@@ -283,7 +283,6 @@@@
             }, {
               'link_settings': {
                 'libraries': [
-                  '-ldl',
                 ],
               },
             }],
diff --git a/chrome/app/chrome_dll_main.cc b/chrome/app/chrome_dll_main.cc
index 9e3feb8..b8013fc 100644
--- chrome/app/chrome_dll_main.cc
+++ chrome/app/chrome_dll_main.cc
@@@@ -71,7 +71,7 @@@@
 #include "app/x11_util.h"
 #endif
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
 #include "chrome/browser/renderer_host/render_sandbox_host_linux.h"
 #include "chrome/browser/zygote_host_linux.h"
 #endif
@@@@ -580,7 +580,7 @@@@ int ChromeMain(int argc, char** argv) {
     browser_pid = base::GetCurrentProcId();
 #elif defined(OS_POSIX)
     // On linux, we're in the zygote here; so we need the parent process' id.
-    browser_pid = base::GetParentProcessId(base::GetCurrentProcId());
+    //browser_pid = base::GetParentProcessId(base::GetCurrentProcId());
 #endif
 
 #if defined(OS_POSIX)
@@@@ -819,7 +819,7 @@@@ int ChromeMain(int argc, char** argv) {
   } else if (process_type == switches::kServiceProcess) {
     rv = ServiceProcessMain(main_params);
   } else if (process_type.empty()) {
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
     const char* sandbox_binary = NULL;
     struct stat st;
 
@@@@ -863,7 +863,7 @@@@ int ChromeMain(int argc, char** argv) {
     SetUpGLibLogHandler();
 
     x11_util::SetX11ErrorHandlers();
-#endif  // defined(OS_LINUX)
+#endif  // defined(OS_NIX)
 
     rv = BrowserMain(main_params);
   } else {
diff --git a/chrome/app/chrome_exe_main_gtk.cc b/chrome/app/chrome_exe_main_gtk.cc
index fb3c332..d651fc3 100644
--- chrome/app/chrome_exe_main_gtk.cc
+++ chrome/app/chrome_exe_main_gtk.cc
@@@@ -4,7 +4,7 @@@@
 
 #include "base/at_exit.h"
 #include "base/process_util.h"
-#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
+#if defined(OS_NIX) && !defined(OS_CHROMEOS)
 #include "chrome/browser/first_run.h"
 #endif
 
@@@@ -20,11 +20,11 @@@@
 extern "C" {
 int ChromeMain(int argc, const char** argv);
 
-#if defined(OS_LINUX) && defined(USE_TCMALLOC)
+#if defined(OS_NIX) && defined(USE_TCMALLOC)
 
 int tc_set_new_mode(int mode);
 
-#endif  // defined(OS_LINUX) && defined(USE_TCMALLOC)
+#endif  // defined(OS_NIX) && defined(USE_TCMALLOC)
 }
 
 int main(int argc, const char** argv) {
@@@@ -37,7 +37,7 @@@@ int main(int argc, const char** argv) {
   // dependency on TCMalloc.  Really, we ought to have our allocator shim code
   // implement this EnableTerminationOnOutOfMemory() function.  Whateverz.  This
   // works for now.
-#if defined(OS_LINUX) && defined(USE_TCMALLOC)
+#if defined(OS_NIX) && defined(USE_TCMALLOC)
   // For tcmalloc, we need to tell it to behave like new.
   tc_set_new_mode(1);
 #endif
diff --git a/chrome/app/chrome_main_uitest.cc b/chrome/app/chrome_main_uitest.cc
index 8d13b89..88a4a99 100644
--- chrome/app/chrome_main_uitest.cc
+++ chrome/app/chrome_main_uitest.cc
@@@@ -18,7 +18,7 @@@@ TEST_F(ChromeMainTest, AppLaunch) {
   if (UITest::in_process_renderer()) {
     EXPECT_EQ(1, UITest::GetBrowserProcessCount());
   } else {
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
     // On Linux we'll have four processes: browser, renderer, zygote and
     // sandbox helper.
     EXPECT_EQ(4, UITest::GetBrowserProcessCount());
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 610d54d..90f4437 100644
--- chrome/app/generated_resources.grd
+++ chrome/app/generated_resources.grd
@@@@ -8758,7 +8758,7 @@@@ Keep your key file in a safe place. You will need it to create new versions of y
       Import bookmarks now...
     </message>
 
-    <if expr="os == 'linux2' or os == 'openbsd4' or os=='freebsd6'">
+    <if expr="os == 'linux2' or os.find('bsd') != -1">
       <!-- Linux proxy configuration fallback help -->
       <message name="IDS_ABOUT_LINUX_PROXY_CONFIG_TITLE" desc="Title of HTML page shown on systems where system proxy configuration is unsupported.">
         Proxy Configuration Help
diff --git a/chrome/browser/app_modal_dialog.cc b/chrome/browser/app_modal_dialog.cc
index e8f306d..c40701a 100644
--- chrome/browser/app_modal_dialog.cc
+++ chrome/browser/app_modal_dialog.cc
@@@@ -11,7 +11,7 @@@@
 
 AppModalDialog::AppModalDialog(TabContents* tab_contents,
                                const std::wstring& title)
-#if defined(OS_WIN) || defined(OS_LINUX)
+#if defined(OS_WIN) || defined(OS_NIX)
     : dialog_(NULL),
 #elif defined(OS_MACOSX)
     :
diff --git a/chrome/browser/app_modal_dialog.h b/chrome/browser/app_modal_dialog.h
index 92ac494..092d428 100644
--- chrome/browser/app_modal_dialog.h
+++ chrome/browser/app_modal_dialog.h
@@@@ -92,7 +92,7 @@@@ class AppModalDialog {
   virtual NativeDialog CreateNativeDialog() = 0;
 
   // A reference to the platform native dialog box.
-#if defined(OS_LINUX) || defined(OS_WIN)
+#if defined(OS_NIX) || defined(OS_WIN)
   NativeDialog dialog_;
 #endif
 
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index 364c599..548d8f2 100644
--- chrome/browser/browser.cc
+++ chrome/browser/browser.cc
@@@@ -254,7 +254,7 @@@@ Browser::~Browser() {
 
   BrowserList::RemoveBrowser(this);
 
-#if defined(OS_WIN) || defined(OS_LINUX)
+#if defined(OS_WIN) || defined(OS_NIX)
   if (!BrowserList::HasBrowserWithProfile(profile_)) {
     // We're the last browser window with this profile. We need to nuke the
     // TabRestoreService, which will start the shutdown of the
@@@@ -757,7 +757,7 @@@@ string16 Browser::GetWindowTitleForCurrentTab() const {
   // On Mac or ChromeOS, we don't want to suffix the page title with
   // the application name.
   return title;
-#elif defined(OS_WIN) || defined(OS_LINUX)
+#elif defined(OS_WIN) || defined(OS_NIX)
   int string_id = IDS_BROWSER_WINDOW_TITLE_FORMAT;
   // Don't append the app name to window titles on app frames and app popups
   if (type_ & TYPE_APP)
@@@@ -1417,9 +1417,9 @@@@ void Browser::ToggleFullscreenMode() {
 
   UserMetrics::RecordAction(UserMetricsAction("ToggleFullscreen"), profile_);
   window_->SetFullscreen(!window_->IsFullscreen());
-  // On Linux, setting fullscreen mode is an async call to the X server, which
+  // On X11, setting fullscreen mode is an async call to the X server, which
   // may or may not support fullscreen mode.
-#if !defined(OS_LINUX)
+#if !defined(USE_X11)
   UpdateCommandsForFullscreenMode(window_->IsFullscreen());
 #endif
 }
@@@@ -1644,7 +1644,7 @@@@ void Browser::OpenFile() {
 
 void Browser::OpenCreateShortcutsDialog() {
   UserMetrics::RecordAction(UserMetricsAction("CreateShortcut"), profile_);
-#if defined(OS_WIN) || defined(OS_LINUX)
+#if defined(OS_WIN) || defined(OS_NIX)
   TabContents* current_tab = GetSelectedTabContents();
   DCHECK(current_tab && web_app::IsValidUrl(current_tab->GetURL())) <<
       "Menu item should be disabled.";
@@@@ -2295,7 +2295,7 @@@@ void Browser::DuplicateContentsAt(int index) {
 }
 
 void Browser::CloseFrameAfterDragSession() {
-#if defined(OS_WIN) || defined(OS_LINUX)
+#if defined(OS_WIN) || defined(OS_NIX)
   // This is scheduled to run after we return to the message loop because
   // otherwise the frame will think the drag session is still active and ignore
   // the request.
diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc
index 9607cad..516a755 100644
--- chrome/browser/browser_about_handler.cc
+++ chrome/browser/browser_about_handler.cc
@@@@ -64,7 +64,7 @@@@
 #include "chrome/browser/zygote_host_linux.h"
 #elif defined(OS_MACOSX)
 #include "chrome/browser/cocoa/about_ipc_dialog.h"
-#elif defined(OS_LINUX)
+#elif defined(OS_NIX)
 #include "chrome/browser/zygote_host_linux.h"
 #endif
 
@@@@ -106,7 +106,7 @@@@ const char kAboutPath[] = "about";
 const char kNetInternalsPath[] = "net-internals";
 const char kPluginsPath[] = "plugins";
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
 const char kLinuxProxyConfigPath[] = "linux-proxy-config";
 const char kSandboxPath[] = "sandbox";
 #endif
@@@@ -134,7 +134,7 @@@@ const char *kAllAboutPaths[] = {
   kTcmallocPath,
   kTermsPath,
   kVersionPath,
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
   kLinuxProxyConfigPath,
   kSandboxPath,
 #endif
@@@@ -521,7 +521,7 @@@@ std::string AboutStats() {
   return data;
 }
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
 std::string AboutLinuxProxyConfig() {
   std::string data;
   data.append("<!DOCTYPE HTML>\n");
@@@@ -898,7 +898,7 @@@@ void AboutSource::StartDataRequest(const std::string& path_raw,
   } else if (path == kTermsPath) {
     response = ResourceBundle::GetSharedInstance().GetRawDataResource(
         IDR_TERMS_HTML).as_string();
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
   } else if (path == kLinuxProxyConfigPath) {
     response = AboutLinuxProxyConfig();
   } else if (path == kSandboxPath) {
diff --git a/chrome/browser/browser_child_process_host.cc b/chrome/browser/browser_child_process_host.cc
index d700475..fe219d8 100644
--- chrome/browser/browser_child_process_host.cc
+++ chrome/browser/browser_child_process_host.cc
@@@@ -25,9 +25,9 @@@@
 #include "chrome/common/result_codes.h"
 #include "chrome/installer/util/google_update_settings.h"
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
 #include "base/linux_util.h"
-#endif  // OS_LINUX
+#endif  // OS_NIX
 
 #if defined(OS_POSIX)
 // This is defined in chrome/browser/google_update_settings_posix.cc.  It's the
diff --git a/chrome/browser/browser_theme_provider.h b/chrome/browser/browser_theme_provider.h
index 0cb4b15..8c2b0c7 100644
--- chrome/browser/browser_theme_provider.h
+++ chrome/browser/browser_theme_provider.h
@@@@ -129,7 +129,7 @@@@ class BrowserThemeProvider : public NonThreadSafe,
   virtual bool ShouldUseNativeFrame() const;
   virtual bool HasCustomImage(int id) const;
   virtual RefCountedMemory* GetRawData(int id) const;
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_GTK)
   // GdkPixbufs returned by GetPixbufNamed and GetRTLEnabledPixbufNamed are
   // shared instances owned by the theme provider and should not be freed.
   virtual GdkPixbuf* GetPixbufNamed(int id) const;
@@@@ -241,12 +241,12 @@@@ class BrowserThemeProvider : public NonThreadSafe,
   // Remove preference values for themes that are no longer in use.
   void RemoveUnusedThemes();
 
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_GTK)
   // Loads an image and flips it horizontally if |rtl_enabled| is true.
   GdkPixbuf* GetPixbufImpl(int id, bool rtl_enabled) const;
 #endif
 
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_GTK)
   typedef std::map<int, GdkPixbuf*> GdkPixbufMap;
   mutable GdkPixbufMap gdk_pixbufs_;
 #elif defined(OS_MACOSX)
diff --git a/chrome/browser/child_process_launcher.cc b/chrome/browser/child_process_launcher.cc
index 60215d5..57fd9d2 100644
--- chrome/browser/child_process_launcher.cc
+++ chrome/browser/child_process_launcher.cc
@@@@ -18,7 +18,7 @@@@
 
 #if defined(OS_WIN)
 #include "chrome/common/sandbox_policy.h"
-#elif defined(OS_LINUX)
+#elif defined(OS_NIX)
 #include "base/singleton.h"
 #include "chrome/browser/crash_handler_host_linux.h"
 #include "chrome/browser/zygote_host_linux.h"
@@@@ -41,7 +41,7 @@@@ class ChildProcessLauncher::Context
  public:
   Context()
       : starting_(true)
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
         , zygote_(false)
 #endif
         {
@@@@ -106,7 +106,7 @@@@ class ChildProcessLauncher::Context
     handle = sandbox::StartProcessWithAccess(cmd_line, exposed_dir);
 #elif defined(OS_POSIX)
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
     if (use_zygote) {
       base::GlobalDescriptors::Mapping mapping;
       mapping.push_back(std::pair<uint32_t, int>(kPrimaryIPCChannel, ipcfd));
@@@@ -126,7 +126,7 @@@@ class ChildProcessLauncher::Context
           ipcfd,
           kPrimaryIPCChannel + base::GlobalDescriptors::kBaseDescriptor));
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
       // On Linux, we need to add some extra file descriptors for crash handling
       // and the sandbox.
       bool is_renderer =
@@@@ -158,7 +158,7 @@@@ class ChildProcessLauncher::Context
             sandbox_fd,
             kSandboxIPCChannel + base::GlobalDescriptors::kBaseDescriptor));
       }
-#endif  // defined(OS_LINUX)
+#endif  // defined(OS_NIX)
 
       // Actually launch the app.
       bool launched;
@@@@ -185,20 +185,20 @@@@ class ChildProcessLauncher::Context
         NewRunnableMethod(
             this,
             &ChildProcessLauncher::Context::Notify,
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
             use_zygote,
 #endif
             handle));
   }
 
   void Notify(
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
       bool zygote,
 #endif
       base::ProcessHandle handle) {
     starting_ = false;
     process_.set_handle(handle);
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
     zygote_ = zygote;
 #endif
     if (client_) {
@@@@ -218,7 +218,7 @@@@ class ChildProcessLauncher::Context
         ChromeThread::PROCESS_LAUNCHER, FROM_HERE,
         NewRunnableFunction(
             &ChildProcessLauncher::Context::TerminateInternal,
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
             zygote_,
 #endif
             process_.handle()));
@@@@ -226,7 +226,7 @@@@ class ChildProcessLauncher::Context
   }
 
   static void TerminateInternal(
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
       bool zygote,
 #endif
       base::ProcessHandle handle) {
@@@@ -236,13 +236,13 @@@@ class ChildProcessLauncher::Context
     process.Terminate(ResultCodes::NORMAL_EXIT);
     // On POSIX, we must additionally reap the child.
 #if defined(OS_POSIX)
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
     if (zygote) {
       // If the renderer was created via a zygote, we have to proxy the reaping
       // through the zygote process.
       Singleton<ZygoteHost>()->EnsureProcessTerminated(handle);
     } else
-#endif  // OS_LINUX
+#endif  // OS_NIX
     {
       ProcessWatcher::EnsureProcessTerminated(handle);
     }
@@@@ -255,7 +255,7 @@@@ class ChildProcessLauncher::Context
   base::Process process_;
   bool starting_;
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
   bool zygote_;
 #endif
 };
@@@@ -300,7 +300,7 @@@@ base::ProcessHandle ChildProcessLauncher::GetHandle() {
 bool ChildProcessLauncher::DidProcessCrash() {
   bool did_crash, child_exited;
   base::ProcessHandle handle = context_->process_.handle();
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
   if (context_->zygote_) {
     did_crash = Singleton<ZygoteHost>()->DidProcessCrash(handle, &child_exited);
   } else
diff --git a/chrome/browser/cookie_modal_dialog.h b/chrome/browser/cookie_modal_dialog.h
index 5308186..d9576bd 100644
--- chrome/browser/cookie_modal_dialog.h
+++ chrome/browser/cookie_modal_dialog.h
@@@@ -13,7 +13,7 @@@@
 #include "chrome/browser/cookie_prompt_modal_dialog_delegate.h"
 #include "googleurl/src/gurl.h"
 
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_USES_GTK)
 #include "app/gtk_signal.h"
 #endif
 
@@@@ -28,7 +28,7 @@@@ class NSWindow;
 class HostContentSettingsMap;
 class PrefService;
 
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_USES_GTK)
 typedef struct _GtkWidget GtkWidget;
 typedef struct _GParamSpec GParamSpec;
 #endif
@@@@ -73,7 +73,7 @@@@ class CookiePromptModalDialog : public AppModalDialog {
   static void RegisterUserPrefs(PrefService* prefs);
 
   // AppModalDialog overrides.
-#if defined(OS_LINUX) || defined(OS_MACOSX)
+#if defined(OS_POSIX)
   virtual void CreateAndShowDialog();
 #endif
   virtual int GetDialogButtons();
@@@@ -103,7 +103,7 @@@@ class CookiePromptModalDialog : public AppModalDialog {
  protected:
   // AppModalDialog overrides.
   virtual NativeDialog CreateNativeDialog();
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_GTK)
   virtual void HandleDialogResponse(GtkDialog* dialog, gint response_id);
   CHROMEGTK_CALLBACK_1(CookiePromptModalDialog,
                        void,
@@@@ -140,7 +140,7 @@@@ class CookiePromptModalDialog : public AppModalDialog {
   // delegate could be deleted
   CookiePromptModalDialogDelegate* delegate_;
 
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_GTK)
   // The "remember this choice" radio button in the dialog.
   GtkWidget* remember_radio_;
 
diff --git a/chrome/browser/download/download_util.cc b/chrome/browser/download/download_util.cc
index a3e064f..400ae31 100644
--- chrome/browser/download/download_util.cc
+++ chrome/browser/download/download_util.cc
@@@@ -43,14 +43,14 @@@@
 #include "views/drag_utils.h"
 #endif
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
 #if defined(TOOLKIT_VIEWS)
 #include "app/drag_drop_types.h"
 #include "views/widget/widget_gtk.h"
 #elif defined(TOOLKIT_GTK)
 #include "chrome/browser/gtk/custom_drag.h"
 #endif  // defined(TOOLKIT_GTK)
-#endif  // defined(OS_LINUX)
+#endif  // defined(OS_NIX)
 
 #if defined(OS_WIN)
 #include "app/os_exchange_data_provider_win.h"
@@@@ -329,7 +329,7 @@@@ void DragDownload(const DownloadItem* download,
   DWORD effects;
   DoDragDrop(OSExchangeDataProviderWin::GetIDataObject(data), drag_source.get(),
              DROPEFFECT_COPY | DROPEFFECT_LINK, &effects);
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_GTK)
   GtkWidget* root = gtk_widget_get_toplevel(view);
   if (!root)
     return;
@@@@ -340,13 +340,13 @@@@ void DragDownload(const DownloadItem* download,
   widget->DoDrag(data, DragDropTypes::DRAG_COPY | DragDropTypes::DRAG_LINK);
 #endif  // OS_WIN
 }
-#elif defined(OS_LINUX)
+#elif defined(USE_X11)
 void DragDownload(const DownloadItem* download,
                   SkBitmap* icon,
                   gfx::NativeView view) {
   DownloadItemDrag::BeginDrag(download, icon);
 }
-#endif  // OS_LINUX
+#endif // USE_X11
 
 DictionaryValue* CreateDownloadItemValue(DownloadItem* download, int id) {
   DictionaryValue* file_value = new DictionaryValue();
diff --git a/chrome/browser/extensions/extension_process_manager.cc b/chrome/browser/extensions/extension_process_manager.cc
index cd040f8..ed24185 100644
--- chrome/browser/extensions/extension_process_manager.cc
+++ chrome/browser/extensions/extension_process_manager.cc
@@@@ -51,10 +51,10 @@@@ ExtensionProcessManager::ExtensionProcessManager(Profile* profile)
                  NotificationService::AllSources());
   registrar_.Add(this, NotificationType::RENDERER_PROCESS_CLOSED,
                  NotificationService::AllSources());
-#if defined(OS_WIN) || defined(OS_LINUX)
+#if !defined(OS_MACOSX)
   registrar_.Add(this, NotificationType::BROWSER_CLOSED,
                  NotificationService::AllSources());
-#elif defined(OS_MACOSX)
+#else
   registrar_.Add(this, NotificationType::APP_TERMINATING,
                  NotificationService::AllSources());
 #endif
@@@@ -285,7 +285,7 @@@@ void ExtensionProcessManager::Observe(NotificationType type,
       UnregisterExtensionProcess(host->id());
       break;
     }
-#if defined(OS_WIN) || defined(OS_LINUX)
+#if !defined(OS_MACOSX)
     case NotificationType::BROWSER_CLOSED: {
       // Close background hosts when the last browser is closed so that they
       // have time to shutdown various objects on different threads. Our
@@@@ -295,7 +295,7 @@@@ void ExtensionProcessManager::Observe(NotificationType type,
         CloseBackgroundHosts();
       break;
     }
-#elif defined(OS_MACOSX)
+#else
     case NotificationType::APP_TERMINATING: {
       CloseBackgroundHosts();
       break;
diff --git a/chrome/browser/first_run.h b/chrome/browser/first_run.h
index 6615d93..e582628 100644
--- chrome/browser/first_run.h
+++ chrome/browser/first_run.h
@@@@ -139,7 +139,7 @@@@ class FirstRun {
   // Import browser items in this process. The browser and the items to
   // import are encoded int the command line.
   static int ImportFromBrowser(Profile* profile, const CommandLine& cmdline);
-#elif defined(OS_LINUX)
+#elif defined(OS_NIX)
   static bool ImportBookmarks(const std::wstring& import_bookmarks_path);
 #endif
 
diff --git a/chrome/browser/geolocation/empty_device_data_provider.cc b/chrome/browser/geolocation/empty_device_data_provider.cc
index 9e9fc27..371c281 100644
--- chrome/browser/geolocation/empty_device_data_provider.cc
+++ chrome/browser/geolocation/empty_device_data_provider.cc
@@@@ -12,7 +12,7 @@@@ RadioDataProviderImplBase* RadioDataProvider::DefaultFactoryFunction() {
 }
 
 // Only define for platforms that lack a real wifi data provider.
-#if !defined(OS_WIN) && !defined(OS_MACOSX) && !defined(OS_LINUX)
+#if !defined(OS_WIN) && !defined(OS_MACOSX) && !defined(OS_NIX)
 // static
 template<>
 WifiDataProviderImplBase* WifiDataProvider::DefaultFactoryFunction() {
diff --git a/chrome/browser/gpu_process_host.cc b/chrome/browser/gpu_process_host.cc
index 883f9be..0506ff5 100644
--- chrome/browser/gpu_process_host.cc
+++ chrome/browser/gpu_process_host.cc
@@@@ -15,7 +15,7 @@@@
 #include "chrome/common/render_messages.h"
 #include "ipc/ipc_switches.h"
 
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_USES_GTK)
 #include "gfx/gtk_native_view_id_manager.h"
 #endif
 
@@@@ -168,7 +168,7 @@@@ void GpuProcessHost::OnControlMessageReceived(const IPC::Message& message) {
   IPC_BEGIN_MESSAGE_MAP(GpuProcessHost, message)
     IPC_MESSAGE_HANDLER(GpuHostMsg_ChannelEstablished, OnChannelEstablished)
     IPC_MESSAGE_HANDLER(GpuHostMsg_SynchronizeReply, OnSynchronizeReply)
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_USES_GTK)
     IPC_MESSAGE_HANDLER(GpuHostMsg_GetViewXID, OnGetViewXID)
 #endif
     IPC_MESSAGE_UNHANDLED_ERROR()
@@@@ -191,7 +191,7 @@@@ void GpuProcessHost::OnSynchronizeReply() {
   queued_synchronization_replies_.pop();
 }
 
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_USES_GTK)
 void GpuProcessHost::OnGetViewXID(gfx::NativeViewId id, unsigned long* xid) {
   GtkNativeViewManager* manager = Singleton<GtkNativeViewManager>::get();
   if (!manager->GetXIDForId(xid, id)) {
diff --git a/chrome/browser/gpu_process_host.h b/chrome/browser/gpu_process_host.h
index a331f69..3d105d0 100644
--- chrome/browser/gpu_process_host.h
+++ chrome/browser/gpu_process_host.h
@@@@ -84,7 +84,7 @@@@ class GpuProcessHost : public BrowserChildProcessHost {
   void OnChannelEstablished(const IPC::ChannelHandle& channel_handle,
                             const GPUInfo& gpu_info);
   void OnSynchronizeReply();
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_USES_GTK)
   void OnGetViewXID(gfx::NativeViewId id, unsigned long* xid);
 #endif
 
diff --git a/chrome/browser/gtk/browser_titlebar.cc b/chrome/browser/gtk/browser_titlebar.cc
index dea24e6..77adb09 100644
--- chrome/browser/gtk/browser_titlebar.cc
+++ chrome/browser/gtk/browser_titlebar.cc
@@@@ -23,7 +23,9 @@@@
 #include "chrome/browser/gtk/accelerators_gtk.h"
 #include "chrome/browser/gtk/browser_window_gtk.h"
 #include "chrome/browser/gtk/custom_button.h"
+#if defined(USE_GCONF)
 #include "chrome/browser/gtk/gconf_titlebar_listener.h"
+#endif
 #include "chrome/browser/gtk/gtk_theme_provider.h"
 #include "chrome/browser/gtk/gtk_util.h"
 #include "chrome/browser/gtk/menu_gtk.h"
@@@@ -193,6 +195,9 @@@@ void PopupPageMenuModel::Build() {
 ////////////////////////////////////////////////////////////////////////////////
 // BrowserTitlebar
 
+// static
+const char BrowserTitlebar::kDefaultButtonString[] = ":minimize,maximize,close";
+
 BrowserTitlebar::BrowserTitlebar(BrowserWindowGtk* browser_window,
                                  GtkWindow* window)
     : browser_window_(browser_window),
@@@@ -299,9 +304,13 @@@@ void BrowserTitlebar::Init() {
   gtk_box_pack_end(GTK_BOX(container_hbox_), titlebar_right_buttons_vbox_,
                    FALSE, FALSE, 0);
 
+#if defined(USE_GCONF)
   // Either read the gconf database and register for updates (on GNOME), or use
   // the default value (anywhere else).
   Singleton<GConfTitlebarListener>()->SetTitlebarButtons(this);
+#else
+  BuildButtons(kDefaultButtonString);
+#endif
 
   // We use an alignment to control the titlebar height.
   titlebar_alignment_ = gtk_alignment_new(0.0, 0.0, 1.0, 1.0);
@@@@ -363,7 +372,9 @@@@ void BrowserTitlebar::Init() {
 
 BrowserTitlebar::~BrowserTitlebar() {
   ActiveWindowWatcherX::RemoveObserver(this);
+#if defined(USE_GCONF)
   Singleton<GConfTitlebarListener>()->RemoveObserver(this);
+#endif
 }
 
 void BrowserTitlebar::BuildButtons(const std::string& button_string) {
diff --git a/chrome/browser/gtk/browser_titlebar.h b/chrome/browser/gtk/browser_titlebar.h
index c6da855..5cd30e6 100644
--- chrome/browser/gtk/browser_titlebar.h
+++ chrome/browser/gtk/browser_titlebar.h
@@@@ -31,6 +31,10 @@@@ class BrowserTitlebar : public NotificationObserver,
                         public ActiveWindowWatcherX::Observer,
                         public menus::SimpleMenuModel::Delegate {
  public:
+  // A default button order string for when we aren't asking gconf for the
+  // metacity configuration.
+  static const char kDefaultButtonString[];
+
   BrowserTitlebar(BrowserWindowGtk* browser_window, GtkWindow* window);
   virtual ~BrowserTitlebar();
 
diff --git a/chrome/browser/gtk/gconf_titlebar_listener.cc b/chrome/browser/gtk/gconf_titlebar_listener.cc
index 81b5ef0..237332f 100644
--- chrome/browser/gtk/gconf_titlebar_listener.cc
+++ chrome/browser/gtk/gconf_titlebar_listener.cc
@@@@ -13,10 +13,6 @@@@
 
 namespace {
 
-// A default button order string for when we aren't asking gconf for the
-// metacity configuration.
-const char* kDefaultButtonPlacement = ":minimize,maximize,close";
-
 // The GConf key we read for the button placement string. Even through the key
 // has "metacity" in it, it's shared between metacity and compiz.
 const char* kButtonLayoutKey = "/apps/metacity/general/button_layout";
@@@@ -34,7 +30,7 @@@@ void GConfTitlebarListener::SetTitlebarButtons(BrowserTitlebar* titlebar) {
     titlebar->BuildButtons(current_value_);
     titlebars_.insert(titlebar);
   } else {
-    titlebar->BuildButtons(kDefaultButtonPlacement);
+    titlebar->BuildButtons(BrowserTitlebar::kDefaultButtonString);
   }
 }
 
@@@@ -113,8 +109,8 @@@@ bool GConfTitlebarListener::HandleGError(GError* error, const char* key) {
 void GConfTitlebarListener::ParseAndStoreValue(GConfValue* gconf_value) {
   if (gconf_value) {
     const char* value = gconf_value_get_string(gconf_value);
-    current_value_ = value ? value : kDefaultButtonPlacement;
+    current_value_ = value ? value : BrowserTitlebar::kDefaultButtonString;
   } else {
-    current_value_ = kDefaultButtonPlacement;
+    current_value_ = BrowserTitlebar::kDefaultButtonString;
   }
 }
diff --git a/chrome/browser/memory_details.cc b/chrome/browser/memory_details.cc
index 5c38d97..29a73d7 100644
--- chrome/browser/memory_details.cc
+++ chrome/browser/memory_details.cc
@@@@ -19,7 +19,7 @@@@
 #include "chrome/common/url_constants.h"
 #include "grit/chromium_strings.h"
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
 #include "chrome/browser/zygote_host_linux.h"
 #include "chrome/browser/renderer_host/render_sandbox_host_linux.h"
 #endif
@@@@ -74,7 +74,7 @@@@ void MemoryDetails::CollectChildInfoOnIOThread() {
 void MemoryDetails::CollectChildInfoOnUIThread() {
   DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
   const pid_t zygote_pid = Singleton<ZygoteHost>()->pid();
   const pid_t sandbox_helper_pid = Singleton<RenderSandboxHostLinux>()->pid();
 #endif
@@@@ -153,7 +153,7 @@@@ void MemoryDetails::CollectChildInfoOnUIThread() {
       }
     }
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
     if (process.pid == zygote_pid) {
       process.type = ChildProcessInfo::ZYGOTE_PROCESS;
     } else if (process.pid == sandbox_helper_pid) {
diff --git a/chrome/browser/memory_purger.cc b/chrome/browser/memory_purger.cc
index 9117811..09b8c71 100644
--- chrome/browser/memory_purger.cc
+++ chrome/browser/memory_purger.cc
@@@@ -137,7 +137,7 @@@@ void MemoryPurger::PurgeBrowser() {
   // * Purge AppCache memory.  Not yet implemented sufficiently.
   // * Browser-side DatabaseTracker.  Not implemented sufficiently.
 
-#if (defined(OS_WIN) || defined(OS_LINUX)) && defined(USE_TCMALLOC)
+#if !defined(OS_MACOSX) && defined(USE_TCMALLOC)
   // Tell tcmalloc to release any free pages it's still holding.
   //
   // TODO(pkasting): A lot of the above calls kick off actions on other threads.
diff --git a/chrome/browser/net/connection_tester.cc b/chrome/browser/net/connection_tester.cc
index 162be2c..e96b18f 100644
--- chrome/browser/net/connection_tester.cc
+++ chrome/browser/net/connection_tester.cc
@@@@ -161,7 +161,7 @@@@ class ExperimentURLRequestContext : public URLRequestContext {
   // Otherwise returns a network error code.
   int CreateSystemProxyConfigService(
       scoped_ptr<net::ProxyConfigService>* config_service) {
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
     // TODO(eroman): This is not supported on Linux yet, because of how
     // construction needs ot happen on the UI thread.
     return net::ERR_NOT_IMPLEMENTED;
diff --git a/chrome/browser/notifications/balloon_collection_impl.h b/chrome/browser/notifications/balloon_collection_impl.h
index cb06230..cc907f1 100644
--- chrome/browser/notifications/balloon_collection_impl.h
+++ chrome/browser/notifications/balloon_collection_impl.h
@@@@ -54,7 +54,7 @@@@ class BalloonCollectionImpl : public BalloonCollection
   virtual void WillProcessMessage(const MSG& event) {}
   virtual void DidProcessMessage(const MSG& event);
 #endif
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_USES_GTK)
   virtual void WillProcessEvent(GdkEvent* event) {}
   virtual void DidProcessEvent(GdkEvent* event);
 #endif
diff --git a/chrome/browser/options_util.cc b/chrome/browser/options_util.cc
index 8bcf063..7d710d4 100644
--- chrome/browser/options_util.cc
+++ chrome/browser/options_util.cc
@@@@ -28,7 +28,7 @@@@ void OptionsUtil::ResetToDefaults(Profile* profile) {
     prefs::kCookieBehavior,
     prefs::kDefaultCharset,
     prefs::kDnsPrefetchingEnabled,
-#if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_OPENBSD)
+#if defined(OS_NIX)
     prefs::kCertRevocationCheckingEnabled,
     prefs::kSSL2Enabled,
     prefs::kSSL3Enabled,
diff --git a/chrome/browser/process_singleton_linux.cc b/chrome/browser/process_singleton_linux.cc
index bfd6539..5ea70a3 100644
--- chrome/browser/process_singleton_linux.cc
+++ chrome/browser/process_singleton_linux.cc
@@@@ -281,23 +281,24 @@@@ void DisplayProfileInUseError(const std::string& lock_path,
 }
 
 bool IsChromeProcess(pid_t pid) {
-  FilePath other_chrome_path(base::GetProcessExecutablePath(pid));
+/*  FilePath other_chrome_path(base::GetProcessExecutablePath(pid));
   return (!other_chrome_path.empty() &&
           other_chrome_path.BaseName() ==
-          FilePath::FromWStringHack(chrome::kBrowserProcessExecutableName));
+          FilePath::FromWStringHack(chrome::kBrowserProcessExecutableName));*/
+  return true;
 }
 
 // Return true if the given pid is one of our child processes.
 // Assumes that the current pid is the root of all pids of the current instance.
 bool IsSameChromeInstance(pid_t pid) {
   pid_t cur_pid = base::GetCurrentProcId();
-  while (pid != cur_pid) {
+/*  while (pid != cur_pid) {
     pid = base::GetParentProcessId(pid);
     if (pid < 0)
       return false;
     if (!IsChromeProcess(pid))
       return false;
-  }
+  }*/
   return true;
 }
 
diff --git a/chrome/browser/renderer_host/backing_store_proxy.cc b/chrome/browser/renderer_host/backing_store_proxy.cc
index ba3538b..4388eb0 100644
--- chrome/browser/renderer_host/backing_store_proxy.cc
+++ chrome/browser/renderer_host/backing_store_proxy.cc
@@@@ -46,8 +46,12 @@@@ void BackingStoreProxy::PaintToBackingStore(
   process_id = process->GetHandle();
 #endif
 
+#if defined(OS_FREEBSD)
+  int render_process_id = process->id();
+#endif
+
   if (process_shim_->Send(new GpuMsg_PaintToBackingStore(
-          routing_id_, process_id, bitmap, bitmap_rect, copy_rects))) {
+          routing_id_, render_process_id, bitmap, bitmap_rect, copy_rects))) {
     // Message sent successfully, so the caller can not destroy the
     // TransportDIB. OnDonePaintingToBackingStore will free it later.
     *painted_synchronously = false;
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc
index d6509e8..2211ef4 100644
--- chrome/browser/renderer_host/browser_render_process_host.cc
+++ chrome/browser/renderer_host/browser_render_process_host.cc
@@@@ -313,11 +313,11 @@@@ bool BrowserRenderProcessHost::Init(bool is_extensions_process,
     in_process_renderer_.reset(new RendererMainThread(channel_id));
 
     base::Thread::Options options;
-#if !defined(OS_LINUX)
+#if !defined(USE_X11)
     // In-process plugins require this to be a UI message loop.
     options.message_loop_type = MessageLoop::TYPE_UI;
 #else
-    // We can't have multiple UI loops on Linux, so we don't support
+    // We can't have multiple UI loops on X, so we don't support
     // in-process plugins.
     options.message_loop_type = MessageLoop::TYPE_DEFAULT;
 #endif
@@@@ -736,13 +736,13 @@@@ TransportDIB* BrowserRenderProcessHost::MapTransportDIB(
   HANDLE section = win_util::GetSectionFromProcess(
       dib_id.handle, GetHandle(), false /* read write */);
   return TransportDIB::Map(section);
-#elif defined(OS_MACOSX)
+#elif defined(OS_MACOSX) || defined(OS_FREEBSD)
   // On OSX, the browser allocates all DIBs and keeps a file descriptor around
   // for each.
   return widget_helper_->MapTransportDIB(dib_id);
 #elif defined(OS_LINUX)
   return TransportDIB::Map(dib_id);
-#endif  // defined(OS_LINUX)
+#endif  // defined(OS_NIX)
 }
 
 TransportDIB* BrowserRenderProcessHost::GetTransportDIB(
diff --git a/chrome/browser/renderer_host/mock_render_process_host.cc b/chrome/browser/renderer_host/mock_render_process_host.cc
index 21fa34d..22e53ed 100644
--- chrome/browser/renderer_host/mock_render_process_host.cc
+++ chrome/browser/renderer_host/mock_render_process_host.cc
@@@@ -99,7 +99,7 @@@@ TransportDIB* MockRenderProcessHost::GetTransportDIB(TransportDIB::Id dib_id) {
   DuplicateHandle(GetCurrentProcess(), dib_id.handle, GetCurrentProcess(),
                   &duped, 0, TRUE, DUPLICATE_SAME_ACCESS);
   transport_dib_ = TransportDIB::Map(duped);
-#elif defined(OS_MACOSX)
+#elif defined(OS_MACOSX) || defined(OS_FREEBSD)
   // On Mac, TransportDIBs are always created in the browser, so we cannot map
   // one from a dib_id.
   transport_dib_ = TransportDIB::Create(100 * 100 * 4, 0);
diff --git a/chrome/browser/renderer_host/render_sandbox_host_linux.cc b/chrome/browser/renderer_host/render_sandbox_host_linux.cc
index 5824fc9..59c6fa5 100644
--- chrome/browser/renderer_host/render_sandbox_host_linux.cc
+++ chrome/browser/renderer_host/render_sandbox_host_linux.cc
@@@@ -644,7 +644,12 @@@@ void RenderSandboxHostLinux::Init(const std::string& sandbox_path) {
   // inherit some sockets. With PF_UNIX+SOCK_DGRAM, it can call sendmsg to send
   // a datagram to any (abstract) socket on the same system. With
   // SOCK_SEQPACKET, this is prevented.
+#if defined(OS_FREEBSD)
+  if (socketpair(AF_UNIX, SOCK_SEQPACKET, 0, fds) != 0)
+    CHECK(socketpair(AF_UNIX, SOCK_DGRAM, 0, fds) == 0);
+#else
   CHECK(socketpair(AF_UNIX, SOCK_SEQPACKET, 0, fds) == 0);
+#endif
 
   renderer_socket_ = fds[0];
   const int browser_socket = fds[1];
diff --git a/chrome/browser/renderer_host/render_view_host_delegate.cc b/chrome/browser/renderer_host/render_view_host_delegate.cc
index 11f6168..78122cc 100644
--- chrome/browser/renderer_host/render_view_host_delegate.cc
+++ chrome/browser/renderer_host/render_view_host_delegate.cc
@@@@ -11,7 +11,7 @@@@
 #include "googleurl/src/gurl.h"
 #include "webkit/glue/webpreferences.h"
 
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_GTK)
 #include "chrome/browser/gtk/gtk_util.h"
 #endif
 
diff --git a/chrome/browser/renderer_host/render_widget_helper.cc b/chrome/browser/renderer_host/render_widget_helper.cc
index e2cd531..9e603f7 100644
--- chrome/browser/renderer_host/render_widget_helper.cc
+++ chrome/browser/renderer_host/render_widget_helper.cc
@@@@ -58,7 +58,7 @@@@ RenderWidgetHelper::~RenderWidgetHelper() {
   // object, so we should not be destroyed unless pending_paints_ is empty!
   DCHECK(pending_paints_.empty());
 
-#if defined(OS_MACOSX)
+#if defined(OS_MACOSX) || defined(OS_FREEBSD)
   ClearAllocatedDIBs();
 #endif
 }
@@@@ -257,7 +257,7 @@@@ void RenderWidgetHelper::OnCreateWidgetOnUI(
     host->CreateNewWidget(route_id, popup_type);
 }
 
-#if defined(OS_MACOSX)
+#if defined(OS_MACOSX) || defined(OS_FREEBSD)
 TransportDIB* RenderWidgetHelper::MapTransportDIB(TransportDIB::Id dib_id) {
   AutoLock locked(allocated_dibs_lock_);
 
diff --git a/chrome/browser/renderer_host/render_widget_helper.h b/chrome/browser/renderer_host/render_widget_helper.h
index d31bf66..ab08823 100644
--- chrome/browser/renderer_host/render_widget_helper.h
+++ chrome/browser/renderer_host/render_widget_helper.h
@@@@ -109,7 +109,7 @@@@ class RenderWidgetHelper
                         const base::TimeDelta& max_delay,
                         IPC::Message* msg);
 
-#if defined(OS_MACOSX)
+#if defined(OS_MACOSX) || defined(OS_FREEBSD)
   // Given the id of a transport DIB, return a mapping to it or NULL on error.
   TransportDIB* MapTransportDIB(TransportDIB::Id dib_id);
 #endif
@@@@ -130,7 +130,7 @@@@ class RenderWidgetHelper
                        WebKit::WebPopupType popup_type,
                        int* route_id);
 
-#if defined(OS_MACOSX)
+#if defined(OS_MACOSX) || defined(OS_FREEBSD)
   // Called on the IO thread to handle the allocation of a TransportDIB.  If
   // |cache_in_browser| is |true|, then a copy of the shmem is kept by the
   // browser, and it is the caller's repsonsibility to call
@@@@ -182,7 +182,7 @@@@ class RenderWidgetHelper
   // Called on the IO thread to resume a cross-site response.
   void OnCrossSiteClosePageACK(ViewMsg_ClosePage_Params params);
 
-#if defined(OS_MACOSX)
+#if defined(OS_MACOSX) || defined(OS_FREEBSD)
   // Called on destruction to release all allocated transport DIBs
   void ClearAllocatedDIBs();
 
diff --git a/chrome/browser/renderer_host/render_widget_host.cc b/chrome/browser/renderer_host/render_widget_host.cc
index 1920101..00afa22 100644
--- chrome/browser/renderer_host/render_widget_host.cc
+++ chrome/browser/renderer_host/render_widget_host.cc
@@@@ -154,7 +154,7 @@@@ void RenderWidgetHost::OnMessageReceived(const IPC::Message &msg) {
                         OnMsgImeCancelComposition)
     IPC_MESSAGE_HANDLER(ViewHostMsg_GpuRenderingActivated,
                         OnMsgGpuRenderingActivated)
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
     IPC_MESSAGE_HANDLER(ViewHostMsg_CreatePluginContainer,
                         OnMsgCreatePluginContainer)
     IPC_MESSAGE_HANDLER(ViewHostMsg_DestroyPluginContainer,
@@@@ -909,7 +909,7 @@@@ void RenderWidgetHost::OnMsgGpuRenderingActivated(bool activated) {
   is_gpu_rendering_active_ = activated;
 }
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
 
 void RenderWidgetHost::OnMsgCreatePluginContainer(gfx::PluginWindowHandle id) {
   // TODO(piman): view_ can only be NULL with delayed view creation in
diff --git a/chrome/browser/renderer_host/render_widget_host.h b/chrome/browser/renderer_host/render_widget_host.h
index 0b0e114..3430042 100644
--- chrome/browser/renderer_host/render_widget_host.h
+++ chrome/browser/renderer_host/render_widget_host.h
@@@@ -490,7 +490,7 @@@@ class RenderWidgetHost : public IPC::Channel::Listener,
 
   void OnMsgGpuRenderingActivated(bool activated);
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
   void OnMsgCreatePluginContainer(gfx::PluginWindowHandle id);
   void OnMsgDestroyPluginContainer(gfx::PluginWindowHandle id);
 #elif defined(OS_MACOSX)
diff --git a/chrome/browser/renderer_host/render_widget_host_unittest.cc b/chrome/browser/renderer_host/render_widget_host_unittest.cc
index 4ea8193..a8298a6 100644
--- chrome/browser/renderer_host/render_widget_host_unittest.cc
+++ chrome/browser/renderer_host/render_widget_host_unittest.cc
@@@@ -400,7 +400,7 @@@@ TEST_F(RenderWidgetHostTest, ResizeThenCrash) {
 
 // Tests setting custom background
 TEST_F(RenderWidgetHostTest, Background) {
-#if defined(OS_WIN) || defined(OS_LINUX)
+#if defined(OS_WIN) || defined(OS_NIX)
   scoped_ptr<RenderWidgetHostView> view(
       RenderWidgetHostView::CreateViewForWidget(host_.get()));
   host_->set_view(view.get());
diff --git a/chrome/browser/renderer_host/render_widget_host_view.h b/chrome/browser/renderer_host/render_widget_host_view.h
index 9a20af0..4b695b4 100644
--- chrome/browser/renderer_host/render_widget_host_view.h
+++ chrome/browser/renderer_host/render_widget_host_view.h
@@@@ -215,7 +215,7 @@@@ class RenderWidgetHostView {
   virtual void DrawAcceleratedSurfaceInstances(CGLContextObj context) = 0;
 #endif
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
   virtual void CreatePluginContainer(gfx::PluginWindowHandle id) = 0;
   virtual void DestroyPluginContainer(gfx::PluginWindowHandle id) = 0;
 #endif
diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc
index 0418487..3cad76b 100644
--- chrome/browser/renderer_host/resource_message_filter.cc
+++ chrome/browser/renderer_host/resource_message_filter.cc
@@@@ -542,7 +542,7 @@@@ bool ResourceMessageFilter::OnMessageReceived(const IPC::Message& msg) {
 #if defined(OS_WIN)
       IPC_MESSAGE_HANDLER(ViewHostMsg_DuplicateSection, OnDuplicateSection)
 #endif
-#if defined(OS_MACOSX)
+#if defined(OS_MACOSX) || defined(OS_FREEBSD)
       IPC_MESSAGE_HANDLER(ViewHostMsg_AllocatePDFTransport,
                           OnAllocateSharedMemoryBuffer)
 #endif
@@@@ -566,7 +566,7 @@@@ bool ResourceMessageFilter::OnMessageReceived(const IPC::Message& msg) {
       IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_ScriptedPrint,
                                       OnScriptedPrint)
 #endif
-#if defined(OS_MACOSX)
+#if defined(OS_MACOSX) || defined(OS_FREEBSD)
       IPC_MESSAGE_HANDLER(ViewHostMsg_AllocTransportDIB,
                           OnAllocTransportDIB)
       IPC_MESSAGE_HANDLER(ViewHostMsg_FreeTransportDIB,
@@@@ -1306,7 +1306,7 @@@@ void ResourceMessageFilter::OnRendererHistograms(
   HistogramSynchronizer::DeserializeHistogramList(sequence_number, histograms);
 }
 
-#if defined(OS_MACOSX)
+#if defined(OS_MACOSX) || defined(OS_FREEBSD)
 void ResourceMessageFilter::OnAllocTransportDIB(
     size_t size, bool cache_in_browser, TransportDIB::Handle* handle) {
   render_widget_helper_->AllocTransportDIB(size, cache_in_browser, handle);
diff --git a/chrome/browser/renderer_host/test/test_render_view_host.h b/chrome/browser/renderer_host/test/test_render_view_host.h
index a2b1c99..90220d5 100644
--- chrome/browser/renderer_host/test/test_render_view_host.h
+++ chrome/browser/renderer_host/test/test_render_view_host.h
@@@@ -109,7 +109,7 @@@@ class TestRenderWidgetHostView : public RenderWidgetHostView {
 #endif
   virtual void SetVisuallyDeemphasized(bool deemphasized) { }
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
   virtual void CreatePluginContainer(gfx::PluginWindowHandle id) { }
   virtual void DestroyPluginContainer(gfx::PluginWindowHandle id) { }
 #endif
diff --git a/chrome/browser/renderer_host/video_layer_proxy.cc b/chrome/browser/renderer_host/video_layer_proxy.cc
index 3df1d25..9a4341a 100644
--- chrome/browser/renderer_host/video_layer_proxy.cc
+++ chrome/browser/renderer_host/video_layer_proxy.cc
@@@@ -33,8 +33,12 @@@@ void VideoLayerProxy::CopyTransportDIB(RenderProcessHost* process,
   process_id = process->GetHandle();
 #endif
 
+#if defined(OS_FREEBSD)
+  int render_process_id = process->id();
+#endif
+
   if (process_shim_->Send(new GpuMsg_PaintToVideoLayer(
-          routing_id_, process_id, bitmap, bitmap_rect))) {
+          routing_id_, render_process_id, bitmap, bitmap_rect))) {
   } else {
     // TODO(scherkus): what to do ?!?!
   }
diff --git a/chrome/browser/renderer_preferences_util.cc b/chrome/browser/renderer_preferences_util.cc
index dd29afc..6fcafe7 100644
--- chrome/browser/renderer_preferences_util.cc
+++ chrome/browser/renderer_preferences_util.cc
@@@@ -6,7 +6,7 @@@@
 
 #include "chrome/browser/profile.h"
 
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_GTK)
 #include "chrome/browser/gtk/gtk_theme_provider.h"
 #include "chrome/browser/gtk/gtk_util.h"
 #endif
@@@@ -14,7 +14,7 @@@@
 namespace renderer_preferences_util {
 
 void UpdateFromSystemSettings(RendererPreferences* prefs, Profile* profile) {
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
   gtk_util::UpdateGtkFontSettings(prefs);
 
 #if !defined(TOOLKIT_VIEWS)
@@@@ -31,7 +31,7 @@@@ void UpdateFromSystemSettings(RendererPreferences* prefs, Profile* profile) {
   prefs->inactive_selection_fg_color =
       provider->get_inactive_selection_fg_color();
 #endif  // !defined(TOOLKIT_VIEWS)
-#endif  // defined(OS_LINUX)
+#endif  // defined(OS_NIX)
 }
 
 }  // renderer_preferences_util
diff --git a/chrome/browser/search_engines/template_url_prepopulate_data.cc b/chrome/browser/search_engines/template_url_prepopulate_data.cc
index 67a5342..7f7dd38 100644
--- chrome/browser/search_engines/template_url_prepopulate_data.cc
+++ chrome/browser/search_engines/template_url_prepopulate_data.cc
@@@@ -4,7 +4,7 @@@@
 
 #include "chrome/browser/search_engines/template_url_prepopulate_data.h"
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
 #include <locale.h>
 #endif
 
diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc
index cf46e37..7fbe364 100644
--- chrome/browser/shell_integration_linux.cc
+++ chrome/browser/shell_integration_linux.cc
@@@@ -131,6 +131,8 @@@@ void CreateShortcutOnDesktop(const FilePath& shortcut_filename,
   if (!PathService::Get(chrome::DIR_USER_DESKTOP, &desktop_path))
     return;
 
+#if !defined(OS_FREEBSD)
+// BSD: Linux-specific calls like openat are used so defined out for BSD.
   int desktop_fd = open(desktop_path.value().c_str(), O_RDONLY | O_DIRECTORY);
   if (desktop_fd < 0)
     return;
@@@@ -159,6 +161,7 @@@@ void CreateShortcutOnDesktop(const FilePath& shortcut_filename,
 
   if (HANDLE_EINTR(close(desktop_fd)) < 0)
     PLOG(ERROR) << "close";
+#endif  // !defined(OS_FREEBSD)
 }
 
 void CreateShortcutInApplicationsMenu(const FilePath& shortcut_filename,
diff --git a/chrome/browser/shell_integration_unittest.cc b/chrome/browser/shell_integration_unittest.cc
index 0514781..760a8c4 100644
--- chrome/browser/shell_integration_unittest.cc
+++ chrome/browser/shell_integration_unittest.cc
@@@@ -20,13 +20,13 @@@@
 
 #if defined(OS_WIN)
 #include "chrome/installer/util/browser_distribution.h"
-#elif defined(OS_LINUX)
+#elif defined(OS_NIX)
 #include "base/env_var.h"
-#endif  // defined(OS_LINUX)
+#endif  // defined(OS_NIX)
 
 #define FPL FILE_PATH_LITERAL
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
 namespace {
 
 // Provides mock environment variables values based on a stored map.
diff --git a/chrome/browser/sync/engine/syncer_thread.cc b/chrome/browser/sync/engine/syncer_thread.cc
index ffc7bcd..e0b94d7 100644
--- chrome/browser/sync/engine/syncer_thread.cc
+++ chrome/browser/sync/engine/syncer_thread.cc
@@@@ -257,7 +257,7 @@@@ void SyncerThread::ThreadMainLoop() {
   bool initial_sync_for_thread = true;
   bool continue_sync_cycle = false;
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
   idle_query_.reset(new IdleQueryLinux());
 #endif
 
@@@@ -340,7 +340,7 @@@@ void SyncerThread::ThreadMainLoop() {
         static_cast<int>(vault_.current_wait_interval_.poll_delta.InSeconds()),
         &user_idle_milliseconds, &continue_sync_cycle, nudged);
   }
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
   idle_query_.reset();
 #endif
 }
@@@@ -755,7 +755,7 @@@@ int SyncerThread::UserIdleTime() {
   } else {
     return idle_time / 1000000;  // nano to milli
   }
-#elif defined(OS_LINUX)
+#elif defined(OS_NIX)
   if (idle_query_.get()) {
     return idle_query_->IdleTime();
   } else {
diff --git a/chrome/browser/sync/engine/syncer_thread.h b/chrome/browser/sync/engine/syncer_thread.h
index a54ff7f..ad4e63b 100644
--- chrome/browser/sync/engine/syncer_thread.h
+++ chrome/browser/sync/engine/syncer_thread.h
@@@@ -22,7 +22,7 @@@@
 #include "base/time.h"
 #include "base/waitable_event.h"
 #include "chrome/browser/sync/engine/all_status.h"
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
 #include "chrome/browser/sync/engine/idle_query_linux.h"
 #endif
 #include "chrome/browser/sync/sessions/sync_session.h"
@@@@ -324,7 +324,7 @@@@ class SyncerThread : public base::RefCountedThreadSafe<SyncerThread>,
   scoped_ptr<EventListenerHookup> directory_manager_hookup_;
   scoped_ptr<ChannelHookup<SyncerEvent> > syncer_events_;
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
   // On Linux, we need this information in order to query idle time.
   scoped_ptr<IdleQueryLinux> idle_query_;
 #endif
diff --git a/chrome/browser/sync/syncable/directory_backing_store.cc b/chrome/br
owser/sync/syncable/directory_backing_store.cc
index 048f016..9516bab 100644
--- chrome/browser/sync/syncable/directory_backing_store.cc
+++ chrome/browser/sync/syncable/directory_backing_store.cc
@@@@ -303,13 +303,13 @@@@ bool DirectoryBackingStore::BeginLoad() {
 #else
   UMA_HISTOGRAM_COUNTS_100("Sync.DirectoryOpenFailedNotWinMac", bucket);

-#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
+#if defined(OS_NIX) && !defined(OS_CHROMEOS)
   UMA_HISTOGRAM_COUNTS_100("Sync.DirectoryOpenFailedLinux", bucket);
 #elif defined(OS_CHROMEOS)
   UMA_HISTOGRAM_COUNTS_100("Sync.DirectoryOpenFailedCros", bucket);
 #else
   UMA_HISTOGRAM_COUNTS_100("Sync.DirectoryOpenFailedOther", bucket);
-#endif  // OS_LINUX && !OS_CHROMEOS
+#endif  // OS_NIX && !OS_CHROMEOS
 #endif  // OS_WIN
   return !failed_again;
 }
diff --git a/chrome/browser/sync/syncable/syncable.cc b/chrome/browser/sync/syncable/syncable.cc
index 7c6cc71..29eac9a 100644
--- chrome/browser/sync/syncable/syncable.cc
+++ chrome/browser/sync/syncable/syncable.cc
@@@@ -82,7 +82,7 @@@@ int64 Now() {
   LARGE_INTEGER n;
   memcpy(&n, &filetime, sizeof(filetime));
   return n.QuadPart;
-#elif defined(OS_LINUX) || defined(OS_MACOSX)
+#elif defined(OS_POSIX)
   struct timeval tv;
   gettimeofday(&tv, NULL);
   return static_cast<int64>(tv.tv_sec);
diff --git a/chrome/browser/tab_contents/interstitial_page.cc b/chrome/browser/tab_contents/interstitial_page.cc
index 10c8d7c..742e648 100644
--- chrome/browser/tab_contents/interstitial_page.cc
+++ chrome/browser/tab_contents/interstitial_page.cc
@@@@ -487,7 +487,7 @@@@ void InterstitialPage::CancelForNavigation() {
 }
 
 void InterstitialPage::SetSize(const gfx::Size& size) {
-#if defined(OS_WIN) || defined(OS_LINUX)
+#if defined(OS_WIN) || defined(OS_NIX)
   // When a tab is closed, we might be resized after our view was NULLed
   // (typically if there was an info-bar).
   if (render_view_host_->view())
diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc
index 37e2e01..6567331 100644
--- chrome/browser/tab_contents/render_view_context_menu.cc
+++ chrome/browser/tab_contents/render_view_context_menu.cc
@@@@ -879,7 +879,7 @@@@ bool RenderViewContextMenu::IsCommandIdEnabled(int id) const {
       return true;
 #endif  // OS_MACOSX
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
     // TODO(suzhe): this should not be enabled for password fields.
     case IDC_INPUT_METHODS_MENU:
       return true;
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index b5395cc..88ec57a 100644
--- chrome/browser/tab_contents/tab_contents.cc
+++ chrome/browser/tab_contents/tab_contents.cc
@@@@ -334,7 +334,7 @@@@ TabContents::TabContents(Profile* profile,
                  NotificationService::AllSources());
   registrar_.Add(this, NotificationType::RENDER_WIDGET_HOST_DESTROYED,
                  NotificationService::AllSources());
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_GTK)
   registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED,
                  NotificationService::AllSources());
 #endif
@@@@ -3006,7 +3006,7 @@@@ void TabContents::Observe(NotificationType type,
       break;
     }
 
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_GTK)
     case NotificationType::BROWSER_THEME_CHANGED: {
       renderer_preferences_util::UpdateFromSystemSettings(
           &renderer_preferences_, profile());
diff --git a/chrome/browser/task_manager_resource_providers.cc b/chrome/browser/task_manager_resource_providers.cc
index 6dfbc0c..4551285 100644
--- chrome/browser/task_manager_resource_providers.cc
+++ chrome/browser/task_manager_resource_providers.cc
@@@@ -839,7 +839,7 @@@@ TaskManagerBrowserProcessResource::TaskManagerBrowserProcessResource()
       default_icon_ = IconUtil::CreateSkBitmapFromHICON(icon, icon_size);
     }
   }
-#elif defined(OS_LINUX)
+#elif defined(OS_NIX)
   if (!default_icon_) {
     ResourceBundle& rb = ResourceBundle::GetSharedInstance();
     default_icon_ = rb.GetBitmapNamed(IDR_PRODUCT_LOGO_16);
diff --git a/chrome/browser/views/accessible_view_helper.cc b/chrome/browser/views/accessible_view_helper.cc
index f173761..89c639e 100644
--- chrome/browser/views/accessible_view_helper.cc
+++ chrome/browser/views/accessible_view_helper.cc
@@@@ -20,7 +20,7 @@@@ AccessibleViewHelper::AccessibleViewHelper(
   if (!accessibility_event_router_->AddViewTree(view_tree_, profile))
     view_tree_ = NULL;
 
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_USES_GTK)
   GtkWidget* widget = view_tree->GetWidget()->GetNativeView();
   widget_helper_.reset(new AccessibleWidgetHelper(widget, profile));
 #endif
diff --git a/chrome/browser/views/accessible_view_helper.h b/chrome/browser/views/accessible_view_helper.h
index 2d01238..584b91f 100644
--- chrome/browser/views/accessible_view_helper.h
+++ chrome/browser/views/accessible_view_helper.h
@@@@ -14,7 +14,7 @@@@
 #include "chrome/browser/accessibility_events.h"
 #include "chrome/browser/views/accessibility_event_router_views.h"
 
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_USES_GTK)
 #include "chrome/browser/gtk/accessible_widget_helper_gtk.h"
 #endif
 
@@@@ -68,7 +68,7 @@@@ class AccessibleViewHelper {
   std::string window_title_;
   std::vector<views::View*> managed_views_;
 
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_USES_GTK)
   scoped_ptr<AccessibleWidgetHelper> widget_helper_;
 #endif
 
diff --git a/chrome/browser/views/bug_report_view.cc b/chrome/browser/views/bug_report_view.cc
index 564b080..8ebbc7e 100644
--- chrome/browser/views/bug_report_view.cc
+++ chrome/browser/views/bug_report_view.cc
@@@@ -39,7 +39,7 @@@@
 #include "views/window/client_view.h"
 #include "views/window/window.h"
 
-#if defined(OS_LINUX)
+#if defined(USE_X11)
 #include "app/x11_util.h"
 #else
 #include "app/win_util.h"
@@@@ -209,7 +209,7 @@@@ void ShowBugReportView(views::Window* parent,
   // rendered--do not re-render, and include windowed plugins).
   std::vector<unsigned char> *screenshot_png = new std::vector<unsigned char>;
 
-#if defined(OS_LINUX)
+#if defined(USE_X11)
   x11_util::GrabWindowSnapshot(parent->GetNativeWindow(), screenshot_png);
 #else
   win_util::GrabWindowSnapshot(parent->GetNativeWindow(), screenshot_png);
diff --git a/chrome/browser/views/content_blocked_bubble_contents.cc b/chrome/browser/views/content_blocked_bubble_contents.cc
index bef80be..1cf055e 100644
--- chrome/browser/views/content_blocked_bubble_contents.cc
+++ chrome/browser/views/content_blocked_bubble_contents.cc
@@@@ -4,7 +4,7 @@@@
 
 #include "chrome/browser/views/content_blocked_bubble_contents.h"
 
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_GTK)
 #include <gdk/gdk.h>
 #endif
 
@@@@ -87,7 +87,7 @@@@ gfx::NativeCursor ContentSettingBubbleContents::Favicon::GetCursorForPoint(
   if (!g_hand_cursor)
     g_hand_cursor = LoadCursor(NULL, IDC_HAND);
   return g_hand_cursor;
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_GTK)
   return gdk_cursor_new(GDK_HAND2);
 #endif
 }
diff --git a/chrome/browser/views/create_application_shortcut_view.cc b/chrome/browser/views/create_application_shortcut_view.cc
index b0a66b3..68d0002 100644
--- chrome/browser/views/create_application_shortcut_view.cc
+++ chrome/browser/views/create_application_shortcut_view.cc
@@@@ -267,7 +267,7 @@@@ void CreateApplicationShortcutView::Init() {
         l10n_util::GetString(IDS_PIN_TO_TASKBAR_CHKBOX) :
         l10n_util::GetString(IDS_CREATE_SHORTCUTS_QUICK_LAUNCH_BAR_CHKBOX),
       profile->GetPrefs()->GetBoolean(prefs::kWebAppCreateInQuickLaunchBar));
-#elif defined(OS_LINUX)
+#elif defined(OS_NIX)
   menu_check_box_ = AddCheckbox(
       l10n_util::GetString(IDS_CREATE_SHORTCUTS_MENU_CHKBOX),
       profile->GetPrefs()->GetBoolean(prefs::kWebAppCreateInAppsMenu));
diff --git a/chrome/browser/views/download_item_view.cc b/chrome/browser/views/download_item_view.cc
index 348c86d..9318b17 100644
--- chrome/browser/views/download_item_view.cc
+++ chrome/browser/views/download_item_view.cc
@@@@ -261,7 +261,7 @@@@ DownloadItemView::DownloadItemView(DownloadItem* download,
 
     // Extract the file extension (if any).
     FilePath filepath(download->original_name());
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
     std::wstring extension = base::SysNativeMBToWide(filepath.Extension());
 #else
     std::wstring extension = filepath.Extension();
@@@@ -270,7 +270,7 @@@@ DownloadItemView::DownloadItemView(DownloadItem* download,
     // Remove leading '.'
     if (extension.length() > 0)
       extension = extension.substr(1);
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
     std::wstring rootname =
         base::SysNativeMBToWide(filepath.BaseName().RemoveExtension().value());
 #else
diff --git a/chrome/browser/views/dropdown_bar_host.cc b/chrome/browser/views/dropdown_bar_host.cc
index 4878e15..f396de6 100644
--- chrome/browser/views/dropdown_bar_host.cc
+++ chrome/browser/views/dropdown_bar_host.cc
@@@@ -20,7 +20,7 @@@@
 #include "views/focus/view_storage.h"
 #include "views/widget/widget.h"
 
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_GTK)
 #include "app/scoped_handle_gtk.h"
 #endif
 
diff --git a/chrome/browser/views/extensions/extension_popup.cc b/chrome/browser/views/extensions/extension_popup.cc
index a669d69..81ab297 100644
--- chrome/browser/views/extensions/extension_popup.cc
+++ chrome/browser/views/extensions/extension_popup.cc
@@@@ -23,7 +23,7 @@@@
 #include "views/widget/root_view.h"
 #include "views/window/window.h"
 
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_GTK)
 #include "views/widget/widget_gtk.h"
 #endif
 
@@@@ -104,7 +104,7 @@@@ ExtensionPopup::ExtensionPopup(ExtensionHost* host,
   // The bubble chrome requires a separate window, so construct it here.
   if (BUBBLE_CHROME == popup_chrome_) {
     gfx::NativeView native_window = frame->GetNativeView();
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_GTK)
     border_widget_ = new views::WidgetGtk(views::WidgetGtk::TYPE_WINDOW);
     static_cast<views::WidgetGtk*>(border_widget_)->MakeTransparent();
     static_cast<views::WidgetGtk*>(border_widget_)->make_transient_to_parent();
diff --git a/chrome/browser/views/extensions/extension_view.cc b/chrome/browser/views/extensions/extension_view.cc
index 0090bda..6d2ab07 100644
--- chrome/browser/views/extensions/extension_view.cc
+++ chrome/browser/views/extensions/extension_view.cc
@@@@ -12,7 +12,7 @@@@
 
 #if defined(OS_WIN)
 #include "chrome/browser/renderer_host/render_widget_host_view_win.h"
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_GTK)
 #include "chrome/browser/renderer_host/render_widget_host_view_gtk.h"
 #endif
 
@@@@ -100,7 +100,7 @@@@ void ExtensionView::CreateWidgetHostView() {
   HWND hwnd = view_win->Create(GetWidget()->GetNativeView());
   view_win->ShowWindow(SW_SHOW);
   Attach(hwnd);
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_GTK)
   RenderWidgetHostViewGtk* view_gtk =
       static_cast<RenderWidgetHostViewGtk*>(view);
   view_gtk->InitAsChild();
diff --git a/chrome/browser/views/find_bar_host_interactive_uitest.cc b/chrome/browser/views/find_bar_host_interactive_uitest.cc
index 51080bf..25a661f 100644
--- chrome/browser/views/find_bar_host_interactive_uitest.cc
+++ chrome/browser/views/find_bar_host_interactive_uitest.cc
@@@@ -38,7 +38,7 @@@@ class FindInPageTest : public InProcessBrowserTest {
 #if defined(TOOLKIT_VIEWS)
     views::View* view =
         reinterpret_cast<BrowserView*>(browser_window)->GetViewByID(view_id);
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_GTK)
     gfx::NativeWindow window = browser_window->GetNativeHandle();
     ASSERT_TRUE(window);
     GtkWidget* view = ViewIDUtil::GetWidget(GTK_WIDGET(window), view_id);
diff --git a/chrome/browser/views/find_bar_view.cc b/chrome/browser/views/find_bar_view.cc
index ae78c3c..e1d8820 100644
--- chrome/browser/views/find_bar_view.cc
+++ chrome/browser/views/find_bar_view.cc
@@@@ -80,7 +80,7 @@@@ static const int kDefaultCharWidth = 43;
 
 FindBarView::FindBarView(FindBarHost* host)
     : DropdownBarView(host),
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_USES_GTK)
       ignore_contents_changed_(false),
 #endif
       find_text_(NULL),
@@@@ -170,11 +170,11 @@@@ FindBarView::~FindBarView() {
 }
 
 void FindBarView::SetFindText(const string16& find_text) {
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_USES_GTK)
   ignore_contents_changed_ = true;
 #endif
   find_text_->SetText(find_text);
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_USES_GTK)
   ignore_contents_changed_ = false;
 #endif
 }
@@@@ -441,7 +441,7 @@@@ void FindBarView::ButtonPressed(
 
 void FindBarView::ContentsChanged(views::Textfield* sender,
                                   const string16& new_contents) {
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_USES_GTK)
   // On gtk setting the text in the find view causes a notification.
   if (ignore_contents_changed_)
     return;
diff --git a/chrome/browser/views/find_bar_view.h b/chrome/browser/views/find_bar_view.h
index efedc94..8709304 100644
--- chrome/browser/views/find_bar_view.h
+++ chrome/browser/views/find_bar_view.h
@@@@ -102,7 +102,7 @@@@ class FindBarView : public DropdownBarView,
   // between us and the TabContentsView.
   FindBarHost* find_bar_host() const;
 
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_USES_GTK)
   // In gtk we get changed signals if we programatically set the text. If we
   // don't ignore them we run into problems. For example, switching tabs back
   // to one with the find bar visible will cause a search to the next found
diff --git a/chrome/browser/views/frame/app_panel_browser_frame_view.cc b/chrome/browser/views/frame/app_panel_browser_frame_view.cc
index 16ebec3..804ebde 100644
--- chrome/browser/views/frame/app_panel_browser_frame_view.cc
+++ chrome/browser/views/frame/app_panel_browser_frame_view.cc
@@@@ -21,7 +21,7 @@@@
 #include "views/window/window.h"
 #include "views/window/window_resources.h"
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
 #include "views/window/hit_test.h"
 #endif
 
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc
index a34ab3a..e8d40e9 100644
--- chrome/browser/views/frame/browser_view.cc
+++ chrome/browser/views/frame/browser_view.cc
@@@@ -4,7 +4,7 @@@@
 
 #include "chrome/browser/views/frame/browser_view.h"
 
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_GTK)
 #include <gtk/gtk.h>
 #endif
 
@@@@ -67,7 +67,7 @@@@
 #include "app/win_util.h"
 #include "chrome/browser/aeropeek_manager.h"
 #include "chrome/browser/jumplist_win.h"
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_USES_GTK)
 #include "chrome/browser/views/accelerator_table_gtk.h"
 #include "views/window/hit_test.h"
 #endif
@@@@ -1095,7 +1095,7 @@@@ void BrowserView::ShowProfileErrorDialog(int message_id) {
   std::wstring message = l10n_util::GetString(message_id);
   win_util::MessageBox(GetNativeHandle(), message, title,
                        MB_OK | MB_ICONWARNING | MB_TOPMOST);
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_GTK)
   std::string title = l10n_util::GetStringUTF8(IDS_PRODUCT_NAME);
   std::string message = l10n_util::GetStringUTF8(message_id);
   GtkWidget* dialog = gtk_message_dialog_new(GetNativeHandle(),
@@@@ -2066,7 +2066,7 @@@@ void BrowserView::ProcessFullscreen(bool fullscreen) {
 #endif  // No need to invoke SetFullscreen for linux as this code is executed
         // once we're already fullscreen on linux.
 
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_GTK)
   // Updating of commands for fullscreen mode is called from SetFullScreen on
   // Wndows (see just above), but for ChromeOS, this method (ProcessFullScreen)
   // is called after full screen has happened successfully (via GTK's
diff --git a/chrome/browser/views/frame/browser_view_layout.cc b/chrome/browser/views/frame/browser_view_layout.cc
index a332beb..df7cbfd 100644
--- chrome/browser/views/frame/browser_view_layout.cc
+++ chrome/browser/views/frame/browser_view_layout.cc
@@@@ -18,7 +18,7 @@@@
 #include "gfx/scrollbar_size.h"
 #include "views/window/window.h"
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
 #include "views/window/hit_test.h"
 #endif
 
diff --git a/chrome/browser/views/frame/opaque_browser_frame_view.cc b/chrome/browser/views/frame/opaque_browser_frame_view.cc
index fc6f4de..25bc28f 100644
--- chrome/browser/views/frame/opaque_browser_frame_view.cc
+++ chrome/browser/views/frame/opaque_browser_frame_view.cc
@@@@ -32,7 +32,7 @@@@
 #include "app/win_util.h"
 #endif
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
 #include "views/window/hit_test.h"
 #endif
 
diff --git a/chrome/browser/views/fullscreen_exit_bubble.cc b/chrome/browser/views/fullscreen_exit_bubble.cc
index e216bd2..c889fae 100644
--- chrome/browser/views/fullscreen_exit_bubble.cc
+++ chrome/browser/views/fullscreen_exit_bubble.cc
@@@@ -17,7 +17,7 @@@@
 #if defined(OS_WIN)
 #include "app/l10n_util_win.h"
 #include "views/widget/widget_win.h"
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_GTK)
 #include "views/widget/widget_gtk.h"
 #endif
 
@@@@ -114,7 +114,7 @@@@ class FullscreenExitBubble::FullscreenExitPopup : public views::WidgetWin {
     return MA_NOACTIVATE;
   }
 };
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_GTK)
 // TODO: figure out the equivalent of MA_NOACTIVATE for gtk.
 #endif
 
@@@@ -149,7 +149,7 @@@@ FullscreenExitBubble::FullscreenExitBubble(
   popup_->set_window_style(WS_POPUP);
   popup_->set_window_ex_style(WS_EX_LAYERED | WS_EX_TOOLWINDOW |
                               l10n_util::GetExtendedTooltipStyles());
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_GTK)
   popup_ = new views::WidgetGtk(views::WidgetGtk::TYPE_POPUP);
   popup_->MakeTransparent();
 #endif
@@@@ -197,7 +197,7 @@@@ void FullscreenExitBubble::AnimationProgressed(
 #if defined(OS_WIN)
     popup_->MoveWindow(popup_rect.x(), popup_rect.y(), popup_rect.width(),
                        popup_rect.height());
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_GTK)
     popup_->SetBounds(popup_rect);
 #endif
     popup_->Show();
diff --git a/chrome/browser/views/fullscreen_exit_bubble.h b/chrome/browser/views/fullscreen_exit_bubble.h
index c9db5bb..3e0ca96 100644
--- chrome/browser/views/fullscreen_exit_bubble.h
+++ chrome/browser/views/fullscreen_exit_bubble.h
@@@@ -11,7 +11,7 @@@@
 #include "chrome/browser/command_updater.h"
 #include "views/controls/link.h"
 
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_GTK)
 namespace views {
 class WidgetGtk;
 }
@@@@ -73,7 +73,7 @@@@ class FullscreenExitBubble : public views::LinkController,
   // The popup itself, which is a slightly modified WidgetWin.  We need to use
   // a WidgetWin (and thus an HWND) to make the popup float over other HWNDs.
   FullscreenExitPopup* popup_;
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_GTK)
   views::WidgetGtk* popup_;
 #endif
 
diff --git a/chrome/browser/views/info_bubble.cc b/chrome/browser/views/info_bubble.cc
index 34645a0..a0369fb 100644
--- chrome/browser/views/info_bubble.cc
+++ chrome/browser/views/info_bubble.cc
@@@@ -307,7 +307,7 @@@@ void InfoBubble::AnimationProgressed(const Animation* animation) {
 
 InfoBubble::InfoBubble()
     :
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_GTK)
       WidgetGtk(TYPE_WINDOW),
       border_contents_(NULL),
 #elif defined(OS_WIN)
@@@@ -367,7 +367,7 @@@@ void InfoBubble::Init(views::Widget* parent,
   WidgetWin::Init(border_->GetNativeView(), gfx::Rect());
 
   SetWindowText(GetNativeView(), delegate_->accessible_name().c_str());
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_USES_GTK)
   MakeTransparent();
   make_transient_to_parent();
   WidgetGtk::InitWithWidget(parent, gfx::Rect());
@@@@ -439,7 +439,7 @@@@ void InfoBubble::Init(views::Widget* parent,
   ShowWindow(SW_SHOW);
   if (fade_in)
     FadeIn();
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_USES_GTK)
   views::WidgetGtk::Show();
 #endif
 }
@@@@ -479,7 +479,7 @@@@ void InfoBubble::OnActivate(UINT action, BOOL minimized, HWND window) {
     GetRootView()->GetChildViewAt(0)->RequestFocus();
   }
 }
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_GTK)
 void InfoBubble::IsActiveChanged() {
   if (!IsActive())
     Close();
@@@@ -498,7 +498,7 @@@@ void InfoBubble::DoClose(bool closed_by_escape) {
 #if defined(OS_WIN)
   border_->Close();
   WidgetWin::Close();
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_GTK)
   WidgetGtk::Close();
 #endif
 }
diff --git a/chrome/browser/views/info_bubble.h b/chrome/browser/views/info_bubble.h
index 30b3719..a2d09dc 100644
--- chrome/browser/views/info_bubble.h
+++ chrome/browser/views/info_bubble.h
@@@@ -12,7 +12,7 @@@@
 #include "chrome/browser/views/bubble_border.h"
 #if defined(OS_WIN)
 #include "views/widget/widget_win.h"
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_GTK)
 #include "views/widget/widget_gtk.h"
 #endif
 
@@@@ -174,7 +174,7 @@@@ class InfoBubbleDelegate {
 class InfoBubble
 #if defined(OS_WIN)
     : public views::WidgetWin,
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_GTK)
     : public views::WidgetGtk,
 #endif
       public views::AcceleratorTarget,
@@@@ -248,7 +248,7 @@@@ class InfoBubble
 #if defined(OS_WIN)
   // Overridden from WidgetWin:
   virtual void OnActivate(UINT action, BOOL minimized, HWND window);
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_GTK)
   // Overridden from WidgetGtk:
   virtual void IsActiveChanged();
 #endif
@@@@ -256,7 +256,7 @@@@ class InfoBubble
 #if defined(OS_WIN)
   // The window used to render the padding, border and arrow.
   BorderWidget* border_;
-#elif defined(OS_LINUX)
+#elif defined(OS_NIX)
   // The view displaying the border.
   BorderContents* border_contents_;
 #endif
diff --git a/chrome/browser/views/location_bar/location_bar_view.cc b/chrome/browser/views/location_bar/location_bar_view.cc
index 4dffa4e..0402591 100644
--- chrome/browser/views/location_bar/location_bar_view.cc
+++ chrome/browser/views/location_bar/location_bar_view.cc
@@@@ -4,7 +4,7 @@@@
 
 #include "chrome/browser/views/location_bar/location_bar_view.h"
 
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_USES_GTK)
 #include <gtk/gtk.h>
 #endif
 
diff --git a/chrome/browser/views/location_bar/location_bar_view.h b/chrome/browser/views/location_bar/location_bar_view.h
index 84270dd..389d121 100644
--- chrome/browser/views/location_bar/location_bar_view.h
+++ chrome/browser/views/location_bar/location_bar_view.h
@@@@ -357,7 +357,7 @@@@ class LocationBarView : public LocationBar,
   // focused. Used when the toolbar is in full keyboard accessibility mode.
   bool show_focus_rect_;
 
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_USES_GTK)
   scoped_ptr<AccessibleWidgetHelper> accessible_widget_helper_;
 #endif
 
diff --git a/chrome/browser/views/notifications/balloon_view.cc b/chrome/browser/views/notifications/balloon_view.cc
index c89280b..7047f8f 100644
--- chrome/browser/views/notifications/balloon_view.cc
+++ chrome/browser/views/notifications/balloon_view.cc
@@@@ -37,7 +37,7 @@@@
 #if defined(OS_WIN)
 #include "views/widget/widget_win.h"
 #endif
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_GTK)
 #include "views/widget/widget_gtk.h"
 #endif
 
diff --git a/chrome/browser/views/notifications/balloon_view_host.cc b/chrome/browser/views/notifications/balloon_view_host.cc
index b2c2a5c..7c305da 100644
--- chrome/browser/views/notifications/balloon_view_host.cc
+++ chrome/browser/views/notifications/balloon_view_host.cc
@@@@ -10,14 +10,14 @@@@
 #if defined(OS_WIN)
 #include "chrome/browser/renderer_host/render_widget_host_view_win.h"
 #endif
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_GTK)
 #include "chrome/browser/renderer_host/render_widget_host_view_gtk.h"
 #endif
 #include "views/widget/widget.h"
 #if defined(OS_WIN)
 #include "views/widget/widget_win.h"
 #endif
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_GTK)
 #include "views/widget/widget_gtk.h"
 #endif
 
@@@@ -70,7 +70,7 @@@@ void BalloonViewHost::InitRenderWidgetHostView() {
   HWND hwnd = view_win->Create(parent_native_view_);
   view_win->ShowWindow(SW_SHOW);
   native_host_->Attach(hwnd);
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_GTK)
   RenderWidgetHostViewGtk* view_gtk =
       static_cast<RenderWidgetHostViewGtk*>(render_widget_host_view_);
   view_gtk->InitAsChild();
diff --git a/chrome/browser/views/tabs/dragged_tab_view.cc b/chrome/browser/views/tabs/dragged_tab_view.cc
index 5ee2626..cca2b27 100644
--- chrome/browser/views/tabs/dragged_tab_view.cc
+++ chrome/browser/views/tabs/dragged_tab_view.cc
@@@@ -11,7 +11,7 @@@@
 
 #if defined(OS_WIN)
 #include "views/widget/widget_win.h"
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_GTK)
 #include "views/widget/widget_gtk.h"
 #endif
 
diff --git a/chrome/browser/views/tabs/dragged_tab_view.h b/chrome/browser/views/tabs/dragged_tab_view.h
index f2ded5a..653ccd7 100644
--- chrome/browser/views/tabs/dragged_tab_view.h
+++ chrome/browser/views/tabs/dragged_tab_view.h
@@@@ -13,7 +13,7 @@@@
 namespace views {
 #if defined(OS_WIN)
 class WidgetWin;
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_GTK)
 class WidgetGtk;
 #endif
 }
@@@@ -70,7 +70,7 @@@@ class DraggedTabView : public views::View {
   // The window that contains the DraggedTabView.
 #if defined(OS_WIN)
   scoped_ptr<views::WidgetWin> container_;
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_GTK)
   scoped_ptr<views::WidgetGtk> container_;
 #endif
 
diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc
index 03cc42f..925d96b 100644
--- chrome/browser/views/tabs/tab_strip.cc
+++ chrome/browser/views/tabs/tab_strip.cc
@@@@ -31,7 +31,7 @@@@
 #if defined(OS_WIN)
 #include "app/win_util.h"
 #include "views/widget/widget_win.h"
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_GTK)
 #include "views/widget/widget_gtk.h"
 #endif
 
@@@@ -769,7 +769,7 @@@@ bool TabStrip::IsCursorInTabStripZone() const {
 #if defined(OS_WIN)
   DWORD pos = GetMessagePos();
   gfx::Point cursor_point(pos);
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_USES_GTK)
   // TODO(sky): make sure this is right with multiple monitors.
   GdkScreen* screen = gdk_screen_get_default();
   GdkDisplay* display = gdk_screen_get_display(screen);
diff --git a/chrome/browser/views/tabs/tab_strip.h b/chrome/browser/views/tabs/tab_strip.h
index 92ba7f9..8a1d646 100644
--- chrome/browser/views/tabs/tab_strip.h
+++ chrome/browser/views/tabs/tab_strip.h
@@@@ -18,7 +18,7 @@@@ class Tab;
 
 namespace views {
 class ImageView;
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_GTK)
 class WidgetGtk;
 #elif defined(OS_WIN)
 class WidgetWin;
diff --git a/chrome/browser/web_applications/web_app.cc b/chrome/browser/web_applications/web_app.cc
index 97a2329..741743f 100644
--- chrome/browser/web_applications/web_app.cc
+++ chrome/browser/web_applications/web_app.cc
@@@@ -32,9 +32,9 @@@@
 #include "chrome/common/url_constants.h"
 #include "webkit/glue/dom_operations.h"
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
 #include "base/env_var.h"
-#endif  // defined(OS_LINUX)
+#endif  // defined(OS_NIX)
 
 #if defined(OS_WIN)
 #include "base/win_util.h"
@@@@ -258,7 +258,7 @@@@ void CreateShortcutTask::Run() {
 bool CreateShortcutTask::CreateShortcut() {
   DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE));
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
   scoped_ptr<base::EnvVarGetter> env_getter(base::EnvVarGetter::Create());
 
   std::string shortcut_template;
diff --git a/chrome/browser/wrench_menu_model.cc b/chrome/browser/wrench_menu_model.cc
index 637ab57..bf6ab61 100644
--- chrome/browser/wrench_menu_model.cc
+++ chrome/browser/wrench_menu_model.cc
@@@@ -200,7 +200,7 @@@@ void WrenchMenuModel::Build() {
   AddItemWithStringId(IDC_NEW_INCOGNITO_WINDOW, IDS_NEW_INCOGNITO_WINDOW);
 
   AddSeparator();
-#if defined(OS_MACOSX) || (defined(OS_LINUX) && !defined(TOOLKIT_VIEWS))
+#if defined(OS_POSIX) && !defined(TOOLKIT_VIEWS)
   // WARNING: Mac does not use the ButtonMenuItemModel, but instead defines the
   // layout for this menu item in Toolbar.xib. It does, however, use the
   // command_id value from AddButtonItem() to identify this special item.
@@@@ -215,7 +215,7 @@@@ void WrenchMenuModel::Build() {
 #endif
 
   AddSeparator();
-#if defined(OS_MACOSX) || (defined(OS_LINUX) && !defined(TOOLKIT_VIEWS))
+#if defined(OS_POSIX) && !defined(TOOLKIT_VIEWS)
   // WARNING: See above comment.
   zoom_menu_item_model_.reset(
       new menus::ButtonMenuItemModel(IDS_ZOOM_MENU, this));
diff --git a/chrome/browser/zygote_host_linux.cc b/chrome/browser/zygote_host_linux.cc
index 9423598..b8e035d 100644
--- chrome/browser/zygote_host_linux.cc
+++ chrome/browser/zygote_host_linux.cc
@@@@ -55,7 +55,12 @@@@ ZygoteHost::ZygoteHost()
 }
 
 ZygoteHost::~ZygoteHost() {
+    Pickle pickle;
   if (init_)
+#if defined(OS_FREEBSD)
+    pickle.WriteInt(kCmdEnd);
+    HANDLE_EINTR(write(control_fd_, pickle.data(), pickle.size()));
+#endif
     close(control_fd_);
 }
 
@@@@ -71,7 +76,12 @@@@ void ZygoteHost::Init(const std::string& sandbox_cmd) {
                                  switches::kZygoteProcess);
 
   int fds[2];
+#if defined(OS_FREEBSD)
+  if (socketpair(PF_UNIX, SOCK_SEQPACKET, 0, fds) != 0)
+    CHECK(socketpair(PF_UNIX, SOCK_DGRAM, 0, fds) == 0);
+#else
   CHECK(socketpair(PF_UNIX, SOCK_SEQPACKET, 0, fds) == 0);
+#endif
   base::file_handle_mapping_vector fds_to_map;
   fds_to_map.push_back(std::make_pair(fds[1], 3));
 
@@@@ -153,6 +163,7 @@@@ void ZygoteHost::Init(const std::string& sandbox_cmd) {
     // We need to look for it.
     // But first, wait for the zygote to tell us it's running.
     // The sending code is in chrome/browser/zygote_main_linux.cc.
+#if defined(OS_LINUX)
     std::vector<int> fds_vec;
     const int kExpectedLength = sizeof(kZygoteMagic);
     char buf[kExpectedLength];
@@@@ -182,6 +193,7 @@@@ void ZygoteHost::Init(const std::string& sandbox_cmd) {
       // Reap the sandbox.
       ProcessWatcher::EnsureProcessGetsReaped(process);
     }
+#endif // defined(OS_LINUX)
   } else {
     // Not using the SUID sandbox.
     pid_ = process;
@@@@ -277,6 +289,7 @@@@ pid_t ZygoteHost::ForkRenderer(
     selinux_valid = true;
   }
 
+#if defined(OS_LINUX)
   const int kRendererScore = 5;
   if (using_suid_sandbox_ && !selinux) {
     base::ProcessHandle sandbox_helper_process;
@@@@ -296,6 +309,7 @@@@ pid_t ZygoteHost::ForkRenderer(
     if (!base::AdjustOOMScore(pid, kRendererScore))
       LOG(ERROR) << "Failed to adjust OOM score of renderer";
   }
+#endif  // defined(OS_LINUX)
 
   return pid;
 }
diff --git a/chrome/browser/zygote_host_linux.h b/chrome/browser/zygote_host_linux.h
index 545df8d..749996e 100644
--- chrome/browser/zygote_host_linux.h
+++ chrome/browser/zygote_host_linux.h
@@@@ -45,6 +45,9 @@@@ class ZygoteHost {
     kCmdReap = 1,             // Reap a renderer child.
     kCmdDidProcessCrash = 2,  // Check if child process crashed.
     kCmdGetSandboxStatus = 3, // Read a bitmask of kSandbox*
+#if defined(OS_FREEBSD)
+    kCmdEnd = 5,              // Kill zygote for SOCK_DGRAM.
+#endif
   };
 
   // These form a bitmask which describes the conditions of the sandbox that
diff --git a/chrome/browser/zygote_main_linux.cc b/chrome/browser/zygote_main_linux.cc
index 51a658e..1d1e99d 100644
--- chrome/browser/zygote_main_linux.cc
+++ chrome/browser/zygote_main_linux.cc
@@@@ -2,11 +2,17 @@@@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "build/build_config.h"
+
 #include <dlfcn.h>
 #include <fcntl.h>
+#if defined(OS_FREEBSD)
+#include <signal.h>
+#else
 #include <sys/epoll.h>
 #include <sys/prctl.h>
 #include <sys/signal.h>
+#endif
 #include <sys/socket.h>
 #include <sys/stat.h>
 #include <sys/types.h>
@@@@ -47,7 +53,7 @@@@
 
 #include "unicode/timezone.h"
 
-#if defined(ARCH_CPU_X86_FAMILY) && !defined(CHROMIUM_SELINUX)
+#if defined(ARCH_CPU_X86_FAMILY) && defined(OS_LINUX) && !defined(CHROMIUM_SELINUX)
 // The seccomp sandbox is enabled on all ia32 and x86-64 processor as long as
 // we aren't using SELinux.
 #define SECCOMP_SANDBOX
@@@@ -169,6 +175,11 @@@@ class Zygote {
         case ZygoteHost::kCmdGetSandboxStatus:
           HandleGetSandboxStatus(fd, pickle, iter);
           return false;
+#if defined(OS_FREEBSD)
+        case ZygoteHost::kCmdEnd:
+          _exit(0);
+          return false;
+#endif
         default:
           NOTREACHED();
           break;
@@@@ -237,7 +248,11 @@@@ class Zygote {
     int argc, numfds;
     base::GlobalDescriptors::Mapping mapping;
     base::ProcessId child;
+#if defined(OS_FREEBSD)
+    uint32_t dummy_inode = 0;
+#elif
     uint64_t dummy_inode = 0;
+#endif
     int dummy_fd = -1;
 
     if (!pickle.ReadInt(&iter, &argc))
@@@@ -265,6 +280,7 @@@@ class Zygote {
     mapping.push_back(std::make_pair(
         static_cast<uint32_t>(kSandboxIPCChannel), kMagicSandboxIPCDescriptor));
 
+#if defined(OS_LINUX)
     if (g_suid_sandbox_active) {
       dummy_fd = socket(PF_UNIX, SOCK_DGRAM, 0);
       if (dummy_fd < 0)
@@@@ -273,6 +289,7 @@@@ class Zygote {
       if (!base::FileDescriptorGetInode(&dummy_inode, dummy_fd))
         goto error;
     }
+#endif // defined(OS_LINUX)
 
     child = fork();
 
@@@@ -280,10 +297,13 @@@@ class Zygote {
 #if defined(SECCOMP_SANDBOX)
       // Try to open /proc/self/maps as the seccomp sandbox needs access to it
       if (g_proc_fd >= 0) {
+#if defined(OS_LINUX)
+// BSD: Removing all Seccomp Sandbox code if not on linux
         int proc_self_maps = openat(g_proc_fd, "self/maps", O_RDONLY);
         if (proc_self_maps >= 0) {
           SeccompSandboxSetProcSelfMaps(proc_self_maps);
         }
+#endif
         close(g_proc_fd);
         g_proc_fd = -1;
       }
@@@@ -593,6 +613,8 @@@@ static bool EnterSandbox() {
 
     SkiaFontConfigUseIPCImplementation(kMagicSandboxIPCDescriptor);
 
+    // TODO(benl): Do something for FreeBSD...
+#if !defined(OS_FREEBSD)
     // Previously, we required that the binary be non-readable. This causes the
     // kernel to mark the process as non-dumpable at startup. The thinking was
     // that, although we were putting the renderers into a PID namespace (with
@@@@ -618,6 +640,7 @@@@ static bool EnterSandbox() {
         return false;
       }
     }
+#endif
   } else {
     SkiaFontConfigUseDirectImplementation();
   }
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index ebd8304..1e833f3 100644
--- chrome/chrome.gyp
+++ chrome/chrome.gyp
@@@@ -95,6 +95,10 @@@@
           }],
         ],
       },],
+      ['OS=="freebsd" or OS=="openbsd"', {
+        'platform_locale_settings_grd':
+            'app/resources/locale_settings_linux.grd',
+      },],
       ['OS=="mac"', {
         'tweak_info_plist_path': 'tools/build/mac/tweak_info_plist',
         'nacl_defines': [
@@@@ -658,7 +662,7 @@@@
         '..',
       ],
       'conditions': [
-        ['OS=="linux"', {
+        ['OS=="linux" or OS=="freebsd"', {
           'dependencies': [
             '../build/linux/system.gyp:gtk',
           ],
@@@@ -716,7 +720,7 @@@@
             '<(DEPTH)/third_party/wtl/include',
           ],
         }],
-        ['OS=="linux" and target_arch!="arm"', {
+        ['(OS=="linux" or OS=="freebsd") and target_arch!="arm"', {
           'sources': [
             'gpu/gpu_backing_store_glx.cc',
             'gpu/gpu_backing_store_glx.h',
@@@@ -1078,7 +1082,7 @@@@
             'service/cloud_print/print_system_win.cc',
           ],
         }],
-        ['OS=="linux"', {
+        ['OS=="linux" or OS=="freebsd"', {
           'dependencies': [
             '../build/linux/system.gyp:gtk',
           ],
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 05a38da..b64be85 100644
--- chrome/chrome_browser.gypi
+++ chrome/chrome_browser.gypi
@@@@ -2883,12 +2883,18 @@@@
             ],
           },
         }],
+        ['use_gconf==0', {
+          'sources!': [
+            'browser/gtk/gconf_titlebar_listener.cc',
+            'browser/gtk/gconf_titlebar_listener.h',
+          ],
+        }],
         ['touchui==0', {
           'sources!': [
             # Nothing yet.
           ],
         }],
-        ['OS=="linux"', {
+        ['OS=="linux" or OS=="freebsd"', {
           'dependencies': [
             '../build/linux/system.gyp:dbus-glib',
             '../build/linux/system.gyp:gconf',
@@@@ -2870,12 +2870,6 @@@@
             '../build/linux/system.gyp:gtkprint',
             '../build/linux/system.gyp:nss',
           ],
-          'link_settings': {
-            'libraries': [
-              # For dlsym() in 'browser/zygote_main_linux.cc'
-              '-ldl',
-            ],
-          },
           'sources!': [
              # Exclude extension shelf for toolstrips.
             'browser/views/extensions/extension_shelf.cc',
@@@@ -2935,6 +2929,9 @@@@
           'sources': [
             'browser/file_watcher_stub.cc',
           ],
+          'sources!': [
+            'browser/file_watcher_inotify.cc',
+          ],
         }],
         ['OS=="mac"', {
           'sources!': [
@@@@ -3481,7 +3478,7 @@@@
               ],
             }],
             # GTK build only
-            ['OS=="linux" and toolkit_views==0', {
+            ['(OS=="linux" or OS=="freebsd") and toolkit_views==0', {
               'sources/': [
                 ['include', '^browser/printing/print_dialog_gtk.cc'],
                 ['include', '^browser/printing/print_dialog_gtk.h'],
diff --git a/chrome/chrome_renderer.gypi b/chrome/chrome_renderer.gypi
index b0b2532..901204a 100644
--- chrome/chrome_renderer.gypi
+++ chrome/chrome_renderer.gypi
@@@@ -226,6 +226,14 @@@@
         }],
         # BSD-specific rules.
         ['OS=="openbsd" or OS=="freebsd"', {
+          'conditions': [
+            [ 'linux_use_tcmalloc==1', {
+                'dependencies': [
+                  '../base/allocator/allocator.gyp:allocator',
+                ],
+	      },
+	    ],
+	  ],
           'dependencies': [
             '../build/linux/system.gyp:gtk',
           ],
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index 28cd15b..adfae38 100644
--- chrome/chrome_tests.gypi
+++ chrome/chrome_tests.gypi
@@@@ -126,7 +126,7 @@@@
         'test/ui_test_utils_win.cc',
       ],
       'conditions': [
-        ['OS=="linux"', {
+        ['OS=="linux" or OS=="freebsd"', {
           'dependencies': [
             '../build/linux/system.gyp:gtk',
             '../build/linux/system.gyp:nss',
@@@@ -172,7 +172,7 @@@@
         'test/ui/ui_test_suite.h',
       ],
       'conditions': [
-        ['OS=="linux"', {
+        ['OS=="linux" or OS=="freebsd"', {
           'dependencies': [
             '../build/linux/system.gyp:gtk',
           ],
@@@@ -196,7 +196,7 @@@@
         'test/unit/run_all_unittests.cc',
       ],
       'conditions': [
-        ['OS=="linux"', {
+        ['OS=="linux" or OS=="freebsd"', {
           'dependencies': [
             # Needed for the following #include chain:
             #   test/unit/run_all_unittests.cc
@@@@ -231,7 +231,7 @@@@
         'test/automated_ui_tests/automated_ui_tests.h',
       ],
       'conditions': [
-        ['OS=="linux"', {
+        ['OS=="linux" or OS=="freebsd"', {
           'dependencies': [
             '../tools/xdisplaycheck/xdisplaycheck.gyp:xdisplaycheck',
           ],
@@@@ -345,7 +345,7 @@@@
             '../webkit/webkit.gyp:npapi_pepper_test_plugin',
           ],
         }],
-        ['OS=="linux"', {
+        ['OS=="linux" or OS=="freebsd"', {
           'dependencies': [
             '../build/linux/system.gyp:gtk',
             '../tools/xdisplaycheck/xdisplaycheck.gyp:xdisplaycheck',
@@@@ -1232,7 +1232,7 @@@@
             ['exclude', '^browser/chromeos/'],
           ],
         }],
-        ['OS=="linux"', {
+        ['OS=="linux" or OS=="freebsd"', {
           'conditions': [
             ['gcc_version==44', {
               # Avoid gcc 4.4 strict aliasing issues in stl_tree.h when
@@@@ -1662,7 +1662,7 @@@@
             'browser/renderer_host/test/render_view_host_manager_browsertest.cc',
           ],
         }],
-        ['OS=="linux"', {
+        ['OS=="linux" or OS=="freebsd"', {
           'dependencies': [
             '../build/linux/system.gyp:gtk',
             '../tools/xdisplaycheck/xdisplaycheck.gyp:xdisplaycheck',
@@@@ -1735,7 +1735,7 @@@@
         'test/startup/startup_test.cc',
       ],
       'conditions': [
-        ['OS=="linux"', {
+        ['OS=="linux" or OS=="freebsd"', {
           'dependencies': [
             '../build/linux/system.gyp:gtk',
             '../tools/xdisplaycheck/xdisplaycheck.gyp:xdisplaycheck',
@@@@ -1816,7 +1816,7 @@@@
             '<(allocator_target)',
           ],
         },],
-        ['OS=="linux"', {
+        ['OS=="linux" or OS=="freebsd"', {
           'dependencies': [
             '../build/linux/system.gyp:gtk',
           ],
@@@@ -1842,7 +1842,7 @@@@
         'test/page_cycler/page_cycler_test.cc',
       ],
       'conditions': [
-        ['OS=="linux"', {
+        ['OS=="linux" or OS=="freebsd"', {
           'dependencies': [
             '../build/linux/system.gyp:gtk',
             '../tools/xdisplaycheck/xdisplaycheck.gyp:xdisplaycheck',
@@@@ -1879,7 +1879,7 @@@@
         'test/tab_switching/tab_switching_test.cc',
       ],
       'conditions': [
-        ['OS=="linux"', {
+        ['OS=="linux" or OS=="freebsd"', {
           'dependencies': [
             '../build/linux/system.gyp:gtk',
             '../tools/xdisplaycheck/xdisplaycheck.gyp:xdisplaycheck',
@@@@ -1913,7 +1913,7 @@@@
         'test/memory_test/memory_test.cc',
       ],
       'conditions': [
-        ['OS=="linux"', {
+        ['OS=="linux" or OS=="freebsd"', {
           'dependencies': [
             '../build/linux/system.gyp:gtk',
             '../tools/xdisplaycheck/xdisplaycheck.gyp:xdisplaycheck',
@@@@ -2057,7 +2057,7 @@@@
             'browser/sync/util/data_encryption_unittest.cc',
           ],
         }],
-        ['OS=="linux"', {
+        ['OS=="linux" or OS=="freebsd"', {
           'dependencies': [
             '../build/linux/system.gyp:gtk',
             '../build/linux/system.gyp:nss',
@@@@ -2157,7 +2157,7 @@@@
       ],
       'conditions': [
         # Plugin code.
-        ['OS=="linux" or OS=="win"', {
+        ['OS=="linux" or OS=="freebsd" or OS=="win"', {
           'dependencies': [
             'plugin',
            ],
@@@@ -2165,7 +2165,7 @@@@
             'plugin',
           ],
         }],
-        ['OS=="linux"', {
+        ['OS=="linux" or OS=="freebsd"', {
            'dependencies': [
              '../build/linux/system.gyp:gtk',
              '../build/linux/system.gyp:nss',
@@@@ -2294,7 +2294,7 @@@@
             'test/perf/url_parse_perftest.cc',
           ],
           'conditions': [
-            ['OS=="linux"', {
+            ['OS=="linux" or OS=="freebsd"', {
               'dependencies': [
                 '../build/linux/system.gyp:gtk',
                 '../tools/xdisplaycheck/xdisplaycheck.gyp:xdisplaycheck',
@@@@ -2422,7 +2422,7 @@@@
       ]},  # 'targets'
     ],  # OS=="win"
     # Build on linux x86_64 only if linux_fpic==1
     ['OS=="mac" or (OS=="win" and component=="static_library") '
-     'or (OS=="linux" and target_arch==python_arch '
+     'or ((OS=="linux" or OS=="freebsd") and target_arch==python_arch '
      'and (target_arch!="x64" or linux_fpic==1))', {
       'targets': [
         {
diff --git a/chrome/common/chrome_constants.cc b/chrome/common/chrome_constants.cc
index 47f0d52..48779e7 100644
--- chrome/common/chrome_constants.cc
+++ chrome/common/chrome_constants.cc
@@@@ -27,7 +27,7 @@@@ namespace chrome {
 #if defined(OS_WIN)
 const wchar_t kBrowserProcessExecutableName[] = L"chrome.exe";
 const wchar_t kHelperProcessExecutableName[] = L"chrome.exe";
-#elif defined(OS_LINUX)
+#elif defined(OS_NIX)
 const wchar_t kBrowserProcessExecutableName[] = L"chrome";
 // Helper processes end up with a name of "exe" due to execing via
 // /proc/self/exe.  See bug 22703.
@@@@ -39,7 +39,7 @@@@ const wchar_t kHelperProcessExecutableName[] = PRODUCT_STRING_W L" Helper";
 #if defined(OS_WIN)
 const wchar_t kBrowserProcessExecutablePath[] = L"chrome.exe";
 const FilePath::CharType kHelperProcessExecutablePath[] = FPL("chrome.exe");
-#elif defined(OS_LINUX)
+#elif defined(OS_NIX)
 const wchar_t kBrowserProcessExecutablePath[] = L"chrome";
 const FilePath::CharType kHelperProcessExecutablePath[] = FPL("chrome");
 #elif defined(OS_MACOSX)
diff --git a/chrome/common/chrome_paths.cc b/chrome/common/chrome_paths.cc
index 6f77510..f4d4183 100644
--- chrome/common/chrome_paths.cc
+++ chrome/common/chrome_paths.cc
@@@@ -164,7 +164,7 @@@@ bool PathProvider(int key, FilePath* result) {
       cur = cur.Append(FILE_PATH_LITERAL("inspector"));
       break;
     case chrome::DIR_APP_DICTIONARIES:
-#if defined(OS_LINUX) || defined(OS_MACOSX)
+#if defined(OS_POSIX)
       // We can't write into the EXE dir on Linux, so keep dictionaries
       // alongside the safe browsing database in the user data dir.
       // And we don't want to write into the bundle on the Mac, so push
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index b78c3e7..da0c8ce 100644
--- chrome/common/chrome_switches.cc
+++ chrome/common/chrome_switches.cc
@@@@ -1029,7 +1029,7 @@@@ const char kServicesManifest[]              = "services-manifest";
 
 #endif
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
 // Specify the amount the trackpad should scroll by.
 const char kScrollPixels[]                  = "scroll-pixels";
 #endif
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index 7262bde..caf128f 100644
--- chrome/common/chrome_switches.h
+++ chrome/common/chrome_switches.h
@@@@ -302,7 +302,7 @@@@ extern const char kStartupManifest[];
 extern const char kServicesManifest[];
 #endif
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
 extern const char kScrollPixels[];
 #endif
 
diff --git a/chrome/common/gpu_messages_internal.h b/chrome/common/gpu_messages_internal.h
index fa9a83f..8a3e65b 100644
--- chrome/common/gpu_messages_internal.h
+++ chrome/common/gpu_messages_internal.h
@@@@ -98,7 +98,7 @@@@ IPC_BEGIN_MESSAGES(GpuHost)
   // Response to a GpuMsg_Synchronize message.
   IPC_MESSAGE_CONTROL0(GpuHostMsg_SynchronizeReply)
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
   // Get the XID for a view ID.
   IPC_SYNC_MESSAGE_CONTROL1_1(GpuHostMsg_GetViewXID,
                               gfx::NativeViewId, /* view */
diff --git a/chrome/common/native_web_keyboard_event.h b/chrome/common/native_web_keyboard_event.h
index 381ad31..d5675ae 100644
--- chrome/common/native_web_keyboard_event.h
+++ chrome/common/native_web_keyboard_event.h
@@@@ -32,7 +32,7 @@@@ struct NativeWebKeyboardEvent : public WebKit::WebKeyboardEvent {
   NativeWebKeyboardEvent(wchar_t character,
                          int state,
                          double time_stamp_seconds);
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_GTK)
   explicit NativeWebKeyboardEvent(const GdkEventKey* event);
   NativeWebKeyboardEvent(wchar_t character,
                          int state,
@@@@ -48,7 +48,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/render_messages_internal.h b/chrome/common/render_messages_internal.h
index 3704777..abbb050 100644
--- chrome/common/render_messages_internal.h
+++ chrome/common/render_messages_internal.h
@@@@ -1778,7 +1778,7 @@@@ IPC_BEGIN_MESSAGES(ViewHost)
                        int /* fd in browser */)
 #endif
 
-#if defined(OS_MACOSX)
+#if defined(OS_MACOSX) || defined(OS_FREEBSD)
   // Asks the browser to create a block of shared memory for the renderer to
   // pass NativeMetafile data to the browser.
   IPC_SYNC_MESSAGE_ROUTED1_1(ViewHostMsg_AllocatePDFTransport,
@@@@ -1957,7 +1957,7 @@@@ IPC_BEGIN_MESSAGES(ViewHost)
   IPC_MESSAGE_CONTROL1(ViewHostMsg_ExtensionRemoveListener,
                        std::string /* name */)
 
-#if defined(OS_MACOSX)
+#if defined(OS_MACOSX) || defined(OS_FREEBSD)
   // On OSX, we cannot allocated shared memory from within the sandbox, so
   // this call exists for the renderer to ask the browser to allocate memory
   // on its behalf. We return a file descriptor to the POSIX shared memory.
diff --git a/chrome/default_plugin/default_plugin.gyp b/chrome/default_plugin/default_plugin.gyp
index a0d8a6d..2093868 100644
--- chrome/default_plugin/default_plugin.gyp
+++ chrome/default_plugin/default_plugin.gyp
@@@@ -53,7 +53,7 @@@@
               'plugin_install_job_monitor.h',
             ],
          }],
-         ['OS=="linux"', {
+         ['OS=="linux" or OS=="freebsd"', {
             'dependencies': [
               '<(DEPTH)/build/linux/system.gyp:gtk',
             ],
diff --git a/chrome/gpu/gpu_backing_store_glx.cc b/chrome/gpu/gpu_backing_store_glx.cc
index 37076cc..821611e 100644
--- chrome/gpu/gpu_backing_store_glx.cc
+++ chrome/gpu/gpu_backing_store_glx.cc
@@@@ -7,6 +7,7 @@@@
 #include "app/gfx/gl/gl_bindings.h"
 #include "app/surface/transport_dib.h"
 #include "base/scoped_ptr.h"
+#include "chrome/browser/renderer_host/render_process_host.h"
 #include "chrome/common/gpu_messages.h"
 #include "chrome/gpu/gpu_backing_store_glx_context.h"
 #include "chrome/gpu/gpu_thread.h"
@@@@ -63,7 +64,7 @@@@ void GpuBackingStoreGLX::OnPaintToBackingStore(
     TransportDIB::Id id,
     const gfx::Rect& bitmap_rect,
     const std::vector<gfx::Rect>& copy_rects) {
-  scoped_ptr<TransportDIB> dib(TransportDIB::Map(id));
+  scoped_ptr<TransportDIB> dib(RenderProcessHost::FromID(source_process_id)->GetTransportDIB(id));
   view_->BindContext();
 
   scoped_ptr<skia::PlatformCanvas> canvas(
diff --git a/chrome/gpu/gpu_channel.cc b/chrome/gpu/gpu_channel.cc
index 091410c..d2fdb49 100644
--- chrome/gpu/gpu_channel.cc
+++ chrome/gpu/gpu_channel.cc
@@@@ -116,7 +116,7 @@@@ void GpuChannel::OnCreateViewCommandBuffer(gfx::NativeViewId view_id,
   if (view_renderer_id != renderer_id_)
     return;
   handle = view;
-#elif defined(OS_LINUX)
+#elif defined(OS_NIX)
   ChildThread* gpu_thread = ChildThread::current();
   // Ask the browser for the view's XID.
   // TODO(piman): This assumes that it doesn't change. It can change however
diff --git a/chrome/gpu/gpu_config.h b/chrome/gpu/gpu_config.h
index 41ca6a3..288bf3c 100644
--- chrome/gpu/gpu_config.h
+++ chrome/gpu/gpu_config.h
@@@@ -9,7 +9,7 @@@@
 
 #include "build/build_config.h"
 
-#if defined(OS_LINUX) && !defined(ARCH_CPU_ARMEL)
+#if defined(OS_NIX) && !defined(ARCH_CPU_ARMEL)
 
 // Only define GLX support for Intel CPUs for now until we can get the
 // proper dependencies and build setup for ARM.
diff --git a/chrome/gpu/gpu_thread.cc b/chrome/gpu/gpu_thread.cc
index c5ac79f..257ed34 100644
--- chrome/gpu/gpu_thread.cc
+++ chrome/gpu/gpu_thread.cc
@@@@ -24,7 +24,7 @@@@
 #include <X11/Xutil.h>  // Must be last.
 #endif
 
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_USES_GTK)
 #include <gtk/gtk.h>
 #endif
 
@@@@ -32,7 +32,7 @@@@ GpuThread::GpuThread() {
 #if defined(GPU_USE_GLX)
   display_ = ::XOpenDisplay(NULL);
 #endif
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_USES_GTK)
   {
     // The X11 port of the command buffer code assumes it can access the X
     // display via the macro GDK_DISPLAY(), which implies that Gtk has been
diff --git a/chrome/gpu/gpu_video_layer_glx.cc b/chrome/gpu/gpu_video_layer_glx.cc
index d0578ad..985dc1a 100644
--- chrome/gpu/gpu_video_layer_glx.cc
+++ chrome/gpu/gpu_video_layer_glx.cc
@@@@ -5,6 +5,7 @@@@
 #include "chrome/gpu/gpu_video_layer_glx.h"
 
 #include "app/gfx/gl/gl_bindings.h"
+#include "chrome/browser/renderer_host/render_process_host.h"
 #include "chrome/common/gpu_messages.h"
 #include "chrome/gpu/gpu_thread.h"
 #include "chrome/gpu/gpu_view_x.h"
@@@@ -264,7 +265,7 @@@@ void GpuVideoLayerGLX::OnPaintToVideoLayer(base::ProcessId source_process_id,
       height <= 0 || height > kMaxVideoLayerSize)
     return;
 
-  TransportDIB* dib = TransportDIB::Map(id);
+  TransportDIB* dib = RenderProcessHost::FromID(source_process_id)->GetTransportDIB(id);
   if (!dib)
     return;
 
diff --git a/chrome/gpu/x_util.h b/chrome/gpu/x_util.h
index 512b232..c201e07 100644
--- chrome/gpu/x_util.h
+++ chrome/gpu/x_util.h
@@@@ -11,7 +11,7 @@@@
 #include "build/build_config.h"
 #include "chrome/gpu/gpu_config.h"
 
-#if defined(OS_LINUX)
+#if defined(USE_X11)
 
 // Forward declares ------------------------------------------------------------
 //
@@@@ -41,6 +41,6 @@@@ class ScopedPtrXFree {
   void operator()(void* x) const;
 };
 
-#endif  // OS_LINUX
+#endif  // USE_X11
 
 #endif  // CHROME_GPU_X_UTIL_H_
diff --git a/chrome/plugin/plugin_main_linux.cc b/chrome/plugin/plugin_main_linux.cc
index 6bb9da7..27f7996 100644
--- chrome/plugin/plugin_main_linux.cc
+++ chrome/plugin/plugin_main_linux.cc
@@@@ -11,7 +11,7 @@@@
 #include "build/build_config.h"
 
 // This whole file is only useful on 64-bit architectures.
-#if defined(ARCH_CPU_64_BITS)
+#if defined(ARCH_CPU_64_BITS) && !defined(OS_FREEBSD)
 
 namespace {
 
diff --git a/chrome/plugin/plugin_thread.cc b/chrome/plugin/plugin_thread.cc
index 1ae410e..84375a6 100644
--- chrome/plugin/plugin_thread.cc
+++ chrome/plugin/plugin_thread.cc
@@@@ -6,7 +6,7 @@@@
 
 #include "build/build_config.h"
 
-#if defined(USE_X11)
+#if defined(TOOLKIT_USES_GTK)
 #include <gtk/gtk.h>
 #elif defined(OS_MACOSX)
 #include <CoreFoundation/CoreFoundation.h>
@@@@ -52,7 +52,7 @@@@ PluginThread::PluginThread()
           switches::kPluginPath);
 
   lazy_tls.Pointer()->Set(this);
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_GTK)
   {
     // XEmbed plugins assume they are hosted in a Gtk application, so we need
     // to initialize Gtk in the plugin process.
diff --git a/chrome/renderer/mock_render_thread.cc b/chrome/renderer/mock_render_thread.cc
index 57e9d80..e1e3b22 100644
--- chrome/renderer/mock_render_thread.cc
+++ chrome/renderer/mock_render_thread.cc
@@@@ -105,7 +105,7 @@@@ void MockRenderThread::OnMessageReceived(const IPC::Message& msg) {
     IPC_MESSAGE_HANDLER(ViewHostMsg_AllocatePDFTransport,
                         OnAllocatePDFTransport)
 #endif
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
     IPC_MESSAGE_HANDLER(ViewHostMsg_AllocateTempFileForPrinting,
                         OnAllocateTempFileForPrinting)
     IPC_MESSAGE_HANDLER(ViewHostMsg_TempFileForPrintingWritten,
@@@@ -154,7 +154,7 @@@@ void MockRenderThread::OnAllocatePDFTransport(
 }
 #endif
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
 void MockRenderThread::OnAllocateTempFileForPrinting(
     base::FileDescriptor* renderer_fd,
     int* browser_fd) {
diff --git a/chrome/renderer/mock_render_thread.h b/chrome/renderer/mock_render_thread.h
index c297cb8..b69a369 100644
--- chrome/renderer/mock_render_thread.h
+++ chrome/renderer/mock_render_thread.h
@@@@ -101,7 +101,7 @@@@ class MockRenderThread : public RenderThreadBase {
                               base::SharedMemoryHandle* handle);
 #endif
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
   void OnAllocateTempFileForPrinting(base::FileDescriptor* renderer_fd,
                                      int* browser_fd);
   void OnTempFileForPrintingWritten(int browser_fd);
diff --git a/chrome/renderer/pepper_scrollbar_widget.h b/chrome/renderer/pepper_scrollbar_widget.h
index ac36f5e..3d9be56 100644
--- chrome/renderer/pepper_scrollbar_widget.h
+++ chrome/renderer/pepper_scrollbar_widget.h
@@@@ -37,7 +37,7 @@@@ class PepperScrollbarWidget : public PepperWidget,
   virtual void getTickmarks(WebKit::WebScrollbar*,
                             WebKit::WebVector<WebKit::WebRect>*) const;
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
   static void SetScrollbarColors(unsigned inactive_color,
                                  unsigned active_color,
                                  unsigned track_color);
diff --git a/chrome/renderer/render_process_impl.cc b/chrome/renderer/render_process_impl.cc
index e610df9..c4155d0 100644
--- chrome/renderer/render_process_impl.cc
+++ chrome/renderer/render_process_impl.cc
@@@@ -225,7 +225,7 @@@@ TransportDIB* RenderProcessImpl::CreateTransportDIB(size_t size) {
 #if defined(OS_WIN) || defined(OS_LINUX)
   // Windows and Linux create transport DIBs inside the renderer
   return TransportDIB::Create(size, transport_dib_next_sequence_number_++);
-#elif defined(OS_MACOSX)  // defined(OS_WIN) || defined(OS_LINUX)
+#elif defined(OS_MACOSX) || defined(OS_FREEBSD) // defined(OS_WIN) || defined(OS_NIX)
   // Mac creates transport DIBs in the browser, so we need to do a sync IPC to
   // get one.  The TransportDIB is cached in the browser.
   TransportDIB::Handle handle;
@@@@ -242,7 +242,7 @@@@ void RenderProcessImpl::FreeTransportDIB(TransportDIB* dib) {
   if (!dib)
     return;
 
-#if defined(OS_MACOSX)
+#if defined(OS_MACOSX) || defined(OS_FREEBSD)
   // On Mac we need to tell the browser that it can drop a reference to the
   // shared memory.
   IPC::Message* msg = new ViewHostMsg_FreeTransportDIB(dib->id());
@@@@ -260,7 +260,7 @@@@ skia::PlatformCanvas* RenderProcessImpl::GetDrawingCanvas(
   int width = rect.width();
   int height = rect.height();
   const size_t stride = skia::PlatformCanvas::StrideForWidth(rect.width());
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
   const size_t max_size = base::SysInfo::MaxSharedMemorySize();
 #else
   const size_t max_size = 0;
diff --git a/chrome/renderer/render_thread.cc b/chrome/renderer/render_thread.cc
index 3573488..e662023 100644
--- chrome/renderer/render_thread.cc
+++ chrome/renderer/render_thread.cc
@@@@ -901,7 +901,7 @@@@ void RenderThread::EnsureWebKitInitialized() {
 }
 
 void RenderThread::IdleHandler() {
-#if (defined(OS_WIN) || defined(OS_LINUX)) && defined(USE_TCMALLOC)
+#if !defined(OS_MACOSX) && defined(USE_TCMALLOC)
   MallocExtension::instance()->ReleaseFreeMemory();
 #endif
 
@@@@ -977,7 +977,7 @@@@ void RenderThread::OnPurgeMemory() {
   while (!v8::V8::IdleNotification()) {
   }
 
-#if (defined(OS_WIN) || defined(OS_LINUX)) && defined(USE_TCMALLOC)
+#if !defined(OS_MACOSX) && defined(USE_TCMALLOC)
   // Tell tcmalloc to release any free pages it's still holding.
   MallocExtension::instance()->ReleaseFreeMemory();
 #endif
diff --git a/chrome/renderer/render_view.h b/chrome/renderer/render_view.h
index 25ef1e6..fe8feba 100644
--- chrome/renderer/render_view.h
+++ chrome/renderer/render_view.h
@@@@ -961,7 +961,7 @@@@ class RenderView : public RenderWidget,
   // periodic timer so we don't send too many messages.
   void SyncNavigationState();
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
   void UpdateFontRenderingFromRendererPrefs();
 #else
   void UpdateFontRenderingFromRendererPrefs() {}
diff --git a/chrome/renderer/renderer_glue.cc b/chrome/renderer/renderer_glue.cc
index 849565a..8930fc2 100644
--- chrome/renderer/renderer_glue.cc
+++ chrome/renderer/renderer_glue.cc
@@@@ -39,7 +39,7 @@@@
 
 #if defined(OS_WIN)
 #include <strsafe.h>  // note: per msdn docs, this must *follow* other includes
-#elif defined(OS_LINUX)
+#elif defined(OS_NIX)
 #include "chrome/renderer/renderer_sandbox_support_linux.h"
 #endif
 
@@@@ -313,7 +313,7 @@@@ bool IsSingleProcess() {
   return CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess);
 }
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
 int MatchFontWithFallback(const std::string& face, bool bold,
                           bool italic, int charset) {
   return renderer_sandbox_support::MatchFontWithFallback(
diff --git a/chrome/renderer/renderer_main.cc b/chrome/renderer/renderer_main.cc
index f521e11..95982a7 100644
--- chrome/renderer/renderer_main.cc
+++ chrome/renderer/renderer_main.cc
@@@@ -267,7 +267,7 @@@@ int RendererMain(const MainFunctionParams& parameters) {
   PepperPluginRegistry::GetInstance();
 
   {
-#if !defined(OS_LINUX)
+#if !defined(OS_NIX)
     // TODO(markus): Check if it is OK to unconditionally move this
     // instruction down.
     RenderProcessImpl render_process;
@@@@ -277,7 +277,7 @@@@ int RendererMain(const MainFunctionParams& parameters) {
     if (!no_sandbox) {
       run_loop = platform.EnableSandbox();
     }
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
     RenderProcessImpl render_process;
     render_process.set_main_thread(new RenderThread());
 #endif
diff --git a/chrome/renderer/renderer_main_platform_delegate_linux.cc b/chrome/renderer/renderer_main_platform_delegate_linux.cc
index 98b0aca..ca7df2e 100644
--- chrome/renderer/renderer_main_platform_delegate_linux.cc
+++ chrome/renderer/renderer_main_platform_delegate_linux.cc
@@@@ -36,7 +36,7 @@@@ bool RendererMainPlatformDelegate::EnableSandbox() {
   //
   // The seccomp sandbox is started in the renderer.
   // http://code.google.com/p/seccompsandbox/
-#if defined(ARCH_CPU_X86_FAMILY) && !defined(CHROMIUM_SELINUX)
+#if defined(OS_LINUX) && defined(ARCH_CPU_X86_FAMILY) && !defined(CHROMIUM_SELINUX)
   // N.b. SupportsSeccompSandbox() returns a cached result, as we already
   // called it earlier in the zygote. Thus, it is OK for us to not pass in
   // a file descriptor for "/proc".
diff --git a/chrome/renderer/renderer_webkitclient_impl.cc b/chrome/renderer/renderer_webkitclient_impl.cc
index 27329ee..0bdbcdf 100644
--- chrome/renderer/renderer_webkitclient_impl.cc
+++ chrome/renderer/renderer_webkitclient_impl.cc
@@@@ -42,7 +42,7 @@@@
 #include "chrome/common/font_loader_mac.h"
 #endif
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
 #include "chrome/renderer/renderer_sandbox_support_linux.h"
 #endif
 
@@@@ -311,7 +311,7 @@@@ bool RendererWebKitClientImpl::SandboxSupport::ensureFontLoaded(HFONT font) {
   return RenderThread::current()->Send(new ViewHostMsg_PreCacheFont(logfont));
 }
 
-#elif defined(OS_LINUX)
+#elif defined(OS_NIX)
 
 WebString RendererWebKitClientImpl::SandboxSupport::getFontFamilyForCharacters(
     const WebKit::WebUChar* characters, size_t num_characters) {
diff --git a/chrome/renderer/renderer_webkitclient_impl.h b/chrome/renderer/renderer_webkitclient_impl.h
index 86fdf1f..8c1e874 100644
--- chrome/renderer/renderer_webkitclient_impl.h
+++ chrome/renderer/renderer_webkitclient_impl.h
@@@@ -15,7 +15,7 @@@@
 
 #if defined(OS_WIN)
 #include "third_party/WebKit/WebKit/chromium/public/win/WebSandboxSupport.h"
-#elif defined(OS_LINUX)
+#elif defined(OS_NIX)
 #include <string>
 #include <map>
 #include "base/lock.h"
@@@@ -99,7 +99,7 @@@@ class RendererWebKitClientImpl : public webkit_glue::WebKitClientImpl {
    public:
     virtual bool ensureFontLoaded(HFONT);
   };
-#elif defined(OS_LINUX)
+#elif defined(OS_NIX)
   class SandboxSupport : public WebKit::WebSandboxSupport {
    public:
     virtual WebKit::WebString getFontFamilyForCharacters(
diff --git a/chrome/renderer/webplugin_delegate_pepper.cc b/chrome/renderer/webplugin_delegate_pepper.cc
index 58f1a23..64bfaa4 100644
--- chrome/renderer/webplugin_delegate_pepper.cc
+++ chrome/renderer/webplugin_delegate_pepper.cc
@@@@ -9,7 +9,7 @@@@
 #include <string>
 #include <vector>
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
 #include <unistd.h>
 #endif
 
@@@@ -33,7 +33,7 @@@@
 #include "chrome/common/render_messages.h"
 #include "chrome/renderer/pepper_widget.h"
 #include "chrome/renderer/render_thread.h"
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
 #include "chrome/renderer/renderer_sandbox_support_linux.h"
 #endif
 #include "chrome/renderer/webplugin_delegate_proxy.h"
@@@@ -455,7 +455,7 @@@@ bool WebPluginDelegatePepper::SetCursor(NPCursorType type) {
 NPError NPMatchFontWithFallback(NPP instance,
                                 const NPFontDescription* description,
                                 NPFontID* id) {
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
   int fd = renderer_sandbox_support::MatchFontWithFallback(
       description->face, description->weight >= 700, description->italic,
       description->charset);
@@@@ -474,7 +474,7 @@@@ NPError GetFontTable(NPP instance,
                      uint32_t table,
                      void* output,
                      size_t* output_length) {
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
   bool rv = renderer_sandbox_support::GetFontTable(
       id, table, static_cast<uint8_t*>(output), output_length);
   return rv ? NPERR_NO_ERROR : NPERR_GENERIC_ERROR;
@@@@ -485,7 +485,7 @@@@ NPError GetFontTable(NPP instance,
 }
 
 NPError NPDestroyFont(NPP instance, NPFontID id) {
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
   close(id);
   return NPERR_NO_ERROR;
 #else
@@@@ -1158,10 +1158,10 @@@@ int WebPluginDelegatePepper::PrintBegin(const gfx::Rect& printable_area,
       current_printer_dpi_ = printer_dpi;
     }
   }
-#if defined (OS_LINUX)
+#if defined (OS_NIX)
   num_pages_ = num_pages;
   pdf_output_done_ = false;
-#endif  // (OS_LINUX)
+#endif  // (OS_NIX)
   return num_pages;
 }
 
@@@@ -1187,7 +1187,7 @@@@ bool WebPluginDelegatePepper::VectorPrintPage(int page_number,
   unsigned char* pdf_output = NULL;
   int32 output_size = 0;
   NPPrintPageNumberRange page_range;
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
   // On Linux we will try and output all pages as PDF in the first call to
   // PrintPage. This is a temporary hack.
   // TODO(sanjeevr): Remove this hack and fix this by changing the print
@@@@ -1196,9 +1196,9 @@@@ bool WebPluginDelegatePepper::VectorPrintPage(int page_number,
     return pdf_output_done_;
   page_range.firstPageNumber = 0;
   page_range.lastPageNumber = num_pages_ - 1;
-#else  // defined(OS_LINUX)
+#else  // defined(OS_NIX)
   page_range.firstPageNumber = page_range.lastPageNumber = page_number;
-#endif  // defined(OS_LINUX)
+#endif  // defined(OS_NIX)
   NPError err = print_extensions->printPagesAsPDF(instance()->npp(),
                                                   &page_range, 1,
                                                   &pdf_output, &output_size);
@@@@ -1206,7 +1206,7 @@@@ bool WebPluginDelegatePepper::VectorPrintPage(int page_number,
     return false;
 
   bool ret = false;
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
   // On Linux we need to get the backing PdfPsMetafile and write the bits
   // directly.
   cairo_t* context = canvas->beginPlatformPaint();
@@@@ -1359,10 +1359,10 @@@@ void WebPluginDelegatePepper::PrintEnd() {
   current_printer_dpi_ = -1;
 #if defined(OS_MACOSX)
   last_printed_page_ = SkBitmap();
-#elif defined(OS_LINUX)
+#elif defined(OS_NIX)
   num_pages_ = 0;
   pdf_output_done_ = false;
-#endif  // defined(OS_LINUX)
+#endif  // defined(OS_NIX)
 }
 
 WebPluginDelegatePepper::WebPluginDelegatePepper(
@@@@ -1373,10 +1373,10 @@@@ WebPluginDelegatePepper::WebPluginDelegatePepper(
       instance_(instance),
       nested_delegate_(NULL),
       current_printer_dpi_(-1),
-#if defined (OS_LINUX)
+#if defined (OS_NIX)
       num_pages_(0),
       pdf_output_done_(false),
-#endif  // (OS_LINUX)
+#endif  // (OS_NIX)
 #if defined(ENABLE_GPU)
       command_buffer_(NULL),
 #endif
diff --git a/chrome/renderer/webplugin_delegate_pepper.h b/chrome/renderer/webplugin_delegate_pepper.h
index be9c1ce..e38a3d7 100644
--- chrome/renderer/webplugin_delegate_pepper.h
+++ chrome/renderer/webplugin_delegate_pepper.h
@@@@ -305,7 +305,7 @@@@ class WebPluginDelegatePepper : public webkit_glue::WebPluginDelegate,
   // variable to hold on to the pixels.
   SkBitmap last_printed_page_;
 #endif   // defined(OS_MACOSX)
-#if defined (OS_LINUX)
+#if defined (OS_NIX)
   // On Linux, we always send all pages from the renderer to the browser.
   // So, if the plugin supports printPagesAsPDF we print the entire output
   // in one shot in the first call to PrintPage.
@@@@ -316,7 +316,7 @@@@ class WebPluginDelegatePepper : public webkit_glue::WebPluginDelegate,
   // Specifies whether we have already output all pages. This is used to ignore
   // subsequent PrintPage requests.
   bool pdf_output_done_;
-#endif   // defined(OS_LINUX)
+#endif   // defined(OS_NIX)
 
 #if defined(ENABLE_GPU)
   // The command buffer used to issue commands to the nested GPU plugin.
diff --git a/chrome/service/service_process.cc b/chrome/service/service_process.cc
index 408be65..973ccf8 100644
--- chrome/service/service_process.cc
+++ chrome/service/service_process.cc
@@@@ -17,7 +17,7 @@@@
 #if defined(OS_WIN)
 #include "remoting/host/capturer_gdi.h"
 #include "remoting/host/event_executor_win.h"
-#elif defined(OS_LINUX)
+#elif defined(OS_NIX)
 #include "remoting/host/capturer_linux.h"
 #include "remoting/host/event_executor_linux.h"
 #elif defined(OS_MACOSX)
@@@@ -78,7 +78,7 @@@@ remoting::ChromotingHost* ServiceProcess::CreateChromotingHost(
 #if defined(OS_WIN)
   capturer.reset(new remoting::CapturerGdi());
   executor.reset(new remoting::EventExecutorWin());
-#elif defined(OS_LINUX)
+#elif defined(OS_NIX)
   capturer.reset(new remoting::CapturerLinux());
   executor.reset(new remoting::EventExecutorLinux());
 #elif defined(OS_MACOSX)
diff --git a/chrome/test/automation/automation_proxy_uitest.cc b/chrome/test/automation/automation_proxy_uitest.cc
index bace790..88b40bf 100644
--- chrome/test/automation/automation_proxy_uitest.cc
+++ chrome/test/automation/automation_proxy_uitest.cc
@@@@ -1306,7 +1306,7 @@@@ TEST_F(ExternalTabUITestPopupEnabled, UserGestureTargetBlank) {
 #endif  // defined(OS_WIN)
 
 // TODO(port): Need to port autocomplete_edit_proxy.* first.
-#if defined(OS_WIN) || defined(OS_LINUX)
+#if defined(OS_WIN) || defined(OS_NIX)
 TEST_F(AutomationProxyTest, AutocompleteGetSetText) {
   scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
   ASSERT_TRUE(browser.get());
@@@@ -1350,7 +1350,7 @@@@ TEST_F(AutomationProxyTest, AutocompleteParallelProxy) {
   EXPECT_EQ(text_to_set2, actual_text2);
 }
 
-#endif  // defined(OS_WIN) || defined(OS_LINUX)
+#endif  // defined(OS_WIN) || defined(OS_NIX)
 
 #if defined(OS_MACOSX)
 // TODO(port): Implement AutocompleteEditProxy on Mac.
diff --git a/chrome/test/chrome_process_util.cc b/chrome/test/chrome_process_util.cc
index a3c4d6f..d76886e 100644
--- chrome/test/chrome_process_util.cc
+++ chrome/test/chrome_process_util.cc
@@@@ -79,7 +79,7 @@@@ ChromeProcessList GetRunningChromeProcesses(base::ProcessId browser_pid) {
     result.push_back(process_entry->pid());
   }
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
   // On Linux we might be running with a zygote process for the renderers.
   // Because of that we sweep the list of processes again and pick those which
   // are children of one of the processes that we've already seen.
@@@@ -90,9 +90,9 @@@@ ChromeProcessList GetRunningChromeProcesses(base::ProcessId browser_pid) {
     while (const base::ProcessEntry* process_entry = it.NextProcessEntry())
       result.push_back(process_entry->pid());
   }
-#endif  // defined(OS_LINUX)
+#endif  // defined(OS_NIX)
 
-#if defined(OS_LINUX) || defined(OS_MACOSX)
+#if defined(OS_POSIX)
   // On Mac OS X we run the subprocesses with a different bundle, and
   // on Linux via /proc/self/exe, so they end up with a different
   // name.  We must collect them in a second pass.
diff --git a/chrome/test/in_process_browser_test.cc b/chrome/test/in_process_browser_test.cc
index 438a34c..5eb3588 100644
--- chrome/test/in_process_browser_test.cc
+++ chrome/test/in_process_browser_test.cc
@@@@ -38,7 +38,7 @@@@
 #include "net/base/mock_host_resolver.h"
 #include "sandbox/src/dep.h"
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
 #include "base/singleton.h"
 #include "chrome/browser/renderer_host/render_sandbox_host_linux.h"
 #include "chrome/browser/zygote_host_linux.h"
@@@@ -213,7 +213,7 @@@@ void InProcessBrowserTest::SetUp() {
 #endif
   CHECK(PathService::Override(base::FILE_EXE, chrome_path));
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
   // Initialize the RenderSandbox and Zygote hosts. Apparently they get used
   // for InProcessBrowserTest, and this is not the normal browser startup path.
   Singleton<LinuxHostInit>::get();
diff --git a/chrome/test/interactive_ui/interactive_ui_tests.gypi b/chrome/test/interactive_ui/interactive_ui_tests.gypi
index 2da3179..7ad785e 100644
--- chrome/test/interactive_ui/interactive_ui_tests.gypi
+++ chrome/test/interactive_ui/interactive_ui_tests.gypi
@@@@ -52,7 +52,7 @@@@
     '<(DEPTH)/chrome/test/unit/chrome_test_suite.h',
   ],
   'conditions': [
-    ['OS=="linux"', {
+    ['OS=="linux" or OS=="freebsd"', {
       'dependencies': [
         '<(DEPTH)/build/linux/system.gyp:gtk',
         '<(DEPTH)/build/linux/system.gyp:nss',
diff --git a/chrome/test/page_cycler/page_cycler_test.cc b/chrome/test/page_cycler/page_cycler_test.cc
index 1f5b49a..6aac289 100644
--- chrome/test/page_cycler/page_cycler_test.cc
+++ chrome/test/page_cycler/page_cycler_test.cc
@@@@ -286,7 +286,7 @@@@ class PageCyclerReferenceTest : public PageCyclerTest {
     dir = dir.AppendASCII("reference_build");
 #if defined(OS_WIN)
     dir = dir.AppendASCII("chrome");
-#elif defined(OS_LINUX)
+#elif defined(OS_NIX)
     dir = dir.AppendASCII("chrome_linux");
 #elif defined(OS_MACOSX)
     dir = dir.AppendASCII("chrome_mac");
diff --git a/chrome/test/reliability/page_load_test.cc b/chrome/test/reliability/page_load_test.cc
index e39d342..ce3bcf5 100644
--- chrome/test/reliability/page_load_test.cc
+++ chrome/test/reliability/page_load_test.cc
@@@@ -162,7 +162,7 @@@@ class PageLoadTest : public UITest {
     scoped_ptr<FileVersionInfo> file_info;
 #if defined(OS_WIN)
     file_info.reset(FileVersionInfo::CreateFileVersionInfo(kChromeDll));
-#elif defined(OS_LINUX) || defined(OS_MACOSX)
+#elif defined(OS_POSIX)
     // TODO(fmeawad): On Mac, the version retrieved here belongs to the test
     // module and not the chrome binary, need to be changed to chrome binary
     // instead.
diff --git a/chrome/test/startup/feature_startup_test.cc b/chrome/test/startup/feature_startup_test.cc
index df68386..f39143e 100644
--- chrome/test/startup/feature_startup_test.cc
+++ chrome/test/startup/feature_startup_test.cc
@@@@ -192,7 +192,7 @@@@ TEST_F(NewTabUIStartupTest, NewTabTimingTestsCold) {
   RunNewTabTimingTest();
 }
 
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_GTK)
 TEST_F(NewTabUIStartupTest, GtkThemeCold) {
   RunStartupTest("tab_gtk_theme_cold", false /* cold */,
                  false /* not important */,
diff --git a/chrome/test/startup/startup_test.cc b/chrome/test/startup/startup_test.cc
index 7f6f47f..73055ee 100644
--- chrome/test/startup/startup_test.cc
+++ chrome/test/startup/startup_test.cc
@@@@ -389,7 +389,7 @@@@ TEST_F(StartupTest, PerfComplexTheme) {
                  UITest::COMPLEX_THEME, 0, 0);
 }
 
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_USES_GTK)
 TEST_F(StartupTest, PerfGtkTheme) {
   RunStartupTest("warm", "gtk-theme", WARM, NOT_IMPORTANT,
                  UITest::NATIVE_THEME, 0, 0);
diff --git a/chrome/test/testing_browser_process.h b/chrome/test/testing_browser_process.h
index c69af1c..974cb0a 100644
--- chrome/test/testing_browser_process.h
+++ chrome/test/testing_browser_process.h
@@@@ -48,7 +48,7 @@@@ class TestingBrowserProcess : public BrowserProcess {
     return NULL;
   }
 
-#if defined(OS_LINUX)
+#if defined(USE_X11)
   virtual base::Thread* background_x11_thread() {
     return NULL;
   }
diff --git a/chrome/test/testing_profile.cc b/chrome/test/testing_profile.cc
index 60e423a..2805b7b 100644
--- chrome/test/testing_profile.cc
+++ chrome/test/testing_profile.cc
@@@@ -22,7 +22,7 @@@@
 #include "testing/gmock/include/gmock/gmock.h"
 #include "webkit/database/database_tracker.h"
 
-#if defined(OS_LINUX) && !defined(TOOLKIT_VIEWS)
+#if defined(TOOLKIT_GTK) && !defined(TOOLKIT_VIEWS)
 #include "chrome/browser/gtk/gtk_theme_provider.h"
 #endif
 
@@@@ -295,7 +295,7 @@@@ webkit_database::DatabaseTracker* TestingProfile::GetDatabaseTracker() {
 
 void TestingProfile::InitThemes() {
   if (!created_theme_provider_) {
-#if defined(OS_LINUX) && !defined(TOOLKIT_VIEWS)
+#if defined(TOOLKIT_GTK) && !defined(TOOLKIT_VIEWS)
     theme_provider_.reset(new GtkThemeProvider);
 #else
     theme_provider_.reset(new BrowserThemeProvider);
diff --git a/chrome/test/ui/history_uitest.cc b/chrome/test/ui/history_uitest.cc
index 45e0983..9310407 100644
--- chrome/test/ui/history_uitest.cc
+++ chrome/test/ui/history_uitest.cc
@@@@ -116,7 +116,7 @@@@ TEST_F(HistoryTester, ConsiderRedirectAfterGestureAsUserInitiated) {
   WaitForFinish("History_Length_Test_12", "1", url, kTestCompleteCookie,
                 kTestCompleteSuccess, action_max_timeout_ms());
 }
-#endif  // defined(OS_WIN) || defined(OS_LINUX)
+#endif  // defined(OS_WIN) || defined(OS_NIX)
 
 TEST_F(HistoryTester, ConsiderSlowRedirectAsUserInitiated) {
   // Test the history length for the following page transition.
diff --git a/chrome/test/ui/sunspider_uitest.cc b/chrome/test/ui/sunspider_uitest.cc
index 1c4f484..b544407 100644
--- chrome/test/ui/sunspider_uitest.cc
+++ chrome/test/ui/sunspider_uitest.cc
@@@@ -128,7 +128,7 @@@@ class SunSpiderReferenceTest : public SunSpiderTest {
     dir = dir.AppendASCII("reference_build");
 #if defined(OS_WIN)
     dir = dir.AppendASCII("chrome");
-#elif defined(OS_LINUX)
+#elif defined(OS_NIX)
     dir = dir.AppendASCII("chrome_linux");
 #elif defined(OS_MACOSX)
     dir = dir.AppendASCII("chrome_mac");
diff --git a/chrome/test/ui/ui_layout_test.cc b/chrome/test/ui/ui_layout_test.cc
index 6c5415f..2472bda 100644
--- chrome/test/ui/ui_layout_test.cc
+++ chrome/test/ui/ui_layout_test.cc
@@@@ -18,7 +18,7 @@@@
 static const char kPlatformName[] = "chromium-win";
 #elif defined(OS_MACOSX)
 static const char kPlatformName[] = "chromium-mac";
-#elif defined(OS_LINUX)
+#elif defined(OS_NIX)
 static const char kPlatformName[] = "chromium-linux";
 #else
 #error No known OS defined
diff --git a/chrome/test/ui/ui_test.cc b/chrome/test/ui/ui_test.cc
index 90e1550..efc3f00 100644
--- chrome/test/ui/ui_test.cc
+++ chrome/test/ui/ui_test.cc
@@@@ -66,7 +66,7 @@@@ const wchar_t UITestBase::kFailedNoCrashService[] =
     L"NOTE: This test is expected to fail if crash_service.exe is not "
     L"running. Start it manually before running this test (see the build "
     L"output directory).";
-#elif defined(OS_LINUX)
+#elif defined(OS_NIX)
     L"NOTE: This test is expected to fail if breakpad is not built in "
     L"or if chromium is not running headless (try CHROME_HEADLESS=1).";
 #else
@@@@ -1460,7 +1460,7 @@@@ void UITestBase::PrintMemoryUsageInfo(const char* test_name) {
   PrintResult("ws_final_t", "", "ws_f_t" + trace_name,
               total_working_set_size, "bytes",
               false /* not important */);
-#elif defined(OS_LINUX) || defined(OS_MACOSX)
+#elif defined(OS_POSIX)
   PrintResult("vm_size_final_b", "", "vm_size_f_b" + trace_name,
               browser_virtual_size, "bytes",
               true /* important */);
diff --git a/chrome/test/ui/v8_benchmark_uitest.cc b/chrome/test/ui/v8_benchmark_uitest.cc
index b020af1..ba8c221 100644
--- chrome/test/ui/v8_benchmark_uitest.cc
+++ chrome/test/ui/v8_benchmark_uitest.cc
@@@@ -130,7 +130,7 @@@@ class V8BenchmarkReferenceTest : public V8BenchmarkTest {
     dir = dir.AppendASCII("reference_build");
 #if defined(OS_WIN)
     dir = dir.AppendASCII("chrome");
-#elif defined(OS_LINUX)
+#elif defined(OS_NIX)
     dir = dir.AppendASCII("chrome_linux");
 #elif defined(OS_MACOSX)
     dir = dir.AppendASCII("chrome_mac");
diff --git a/chrome/test/ui_test_utils.cc b/chrome/test/ui_test_utils.cc
index c464229..214652e 100644
--- chrome/test/ui_test_utils.cc
+++ chrome/test/ui_test_utils.cc
@@@@ -307,7 +307,7 @@@@ void RunMessageLoop() {
 #if defined(TOOLKIT_VIEWS)
   views::AcceleratorHandler handler;
   loop->Run(&handler);
-#elif defined(OS_LINUX)
+#elif defined(OS_NIX)
   loop->Run(NULL);
 #else
   loop->Run();
diff --git a/chrome/test/url_fetch_test/url_fetch_test.cc b/chrome/test/url_fetch_test/url_fetch_test.cc
index ec87c76..3246efd 100644
--- chrome/test/url_fetch_test/url_fetch_test.cc
+++ chrome/test/url_fetch_test/url_fetch_test.cc
@@@@ -34,7 +34,7 @@@@ class UrlFetchTest : public UITest {
       dir = dir.AppendASCII("reference_build");
 #if defined(OS_WIN)
       dir = dir.AppendASCII("chrome");
-#elif defined(OS_LINUX)
+#elif defined(OS_NIX)
       dir = dir.AppendASCII("chrome_linux");
 #elif defined(OS_MACOSX)
       dir = dir.AppendASCII("chrome_mac");
diff --git a/chrome/tools/build/linux/sed.sh b/chrome/tools/build/linux/sed.sh
index 22615cb..bc59956 100755
--- chrome/tools/build/linux/sed.sh
+++ chrome/tools/build/linux/sed.sh
@@@@ -1,4 +1,4 @@@@
-#!/bin/bash
+#!/usr/bin/env bash
 
 # Copyright (c) 2009 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
diff --git a/chrome/worker/worker_uitest.cc b/chrome/worker/worker_uitest.cc
index 061c3f2..84a04a1 100644
--- chrome/worker/worker_uitest.cc
+++ chrome/worker/worker_uitest.cc
@@@@ -84,7 +84,7 @@@@ class WorkerTest : public UILayoutTest {
     // The 1 is for the browser process.
     int number_of_processes = 1 + workers +
         (UITest::in_process_renderer() ? 0 : tabs);
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
     // On Linux, we also have a zygote process and a sandbox host process.
     number_of_processes += 2;
 #endif
diff --git a/gpu/demos/demos.gyp b/gpu/demos/demos.gyp
index a7ba2b9..2598548 100644
--- gpu/demos/demos.gyp
+++ gpu/demos/demos.gyp
@@@@ -11,7 +11,7 @@@@
       # also be compiled with -fPIC flag. Setting GYP_DEFINES="linux_fpic=1"
       # compiles everything with -fPIC. Disable pepper demos on linux/x64
       # unless linux_fpic is 1.
-      ['OS=="linux" and (target_arch=="x64" or target_arch=="arm") and linux_fpic!=1', {
+      ['(OS=="linux" or OS=="freebsd") and (target_arch=="x64" or target_arch=="arm") and linux_fpic!=1', {
         'enable_pepper_demos%': 0,
       }, {
         'enable_pepper_demos%': 1,
@@@@ -48,7 +48,7 @@@@
         'framework/window.h',
       ],
       'conditions': [
-        ['OS=="linux"', {
+        ['OS=="linux" or OS=="freebsd"', {
           'dependencies': ['../../build/linux/system.gyp:gtk'],
         }],
       ],
@@@@ -103,7 +103,7 @@@@
               'framework/plugin.rc',
             ],
           }],
-          ['OS=="linux"', {
+          ['OS=="linux" or OS=="freebsd"', {
             # -gstabs, used in the official builds, causes an ICE. Remove it.
             'cflags!': ['-gstabs'],
           }],
diff --git a/gpu/demos/framework/main_exe.cc b/gpu/demos/framework/main_exe.cc
index bc42e6c..d1e1916 100644
--- gpu/demos/framework/main_exe.cc
+++ gpu/demos/framework/main_exe.cc
@@@@ -6,9 +6,9 @@@@
 #include "base/logging.h"
 #include "gpu/demos/framework/window.h"
 
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_USES_GTK)
 #include <gtk/gtk.h>
-#endif  // OS_LINUX
+#endif  // TOOLKIT_USES_GTK
 
 namespace {
 static const int kWindowWidth = 512;
@@@@ -16,9 +16,9 @@@@ static const int kWindowHeight = 512;
 }  // namespace.
 
 int main(int argc, char *argv[]) {
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_USES_GTK)
   gtk_init(&argc, &argv);
-#endif  // OS_LINUX
+#endif  // TOOLKIT_USES_GTK
 
   // AtExitManager is used by singleton classes to delete themselves when
   // the program terminates.
diff --git a/gpu/demos/framework/main_pepper.cc b/gpu/demos/framework/main_pepper.cc
index 887c853..108e645 100644
--- gpu/demos/framework/main_pepper.cc
+++ gpu/demos/framework/main_pepper.cc
@@@@ -106,7 +106,7 @@@@ NPError NPP_GetValue(NPP instance, NPPVariable variable, void* value) {
   NPError err = NPERR_NO_ERROR;
 
   switch (variable) {
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
     case NPPVpluginNameString:
       *(static_cast<const char**>(value)) = "Pepper GPU Demo";
       break;
@@@@ -163,17 +163,17 @@@@ EXPORT NPError API_CALL NP_GetEntryPoints(NPPluginFuncs* plugin_funcs) {
 }
 
 EXPORT NPError API_CALL NP_Initialize(NPNetscapeFuncs* browser_funcs
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
                                      , NPPluginFuncs* plugin_funcs
-#endif  // OS_LINUX
+#endif  // OS_NIX
                                      ) {
   g_at_exit_manager = new base::AtExitManager();
   gpu::demos::g_browser = browser_funcs;
   pglInitialize();
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
   NP_GetEntryPoints(plugin_funcs);
-#endif  // OS_LINUX
+#endif  // OS_NIX
   return NPERR_NO_ERROR;
 }
 
@@@@ -182,7 +182,7 @@@@ EXPORT void API_CALL NP_Shutdown() {
   delete g_at_exit_manager;
 }
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
 EXPORT NPError API_CALL NP_GetValue(NPP instance, NPPVariable variable,
                                     void* value) {
   return gpu::demos::NPP_GetValue(instance, variable, value);
@@@@ -191,5 +191,5 @@@@ EXPORT NPError API_CALL NP_GetValue(NPP instance, NPPVariable variable,
 EXPORT const char* API_CALL NP_GetMIMEDescription() {
   return "pepper-application/x-gpu-demo::Pepper GPU Demo";
 }
-#endif  // OS_LINUX
+#endif  // OS_NIX
 }  // extern "C"
diff --git a/gpu/gpu.gyp b/gpu/gpu.gyp
index 6c9a525..efc5751 100644
--- gpu/gpu.gyp
+++ gpu/gpu.gyp
@@@@ -179,7 +179,7 @@@@
         'command_buffer/service/texture_manager.cc',
       ],
       'conditions': [
-        ['OS == "linux"', {
+        ['OS == "linux" or OS=="freebsd"', {
           'dependencies': [
             '../build/linux/system.gyp:gtk',
           ],
diff --git a/ipc/ipc.gyp b/ipc/ipc.gyp
index 5560abe..c393ba8 100644
--- ipc/ipc.gyp
+++ ipc/ipc.gyp
@@@@ -58,7 +58,7 @@@@
             '../build/linux/system.gyp:gtk',
           ],
         }],
-        ['OS=="linux"', {
+        ['OS=="linux" or OS=="freebsd"', {
           'conditions': [
             ['linux_use_tcmalloc==1', {
               'dependencies': [
diff --git a/ipc/sync_socket_unittest.cc b/ipc/sync_socket_unittest.cc
index e07fdf9..b6e3372 100644
--- ipc/sync_socket_unittest.cc
+++ ipc/sync_socket_unittest.cc
@@@@ -8,9 +8,9 @@@@
 #include <sstream>
 
 #include "base/message_loop.h"
-#if defined(OS_LINUX) || defined(OS_MACOSX)
+#if defined(OS_POSIX)
 #include "base/file_descriptor_posix.h"
-#endif  // defined(OS_LINUX) || defined(OS_MACOSX)
+#endif  // defined(OS_POSIX)
 #include "base/platform_thread.h"
 #include "base/process_util.h"
 #include "base/sync_socket.h"
diff --git a/media/base/media_switches.cc b/media/base/media_switches.cc
index 3b684ce..cd64c80 100644
--- media/base/media_switches.cc
+++ media/base/media_switches.cc
@@@@ -6,7 +6,7 @@@@
 
 namespace switches {
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
 // The Alsa device to use when opening an audio stream.
 const char kAlsaDevice[] = "alsa-device";
 #endif
diff --git a/media/base/media_switches.h b/media/base/media_switches.h
index 6e0e0d3..69b264f 100644
--- media/base/media_switches.h
+++ media/base/media_switches.h
@@@@ -11,7 +11,7 @@@@
 
 namespace switches {
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
 extern const char kAlsaDevice[];
 #endif
 
diff --git a/media/media.gyp b/media/media.gyp
index 7ef2bae..9d92635 100644
--- media/media.gyp
+++ media/media.gyp
@@@@ -435,7 +435,6 @@@@
           ],
           'link_settings': {
             'libraries': [
-              '-ldl',
               '-lX11',
               '-lXrender',
               '-lXext',
diff --git a/net/base/host_resolver_impl.cc b/net/base/host_resolver_impl.cc
index ffba57f..f567569 100644
--- net/base/host_resolver_impl.cc
+++ net/base/host_resolver_impl.cc
@@@@ -133,13 +133,11 @@@@ class HostResolveFailedParams : public NetLog::EventParameters {
 std::vector<int> GetAllGetAddrinfoOSErrors() {
   int os_errors[] = {
 #if defined(OS_POSIX)
-    EAI_ADDRFAMILY,
     EAI_AGAIN,
     EAI_BADFLAGS,
     EAI_FAIL,
     EAI_FAMILY,
     EAI_MEMORY,
-    EAI_NODATA,
     EAI_NONAME,
     EAI_SERVICE,
     EAI_SOCKTYPE,
@@@@ -726,7 +724,7 @@@@ HostResolverImpl::HostResolverImpl(
 #if defined(OS_WIN)
   EnsureWinsockInit();
 #endif
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
   if (HaveOnlyLoopbackAddresses())
     additional_resolver_flags_ |= HOST_RESOLVER_LOOPBACK_ONLY;
 #endif
@@@@ -1059,7 +1057,7 @@@@ void HostResolverImpl::OnIPAddressChanged() {
     ipv6_probe_job_ = new IPv6ProbeJob(this);
     ipv6_probe_job_->Start();
   }
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
   if (HaveOnlyLoopbackAddresses()) {
     additional_resolver_flags_ |= HOST_RESOLVER_LOOPBACK_ONLY;
   } else {
diff --git a/net/base/host_resolver_proc.cc b/net/base/host_resolver_proc.cc
index 804135c..08669e9 100644
--- net/base/host_resolver_proc.cc
+++ net/base/host_resolver_proc.cc
@@@@ -6,10 +6,6 @@@@
 
 #include "build/build_config.h"
 
-#if defined(OS_POSIX) && !defined(OS_MACOSX)
-#include <resolv.h>
-#endif
-
 #include "base/logging.h"
 #include "base/time.h"
 #include "net/base/address_list.h"
@@@@ -17,6 +13,7 @@@@
 #include "net/base/sys_addrinfo.h"
 
 #if defined(OS_POSIX) && !defined(OS_MACOSX)
+#include <resolv.h>
 #include "base/singleton.h"
 #include "base/thread_local_storage.h"
 #endif
diff --git a/net/base/listen_socket_unittest.cc b/net/base/listen_socket_unittest.cc
index b38019d..38c0812 100644
--- net/base/listen_socket_unittest.cc
+++ net/base/listen_socket_unittest.cc
@@@@ -5,6 +5,7 @@@@
 #include "net/base/listen_socket_unittest.h"
 
 #include <fcntl.h>
+#include <netinet/in.h>
 
 #include "base/eintr_wrapper.h"
 #include "net/base/net_util.h"
diff --git a/net/base/net_util.cc b/net/base/net_util.cc
index c7b6a6f..166bcf7 100644
--- net/base/net_util.cc
+++ net/base/net_util.cc
@@@@ -24,9 +24,9 @@@@
 #include <fcntl.h>
 #include <ifaddrs.h>
 #include <netdb.h>
+#include <sys/socket.h>
 #include <net/if.h>
 #include <netinet/in.h>
-#include <sys/socket.h>
 #endif
 
 #include "base/base64.h"
diff --git a/net/base/network_change_notifier.cc b/net/base/network_change_notifier.cc
index a0bc6b5..7db2396 100644
--- net/base/network_change_notifier.cc
+++ net/base/network_change_notifier.cc
@@@@ -37,7 +37,6 @@@@ NetworkChangeNotifier* NetworkChangeNotifier::Create() {
 #elif defined(OS_MACOSX)
   return new NetworkChangeNotifierMac();
 #else
-  NOTIMPLEMENTED();
   return NULL;
 #endif
 }
diff --git a/net/net.gyp b/net/net.gyp
index 98dc526..7fdddc9 100644
--- net/net.gyp
+++ net/net.gyp
@@@@ -115,11 +115,9 @@@@
         'base/net_util_win.cc',
         'base/network_change_notifier.cc',
         'base/network_change_notifier.h',
-        'base/network_change_notifier_linux.cc',
         'base/network_change_notifier_linux.h',
         'base/network_change_notifier_mac.cc',
         'base/network_change_notifier_mac.h',
-        'base/network_change_notifier_netlink_linux.cc',
         'base/network_change_notifier_netlink_linux.h',
         'base/network_change_notifier_win.cc',
         'base/network_change_notifier_win.h',
@@@@ -579,6 +577,7 @@@@
           ],
         }],
         [ 'OS == "linux" or OS == "freebsd" or OS == "openbsd"', {
+            'sources!': [ 'proxy/proxy_config_service_linux.cc', ],
             'dependencies': [
               '../build/linux/system.gyp:gconf',
               '../build/linux/system.gyp:gdk',
@@@@ -742,7 +741,6 @@@@
         'proxy/mock_proxy_resolver.h',
         'proxy/multi_threaded_proxy_resolver_unittest.cc',
         'proxy/proxy_bypass_rules_unittest.cc',
-        'proxy/proxy_config_service_linux_unittest.cc',
         'proxy/proxy_config_service_win_unittest.cc',
         'proxy/proxy_config_unittest.cc',
         'proxy/proxy_list_unittest.cc',
@@@@ -795,7 +793,7 @@@@
             ],
           },
         ],
-        ['OS == "linux"', {
+        ['OS == "linux" or OS == "freebsd"', {
           'conditions': [
             ['linux_use_tcmalloc==1', {
               'dependencies': [
@@@@ -930,7 +928,7 @@@@
             '../build/linux/system.gyp:nss',
           ],
         }],
-        ['OS == "linux"', {
+        ['OS == "linux" or OS == "freebsd"', {
           'conditions': [
             ['linux_use_tcmalloc==1', {
               'dependencies': [
diff --git a/printing/printing.gyp b/printing/printing.gyp
index ec1872a..649e500 100644
--- printing/printing.gyp
+++ printing/printing.gyp
@@@@ -103,7 +103,7 @@@@
         'units_unittest.cc',
       ],
       'conditions': [
-        ['OS!="linux"', {'sources/': [['exclude', '_cairo_unittest\\.cc$']]}],
+        ['OS!="linux" and OS!="freebsd"', {'sources/': [['exclude', '_cairo_unittest\\.cc$']]}],
         ['OS!="mac"', {'sources/': [['exclude', '_mac_unittest\\.(cc|mm?)$']]}],
         ['OS!="win"', {'sources/': [['exclude', '_win_unittest\\.cc$']]
           }, {  # else: OS=="win"
@@@@ -114,14 +114,12 @@@@
             'dependencies': [
               '../build/linux/system.gyp:gtk',
            ],
-        }],
-        ['OS=="linux"', {
-          'conditions': [
-            ['linux_use_tcmalloc==1', {
+            'conditions': [
+              ['linux_use_tcmalloc==1', {
               'dependencies': [
                 '../base/allocator/allocator.gyp:allocator',
-              ],
-            }],
+                ],
+              }],
           ],
         }],
       ],
diff --git a/remoting/host/simple_host_process.cc b/remoting/host/simple_host_process.cc
index 035fa32..8efbd2b 100644
--- remoting/host/simple_host_process.cc
+++ remoting/host/simple_host_process.cc
@@@@ -34,7 +34,7 @@@@
 #if defined(OS_WIN)
 #include "remoting/host/capturer_gdi.h"
 #include "remoting/host/event_executor_win.h"
-#elif defined(OS_LINUX)
+#elif defined(OS_NIX)
 #include "remoting/host/capturer_linux.h"
 #include "remoting/host/event_executor_linux.h"
 #elif defined(OS_MACOSX)
@@@@ -77,7 +77,7 @@@@ int main(int argc, char** argv) {
 #if defined(OS_WIN)
   capturer.reset(new remoting::CapturerGdi());
   executor.reset(new remoting::EventExecutorWin());
-#elif defined(OS_LINUX)
+#elif defined(OS_NIX)
   capturer.reset(new remoting::CapturerLinux());
   executor.reset(new remoting::EventExecutorLinux());
 #elif defined(OS_MACOSX)
diff --git a/remoting/remoting.gyp b/remoting/remoting.gyp
index bda9e60..cf19115 100644
--- remoting/remoting.gyp
+++ remoting/remoting.gyp
@@@@ -16,7 +16,7 @@@@
   },
 
   'conditions': [
-    ['OS=="linux" or OS=="mac"', {
+    ['OS=="linux" or OS=="freebsd" or OS=="mac"', {
       'targets': [
         # Simple webserver for testing chromoting client plugin.
         {
@@@@ -187,7 +187,7 @@@@
             'host/event_executor_win.h',
           ],
         }],
-        ['OS=="linux"', {
+        ['OS=="linux" or OS=="freebsd"', {
           'sources': [
             'host/capturer_linux.cc',
             'host/capturer_linux.h',
@@@@ -374,7 +374,7 @@@@
             'host/capturer_gdi_unittest.cc',
           ],
         }],
-        ['OS=="linux"', {
+        ['OS=="linux" or OS=="freebsd"', {
           'dependencies': [
             # Needed for the following #include chain:
             #   base/run_all_unittests.cc
diff --git a/third_party/glew/src/glew.c b/third_party/glew/src/glew.c
index 8d89d8a..00b011a 100644
--- third_party/glew/src/glew.c
+++ third_party/glew/src/glew.c
@@@@ -162,7 +162,7 @@@@ void* NSGLGetProcAddress (const GLubyte *name)
 }
 #endif /* __APPLE__ */
 
-#if defined(__sgi) || defined (__sun) || defined(__linux__)
+#if defined(__sgi) || defined (__sun) || defined(__linux__) || defined(__FreeBSD__)
 #include <dlfcn.h>
 #include <stdio.h>
 #include <stdlib.h>
@@@@ -198,7 +198,7 @@@@ void* dlGetProcAddress (const GLubyte* name)
 #  if defined(__APPLE__)
 #    define glewGetProcAddress(name) NSGLGetProcAddress(name)
 #  else
-#    if defined(__sgi) || defined(__sun) || defined(__linux__)
+#    if defined(__sgi) || defined(__sun) || defined(__linux__) || defined(__FreeBSD__)
 #      define glewGetProcAddress(name) dlGetProcAddress(name)
 #    else /* Used to use this for Linux, but no longer */
 #      define glewGetProcAddress(name) (*glXGetProcAddressARB)(name)
diff --git a/third_party/libevent/event-config.h b/third_party/libevent/event-config.h
index 66a53de..d3b8486 100644
--- third_party/libevent/event-config.h
+++ third_party/libevent/event-config.h
@@@@ -9,6 +9,8 @@@@
 #include "mac/event-config.h"
 #elif defined(__linux__)
 #include "linux/event-config.h"
+#elif defined(__FreeBSD__)
+#include "freebsd/event-config.h"
 #else
 #error generate event-config.h for your platform
 #endif
diff --git a/third_party/libevent/freebsd/event-config.h b/third_party/libevent/freebsd/event-config.h
new file mode 100644
index 0000000..1e0ae89
--- /dev/null
+++ third_party/libevent/freebsd/event-config.h
@@@@ -0,0 +1,262 @@@@
+/* event-config.h
+ * Generated by autoconf; post-processed by libevent.
+ * Do not edit this file.
+ * Do not rely on macros in this file existing in later versions.
+ */
+#ifndef _EVENT_CONFIG_H_
+#define _EVENT_CONFIG_H_
+/* config.h.  Generated from config.h.in by configure.  */
+/* config.h.in.  Generated from configure.in by autoheader.  */
+
+/* Define if clock_gettime is available in libc */
+#define _EVENT_DNS_USE_CPU_CLOCK_FOR_ID 1
+
+/* Define is no secure id variant is available */
+/* #undef _EVENT_DNS_USE_GETTIMEOFDAY_FOR_ID */
+
+/* Define to 1 if you have the `clock_gettime' function. */
+#define _EVENT_HAVE_CLOCK_GETTIME 1
+
+/* Define if /dev/poll is available */
+/* #undef _EVENT_HAVE_DEVPOLL */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define _EVENT_HAVE_DLFCN_H 1
+
+/* Define if your system supports the epoll system calls */
+/* #undef _EVENT_HAVE_EPOLL */
+
+/* Define to 1 if you have the `epoll_ctl' function. */
+/* #undef _EVENT_HAVE_EPOLL_CTL */
+
+/* Define if your system supports event ports */
+/* #undef _EVENT_HAVE_EVENT_PORTS */
+
+/* Define to 1 if you have the `fcntl' function. */
+#define _EVENT_HAVE_FCNTL 1
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#define _EVENT_HAVE_FCNTL_H 1
+
+/* Define to 1 if you have the `getaddrinfo' function. */
+#define _EVENT_HAVE_GETADDRINFO 1
+
+/* Define to 1 if you have the `getnameinfo' function. */
+#define _EVENT_HAVE_GETNAMEINFO 1
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#define _EVENT_HAVE_GETTIMEOFDAY 1
+
+/* Define to 1 if you have the `inet_ntop' function. */
+#define _EVENT_HAVE_INET_NTOP 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define _EVENT_HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the `kqueue' function. */
+#define _EVENT_HAVE_KQUEUE 1
+
+/* Define to 1 if you have the `nsl' library (-lnsl). */
+/* #undef _EVENT_HAVE_LIBNSL */
+
+/* Define to 1 if you have the `resolv' library (-lresolv). */
+/* #undef _EVENT_HAVE_LIBRESOLV */
+
+/* Define to 1 if you have the `rt' library (-lrt). */
+#define _EVENT_HAVE_LIBRT 1
+
+/* Define to 1 if you have the `socket' library (-lsocket). */
+/* #undef _EVENT_HAVE_LIBSOCKET */
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define _EVENT_HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the <netinet/in6.h> header file. */
+/* #undef _EVENT_HAVE_NETINET_IN6_H */
+
+/* Define to 1 if you have the `poll' function. */
+#define _EVENT_HAVE_POLL 1
+
+/* Define to 1 if you have the <poll.h> header file. */
+#define _EVENT_HAVE_POLL_H 1
+
+/* Define to 1 if you have the `port_create' function. */
+/* #undef _EVENT_HAVE_PORT_CREATE */
+
+/* Define to 1 if you have the <port.h> header file. */
+/* #undef _EVENT_HAVE_PORT_H */
+
+/* Define to 1 if you have the `select' function. */
+#define _EVENT_HAVE_SELECT 1
+
+/* Define if F_SETFD is defined in <fcntl.h> */
+#define _EVENT_HAVE_SETFD 1
+
+/* Define to 1 if you have the `sigaction' function. */
+#define _EVENT_HAVE_SIGACTION 1
+
+/* Define to 1 if you have the `signal' function. */
+#define _EVENT_HAVE_SIGNAL 1
+
+/* Define to 1 if you have the <signal.h> header file. */
+#define _EVENT_HAVE_SIGNAL_H 1
+
+/* Define to 1 if you have the <stdarg.h> header file. */
+#define _EVENT_HAVE_STDARG_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define _EVENT_HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define _EVENT_HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define _EVENT_HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define _EVENT_HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strlcpy' function. */
+#define _EVENT_HAVE_STRLCPY 1
+
+/* Define to 1 if you have the `strsep' function. */
+#define _EVENT_HAVE_STRSEP 1
+
+/* Define to 1 if you have the `strtok_r' function. */
+#define _EVENT_HAVE_STRTOK_R 1
+
+/* Define to 1 if you have the `strtoll' function. */
+#define _EVENT_HAVE_STRTOLL 1
+
+/* Define to 1 if the system has the type `struct in6_addr'. */
+#define _EVENT_HAVE_STRUCT_IN6_ADDR 1
+
+/* Define to 1 if you have the <sys/devpoll.h> header file. */
+/* #undef _EVENT_HAVE_SYS_DEVPOLL_H */
+
+/* Define to 1 if you have the <sys/epoll.h> header file. */
+/* #undef _EVENT_HAVE_SYS_EPOLL_H */
+
+/* Define to 1 if you have the <sys/event.h> header file. */
+#define _EVENT_HAVE_SYS_EVENT_H 1
+
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+#define _EVENT_HAVE_SYS_IOCTL_H 1
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#define _EVENT_HAVE_SYS_PARAM_H 1
+
+/* Define to 1 if you have the <sys/queue.h> header file. */
+#define _EVENT_HAVE_SYS_QUEUE_H 1
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+#define _EVENT_HAVE_SYS_SELECT_H 1
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#define _EVENT_HAVE_SYS_SOCKET_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define _EVENT_HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define _EVENT_HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define _EVENT_HAVE_SYS_TYPES_H 1
+
+/* Define if TAILQ_FOREACH is defined in <sys/queue.h> */
+#define _EVENT_HAVE_TAILQFOREACH 1
+
+/* Define if timeradd is defined in <sys/time.h> */
+#define _EVENT_HAVE_TIMERADD 1
+
+/* Define if timerclear is defined in <sys/time.h> */
+#define _EVENT_HAVE_TIMERCLEAR 1
+
+/* Define if timercmp is defined in <sys/time.h> */
+#define _EVENT_HAVE_TIMERCMP 1
+
+/* Define if timerisset is defined in <sys/time.h> */
+#define _EVENT_HAVE_TIMERISSET 1
+
+/* Define to 1 if the system has the type `uint16_t'. */
+#define _EVENT_HAVE_UINT16_T 1
+
+/* Define to 1 if the system has the type `uint32_t'. */
+#define _EVENT_HAVE_UINT32_T 1
+
+/* Define to 1 if the system has the type `uint64_t'. */
+#define _EVENT_HAVE_UINT64_T 1
+
+/* Define to 1 if the system has the type `uint8_t'. */
+#define _EVENT_HAVE_UINT8_T 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define _EVENT_HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the `vasprintf' function. */
+#define _EVENT_HAVE_VASPRINTF 1
+
+/* Define if kqueue works correctly with pipes */
+#define _EVENT_HAVE_WORKING_KQUEUE 1
+
+/* Name of package */
+#define _EVENT_PACKAGE "libevent"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define _EVENT_PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define _EVENT_PACKAGE_NAME ""
+
+/* Define to the full name and version of this package. */
+#define _EVENT_PACKAGE_STRING ""
+
+/* Define to the one symbol short name of this package. */
+#define _EVENT_PACKAGE_TARNAME ""
+
+/* Define to the version of this package. */
+#define _EVENT_PACKAGE_VERSION ""
+
+/* The size of `int', as computed by sizeof. */
+#define _EVENT_SIZEOF_INT 4
+
+/* The size of `long', as computed by sizeof. */
+#define _EVENT_SIZEOF_LONG 8
+
+/* The size of `long long', as computed by sizeof. */
+#define _EVENT_SIZEOF_LONG_LONG 8
+
+/* The size of `short', as computed by sizeof. */
+#define _EVENT_SIZEOF_SHORT 2
+
+/* Define to 1 if you have the ANSI C header files. */
+#define _EVENT_STDC_HEADERS 1
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#define _EVENT_TIME_WITH_SYS_TIME 1
+
+/* Version number of package */
+#define _EVENT_VERSION "1.4.13-stable"
+
+/* Define to appropriate substitue if compiler doesnt have __func__ */
+/* #undef _EVENT___func__ */
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef _EVENT_const */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+   calls it, or to nothing if 'inline' is not supported under any name.  */
+#ifndef _EVENT___cplusplus
+/* #undef _EVENT_inline */
+#endif
+
+/* Define to `int' if <sys/types.h> does not define. */
+/* #undef _EVENT_pid_t */
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef _EVENT_size_t */
+
+/* Define to unsigned int if you dont have it */
+/* #undef _EVENT_socklen_t */
+#endif
diff --git a/third_party/libxslt/libxslt.gyp b/third_party/libxslt/libxslt.gyp
index cc6a377..632749b 100644
--- third_party/libxslt/libxslt.gyp
+++ third_party/libxslt/libxslt.gyp
@@@@ -21,7 +21,7 @@@@
     {
       'target_name': 'libxslt',
       'conditions': [
-        ['OS=="linux" and use_system_libxml', {
+        ['(OS=="linux" or OS=="freebsd") and use_system_libxml', {
           'type': 'settings',
           'direct_dependent_settings': {
             'cflags': [
diff --git a/third_party/mesa/mesa.gyp b/third_party/mesa/mesa.gyp
index 277add5..23185e5 100644
--- third_party/mesa/mesa.gyp
+++ third_party/mesa/mesa.gyp
@@@@ -7,7 +7,7 @@@@
   },
   'target_defaults': {
     'conditions': [
-      ['OS=="linux"', {
+      ['OS=="linux" or OS=="freebsd"', {
         'cflags': [
           '-fPIC',
         ],
diff --git a/third_party/tcmalloc/chromium/src/config.h b/third_party/tcmalloc/chromium/src/config.h
index 812c67c..047b878 100644
--- third_party/tcmalloc/chromium/src/config.h
+++ third_party/tcmalloc/chromium/src/config.h
@@@@ -15,6 +15,8 @@@@
 #include "third_party/tcmalloc/chromium/src/config_win.h"
 #elif defined(OS_LINUX)
 #include "third_party/tcmalloc/chromium/src/config_linux.h"
+#elif defined(OS_FREEBSD)
+#include "third_party/tcmalloc/chromium/src/config_freebsd.h"
 #endif
 
 #endif // CONFIG_H_
diff --git a/third_party/tcmalloc/chromium/src/config_freebsd.h b/third_party/tcmalloc/chromium/src/config_freebsd.h
new file mode 100644
index 0000000..d286c35
--- /dev/null
+++ third_party/tcmalloc/chromium/src/config_freebsd.h
@@@@ -0,0 +1,234 @@@@
+/* src/config.h.  Generated from config.h.in by configure.  */
+/* src/config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define to 1 if compiler supports __builtin_stack_pointer */
+/* #undef HAVE_BUILTIN_STACK_POINTER */
+
+/* Define to 1 if you have the <conflict-signal.h> header file. */
+/* #undef HAVE_CONFLICT_SIGNAL_H */
+
+/* Define to 1 if you have the declaration of `cfree', and to 0 if you don't.
+   */
+#define HAVE_DECL_CFREE 0
+
+/* Define to 1 if you have the declaration of `memalign', and to 0 if you
+   don't. */
+#define HAVE_DECL_MEMALIGN 0
+
+/* Define to 1 if you have the declaration of `posix_memalign', and to 0 if
+   you don't. */
+#define HAVE_DECL_POSIX_MEMALIGN 0
+
+/* Define to 1 if you have the declaration of `pvalloc', and to 0 if you
+   don't. */
+#define HAVE_DECL_PVALLOC 0
+
+/* Define to 1 if you have the declaration of `uname', and to 0 if you don't.
+   */
+#define HAVE_DECL_UNAME 1
+
+/* Define to 1 if you have the declaration of `valloc', and to 0 if you don't.
+   */
+#define HAVE_DECL_VALLOC 0
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if the system has the type `Elf32_Versym'. */
+#define HAVE_ELF32_VERSYM 1
+
+/* Define to 1 if you have the <execinfo.h> header file. */
+#define HAVE_EXECINFO_H 1
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#define HAVE_FCNTL_H 1
+
+/* Define to 1 if you have the <features.h> header file. */
+/* #undef HAVE_FEATURES_H */
+
+/* Define to 1 if you have the `geteuid' function. */
+#define HAVE_GETEUID 1
+
+/* Define to 1 if you have the `getpagesize' function. */
+#define HAVE_GETPAGESIZE 1
+
+/* Define to 1 if you have the <glob.h> header file. */
+#define HAVE_GLOB_H 1
+
+/* Define to 1 if you have the <grp.h> header file. */
+#define HAVE_GRP_H 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the <libunwind.h> header file. */
+/* #undef HAVE_LIBUNWIND_H */
+
+/* Define to 1 if you have the <linux/ptrace.h> header file. */
+/* #undef HAVE_LINUX_PTRACE_H */
+
+/* Define to 1 if you have the <malloc.h> header file. */
+/* #undef HAVE_MALLOC_H */
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have a working `mmap' system call. */
+#define HAVE_MMAP 1
+
+/* define if the compiler implements namespaces */
+#define HAVE_NAMESPACES 1
+
+/* Define to 1 if you have the <poll.h> header file. */
+#define HAVE_POLL_H 1
+
+/* define if libc has program_invocation_name */
+/* #undef HAVE_PROGRAM_INVOCATION_NAME */
+
+/* Define if you have POSIX threads libraries and header files. */
+#define HAVE_PTHREAD 1
+
+/* Define to 1 if you have the <pwd.h> header file. */
+#define HAVE_PWD_H 1
+
+/* Define to 1 if you have the `sbrk' function. */
+#define HAVE_SBRK 1
+
+/* Define to 1 if you have the <sched.h> header file. */
+#define HAVE_SCHED_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if the system has the type `struct mallinfo'. */
+/* #undef HAVE_STRUCT_MALLINFO */
+
+/* Define to 1 if you have the <sys/prctl.h> header file. */
+/* #undef HAVE_SYS_PRCTL_H */
+
+/* Define to 1 if you have the <sys/resource.h> header file. */
+#define HAVE_SYS_RESOURCE_H 1
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#define HAVE_SYS_SOCKET_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/syscall.h> header file. */
+#define HAVE_SYS_SYSCALL_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <sys/wait.h> header file. */
+#define HAVE_SYS_WAIT_H 1
+
+/* Define to 1 if compiler supports __thread */
+#define HAVE_TLS 1
+
+/* Define to 1 if you have the <ucontext.h> header file. */
+#define HAVE_UCONTEXT_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the <unwind.h> header file. */
+/* #undef HAVE_UNWIND_H */
+
+/* define if your compiler has __attribute__ */
+#define HAVE___ATTRIBUTE__ 1
+
+/* Define to 1 if the system has the type `__int64'. */
+/* #undef HAVE___INT64 */
+
+/* prefix where we look for installed files */
+#define INSTALL_PREFIX "/usr/local"
+
+/* Define to 1 if int32_t is equivalent to intptr_t */
+/* #undef INT32_EQUALS_INTPTR */
+#if defined(__i386__)
+#define INT32_EQUALS_INTPTR 1
+#endif
+
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+/* #undef NO_MINUS_C_MINUS_O */
+
+/* Name of package */
+#define PACKAGE "google-perftools"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "opensource@@google.com"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "google-perftools"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "google-perftools 1.3"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "google-perftools"
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "1.3"
+
+/* How to access the PC from a struct ucontext */
+#if defined(__i386__)
+#define PC_FROM_UCONTEXT uc_mcontext.mc_eip
+#else
+#define PC_FROM_UCONTEXT uc_mcontext.mc_rip
+#endif
+
+/* Always the empty-string on non-windows systems. On windows, should be
+   "__declspec(dllexport)". This way, when we compile the dll, we export our
+   functions/classes. It's safe to define this here because config.h is only
+   used internally, to compile the DLL, and every DLL source file #includes
+   "config.h" before anything else. */
+#define PERFTOOLS_DLL_DECL
+
+/* printf format code for printing a size_t and ssize_t */
+#define PRIdS "zd"
+
+/* printf format code for printing a size_t and ssize_t */
+#define PRIuS "zu"
+
+/* printf format code for printing a size_t and ssize_t */
+#define PRIxS "zx"
+
+/* Define to necessary symbol if this constant uses a non-standard name on
+   your system. */
+/* #undef PTHREAD_CREATE_JOINABLE */
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* the namespace where STL code like vector<> is defined */
+#define STL_NAMESPACE std
+
+/* Version number of package */
+#define VERSION "1.3"
+
+/* C99 says: define this to get the PRI... macros from stdint.h */
+#ifndef __STDC_FORMAT_MACROS
+# define __STDC_FORMAT_MACROS 1
+#endif
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+   calls it, or to nothing if 'inline' is not supported under any name.  */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
+
+
+#ifdef __MINGW32__
+#include "windows/mingw.h"
+#endif
diff --git a/webkit/glue/plugins/pepper_font.cc b/webkit/glue/plugins/pepper_font.cc
index 8bc48a3..1d7a655 100644
--- webkit/glue/plugins/pepper_font.cc
+++ webkit/glue/plugins/pepper_font.cc
@@@@ -6,7 +6,7 @@@@
 
 #include "webkit/glue/plugins/pepper_font.h"
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
 #include <unistd.h>
 #endif
 
@@@@ -21,7 +21,7 @@@@ namespace {
 
 PP_Resource MatchFontWithFallback(PP_Module module_id,
                                   const PP_FontDescription* description) {
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
   PluginModule* module = PluginModule::FromPPModule(module_id);
   if (!module)
     return NULL;
@@@@ -73,7 +73,7 @@@@ Font::Font(PluginModule* module, int fd)
 }
 
 Font::~Font() {
-#if defined (OS_LINUX)
+#if defined (OS_NIX)
   close(fd_);
 #endif
 }
@@@@ -86,7 +86,7 @@@@ const PPB_Font* Font::GetInterface() {
 bool Font::GetFontTable(uint32_t table,
                         void* output,
                         uint32_t* output_length) {
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
   size_t temp_size = static_cast<size_t>(*output_length);
   bool rv = webkit_glue::GetFontTable(
       fd_, table, static_cast<uint8_t*>(output), &temp_size);
diff --git a/webkit/glue/plugins/pepper_plugin_instance.cc b/webkit/glue/plugins/pepper_plugin_instance.cc
index dcc7ea2..215241e 100644
--- webkit/glue/plugins/pepper_plugin_instance.cc
+++ webkit/glue/plugins/pepper_plugin_instance.cc
@@@@ -228,10 +228,10 @@@@ PluginInstance::PluginInstance(PluginDelegate* delegate,
       find_identifier_(-1),
       plugin_find_interface_(NULL),
       plugin_zoom_interface_(NULL),
-#if defined (OS_LINUX)
+#if defined (OS_NIX)
       num_pages_(0),
       pdf_output_done_(false),
-#endif  // defined (OS_LINUX)
+#endif  // defined (OS_NIX)
       plugin_print_interface_(NULL) {
   memset(&current_print_settings_, 0, sizeof(current_print_settings_));
   DCHECK(delegate);
@@@@ -542,17 +542,17 @@@@ int PluginInstance::PrintBegin(const gfx::Rect& printable_area,
   if (!num_pages)
     return 0;
   current_print_settings_ = print_settings;
-#if defined (OS_LINUX)
+#if defined (OS_NIX)
   num_pages_ = num_pages;
   pdf_output_done_ = false;
-#endif  // (OS_LINUX)
+#endif  // (OS_NIX)
   return num_pages;
 }
 
 bool PluginInstance::PrintPage(int page_number, WebKit::WebCanvas* canvas) {
   DCHECK(plugin_print_interface_);
   PP_PrintPageNumberRange page_range;
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
   if (current_print_settings_.format == PP_PRINTOUTPUTFORMAT_PDF) {
     // On Linux we will try and output all pages as PDF in the first call to
     // PrintPage. This is a temporary hack.
@@@@ -563,9 +563,9 @@@@ bool PluginInstance::PrintPage(int page_number, WebKit::WebCanvas* canvas) {
     page_range.first_page_number = 0;
     page_range.last_page_number = num_pages_ - 1;
   }
-#else  // defined(OS_LINUX)
+#else  // defined(OS_NIX)
   page_range.first_page_number = page_range.last_page_number = page_number;
-#endif  // defined(OS_LINUX)
+#endif  // defined(OS_NIX)
 
   PP_Resource print_output =
       plugin_print_interface_->PrintPages(GetPPInstance(), &page_range, 1);
@@@@ -593,10 +593,10 @@@@
   memset(&current_print_settings_, 0, sizeof(current_print_settings_));
 #if defined(OS_MACOSX)
   last_printed_page_ = NULL;
-#elif defined(OS_LINUX)
+#elif defined(OS_NIX)
   num_pages_ = 0;
   pdf_output_done_ = false;
-#endif  // defined(OS_LINUX)
+#endif  // defined(OS_NIX)
 }

 bool PluginInstance::PrintPDFOutput(PP_Resource print_output,
@@@@ -619,7 +619,7 @@@@ bool PluginInstance::PrintPDFOutput(PP_Resource print_output,
 #endif  // defined(OS_WIN)
 
   bool ret = false;
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
   // On Linux we need to get the backing PdfPsMetafile and write the bits
   // directly.
   cairo_t* context = canvas->beginPlatformPaint();
diff --git a/webkit/glue/plugins/pepper_plugin_instance.h b/webkit/glue/plugins/pepper_plugin_instance.h
index 4528a99..96d9c29 100644
--- webkit/glue/plugins/pepper_plugin_instance.h
+++ webkit/glue/plugins/pepper_plugin_instance.h
@@@@ -184,7 +184,7 @@@@
   // to keep the pixels valid until CGContextEndPage is called. We use this
   // variable to hold on to the pixels.
   scoped_refptr<ImageData> last_printed_page_;
-#elif defined(OS_LINUX)
+#elif defined(OS_NIX)
   // On Linux, we always send all pages from the renderer to the browser.
   // So, if the plugin supports printPagesAsPDF we print the entire output
   // in one shot in the first call to PrintPage.
@@@@ -195,7 +195,7 @@@@
   // Specifies whether we have already output all pages. This is used to ignore
   // subsequent PrintPage requests.
   bool pdf_output_done_;
-#endif  // defined(OS_LINUX)
+#endif  // defined(OS_NIX)

   // The plugin print interface.
   const PPP_Printing* plugin_print_interface_;
diff --git a/webkit/glue/webkit_glue.h b/webkit/glue/webkit_glue.h
index 541836b..5d3b64c 100644
--- webkit/glue/webkit_glue.h
+++ webkit/glue/webkit_glue.h
@@@@ -265,7 +265,7 @@@@ std::string GetProductVersion();
 // Returns true if the embedder is running in single process mode.
 bool IsSingleProcess();
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
 // Return a read-only file descriptor to the font which best matches the given
 // properties or -1 on failure.
 //   charset: specifies the language(s) that the font must cover. See
diff --git a/webkit/glue/webkitclient_impl.cc b/webkit/glue/webkitclient_impl.cc
index b05e7d9..9bcb0dd 100644
--- webkit/glue/webkitclient_impl.cc
+++ webkit/glue/webkitclient_impl.cc
@@@@ -37,7 +37,7 @@@@
 #include "webkit/glue/websocketstreamhandle_impl.h"
 #include "webkit/glue/weburlloader_impl.h"
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
 #include "v8/include/v8.h"
 #endif
 
diff --git a/webkit/support/webkit_support_glue.cc b/webkit/support/webkit_support_glue.cc
index bae6374..6f13174 100644
--- webkit/support/webkit_support_glue.cc
+++ webkit/support/webkit_support_glue.cc
@@@@ -72,7 +72,7 @@@@ bool IsSingleProcess() {
   return true;
 }
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
 int MatchFontWithFallback(const std::string& face, bool bold,
                           bool italic, int charset) {
   return -1;
@


1.4
log
@Change maintainer.

While concerns have been raised within the ports community about the "pay as
you go" plan of the previous maintainer, given the fact that we have ports for
commercial software this in itself would not warrant such a measure.

However complete and obstinate disregard to the security vulnerabilities of the
version in the ports tree, including refusal to even document them
contradicts the idea of maintainership as the community understands it
and as it is documented.

Rene Ladan - rene@@ has graciously offered his services to work directly
with google/chrome developers, push FreeBSD patches upstream and
generally maintain this port in accordance with our standards.

Approved by:    portmgr@@
@
text
@@


1.3
log
@- Add explicit dependency on dconf
- Make dependency on gconf2 optionable (for setting the preferences)
- Add support for pre-SSE2 processors

While here, remove BROKEN check for 6.X

Port remains FORBIDDEN
PR:		ports/152816
Submitted by:	maintainer
@
text
@@


1.2
log
@- Update to 6.0.472.63, again without the Courgette code
- Add option to depend on VP8 codec from ports
- Makefile cleanups
- Tested to work with --integrated-as by maintainer
PR:		ports/152166
Submitted by:	maintainer
@
text
@d512 10
a521 1
@@@@ -285,7 +285,7 @@@@
d580 16
d1202 98
d2794 12
a2805 1
@@@@ -2862,7 +2862,7 @@@@
@


1.1
log
@Chromium is an open-source browser project that aims to build a safer,
faster, and more stable way for all users to experience the web. The
official site at http://www.chromium.org/Home contains design documents,
architecture overviews, testing information, and more to help you learn
to build and work with the Chromium source code.

You can help support this port of Chromium to FreeBSD by subscribing at
http://chromium.hybridsource.org.  This port was derived from older work
extracted from the weekly subscriber builds.

WWW: http://chromium.hybridsource.org

The Courgette update code has been removed from the distfile

PR:		ports/146302
Submitted by:	Florent Thoumie [flz at FreeBSD.org], [chromium hybridsource.org]
Approved by:	FreeBSD Foundation
@
text
@d2 1
a2 1
index 2eaa8f6..afbd919 100644
d5 1
a5 1
@@@@ -164,7 +164,7 @@@@
d14 73
a86 7
diff --git a/app/resources/app_resources.grd b/app/resources/app_resources.grd
index 65ba81c..0091169 100644
--- app/resources/app_resources.grd
+++ app/resources/app_resources.grd
@@@@ -31,7 +31,7 @@@@
         <include name="IDR_MINIMIZE_P" file="minimize_p.png" type="BINDATA" />
       </if>
d88 5
a92 5
-      <if expr="os == 'linux2' or os == 'freebsd7' or os == 'openbsd4'">
+      <if expr="os == 'linux2' or os.find('bsd') != -1">
         <!-- 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" />
d94 1
a94 1
index 7a60f08..5241873 100644
d106 4
a109 4
@@@@ -73,7 +73,7 @@@@ class TransportDIB {
   // Returns a default, invalid handle, that is meant to indicate a missing
   // Transport DIB.
   static Handle DefaultHandleValue() { return NULL; }
d115 4
a118 4
@@@@ -81,7 +81,7 @@@@ class TransportDIB {
   // Returns a default, invalid handle, that is meant to indicate a missing
   // Transport DIB.
   static Handle DefaultHandleValue() { return Handle(); }
d124 1
a124 1
@@@@ -136,11 +136,12 @@@@ class TransportDIB {
d232 1
a232 1
index 6c41a0c..a670938 100644
d235 1
a235 1
@@@@ -27,6 +27,9 @@@@ TransportDIB::TransportDIB()
d245 1
a245 1
@@@@ -52,7 +55,13 @@@@ TransportDIB* TransportDIB::Create(size_t size, uint32 sequence_num) {
d259 21
d281 1
a281 1
index 05f8a0f..607bf02 100644
d284 1
a284 1
@@@@ -221,6 +221,13 @@@@
d299 1
a299 1
index df96e51..b51b6df 100644
d302 10
a311 1
@@@@ -420,6 +420,9 @@@@
d315 15
a329 64
+             'sources!': [
+             'process_linux.cc',
+             ],
             'link_settings': {
               'libraries': [
                 '-L/usr/local/lib -lexecinfo',
diff --git a/base/base_paths_posix.cc b/base/base_paths_posix.cc
index e44028e..9551c73 100644
--- base/base_paths_posix.cc
+++ base/base_paths_posix.cc
@@@@ -7,6 +7,9 @@@@
 #include "base/base_paths.h"
 
 #include <unistd.h>
+#if defined(OS_FREEBSD)
+#include <sys/sysctl.h>
+#endif
 
 #include "base/env_var.h"
 #include "base/file_path.h"
@@@@ -23,8 +26,6 @@@@ namespace base {
 const char kSelfExe[] = "/proc/self/exe";
 #elif defined(OS_SOLARIS)
 const char kSelfExe[] = getexecname();
-#elif defined(OS_FREEBSD)
-const char kSelfExe[] = "/proc/curproc/file";
 #endif
 
 bool PathProviderPosix(int key, FilePath* result) {
@@@@ -32,6 +33,7 @@@@ bool PathProviderPosix(int key, FilePath* result) {
   switch (key) {
     case base::FILE_EXE:
     case base::FILE_MODULE: {  // TODO(evanm): is this correct?
+#if defined(OS_LINUX)
       char bin_dir[PATH_MAX + 1];
       int bin_dir_size = readlink(kSelfExe, bin_dir, PATH_MAX);
       if (bin_dir_size < 0 || bin_dir_size > PATH_MAX) {
@@@@ -41,6 +43,26 @@@@ bool PathProviderPosix(int key, FilePath* result) {
       bin_dir[bin_dir_size] = 0;
       *result = FilePath(bin_dir);
       return true;
+#elif defined(OS_FREEBSD)
+      char bin_dir[PATH_MAX + 1];
+      int error, name[4];
+      size_t length;
+
+      name[0] = CTL_KERN;
+      name[1] = KERN_PROC;
+      name[2] = KERN_PROC_PATHNAME;
+      name[3] = -1;
+
+      length = sizeof(bin_dir);
+      error = sysctl(name, 4, bin_dir, &length, NULL, 0);
+      if (error < 0 || length == 0 || strlen(bin_dir) == 0) {
+        NOTREACHED() << "Unable to resolve path.";
+        return false;
+      }
+      bin_dir[strlen(bin_dir)] = 0;
+      *result = FilePath(bin_dir);
+      return true;
+#endif
     }
     case base::DIR_SOURCE_ROOT:
       // On POSIX, unit tests execute two levels deep from the source root.
d345 5
a349 5
diff --git a/base/file_util_linux.cc b/base/file_util_linux.cc
index 0f9795e..bf9bd97 100644
--- base/file_util_linux.cc
+++ base/file_util_linux.cc
@@@@ -25,7 +25,12 @@@@ bool GetTempDir(FilePath* path) {
a355 1
+//BSD not sure this is the best way to do this but it works for now
d413 1
a413 1
index a8dfdeb..d20f63a 100644
d416 1
a416 1
@@@@ -59,7 +59,7 @@@@ class TestSuite {
d466 1
a466 1
index 6990fcf..b369814 100644
d469 1
a469 1
@@@@ -84,7 +84,7 @@@@
d478 1
a478 2
@@@@ -203,10 +203,10 @@@@
     'linux_strip_binary%': 0,
d480 9
a488 3
     # Enable TCMalloc.
-    'linux_use_tcmalloc%': 0,
+    'linux_use_tcmalloc%': 1,
d496 8
a503 1
@@@@ -217,7 +217,7 @@@@
d512 1
a512 1
@@@@ -232,7 +232,7 @@@@
d521 1
a521 1
@@@@ -493,7 +493,7 @@@@
d530 13
d544 1
a544 1
index f364469..ba2d747 100755
d568 1
a568 1
index 4176719..f67130e 100644
d571 8
a578 9
@@@@ -13,7 +13,7 @@@@
         'pkg-config': 'pkg-config'
       },
     }],
-    [ 'OS=="linux"', {
+    [ 'OS=="linux" or OS=="freebsd"', {
       'variables': {
         # We use our own copy of libssl, although we still need to link against
         # the rest of NSS.
d580 1
a580 1
index 3f54f04..351fafc 100644
d583 2
a584 2
@@@@ -62,7 +62,7 @@@@
 #include "base/nss_util.h"
d592 7
a598 3
@@@@ -253,6 +253,7 @@@@ static void SetUpGLibLogHandler() {
   }
 }
d600 4
a603 15
+#if defined(OS_LINUX)
 static void AdjustLinuxOOMScore(const std::string& process_type) {
   const int kMiscScore = 7;
   const int kPluginScore = 10;
@@@@ -285,6 +286,7 @@@@ static void AdjustLinuxOOMScore(const std::string& process_type) {
   if (score > -1)
     base::AdjustOOMScore(base::GetCurrentProcId(), score);
 }
+#endif  // defined(OS_LINUX)
 #endif  // defined(OS_POSIX) && !defined(OS_MACOSX)
 
 // Register the invalid param handler and pure call handler to be able to
@@@@ -771,7 +773,7 @@@@ int ChromeMain(int argc, char** argv) {
     NOTIMPLEMENTED();
 #endif
d610 1
a610 3
@@@@ -809,7 +811,7 @@@@ int ChromeMain(int argc, char** argv) {
     // gtk_init() can change |argc| and |argv|.
     gtk_init(&argc, &argv);
d612 2
d620 1
a620 1
index 0ed9e15..28d2870 100644
d623 10
a632 1
@@@@ -17,11 +17,11 @@@@
d646 1
a646 1
@@@@ -34,7 +34,7 @@@@ int main(int argc, const char** argv) {
d656 1
a656 1
index 5ddfcca..a5cddb2 100644
d669 1
a669 1
index 02f9eca..2653791 100644
d672 9
a680 31
@@@@ -2291,7 +2291,7 @@@@ each locale. -->
       <message name="IDS_CREATE_SHORTCUTS_QUICK_LAUNCH_BAR_CHKBOX" desc="Label of the checkbox to create an application shortcut in quick launch bar.">
         Quick launch bar
       </message>
-      <if expr="os == 'linux2' or os == 'openbsd4' or os=='freebsd6'">
+      <if expr="os == 'linux2' or os.find('bsd') != -1">
         <message name="IDS_CREATE_SHORTCUTS_ERROR_TITLE" desc="Title of the error dialog box when creating an application shortcut failed.">
           Failed to Create Application Shortcut
         </message>
@@@@ -5660,7 +5660,7 @@@@ Keep your key file in a safe place. You will need it to create new versions of y
       <message name="IDS_THEMES_GROUP_NAME" desc="The title of the themes group">
         Themes:
       </message>
-      <if expr="os == 'linux2' or os == 'openbsd4' or os == 'freebsd6'">
+      <if expr="os == 'linux2' or os.find('bsd') != -1">
         <message name="IDS_APPEARANCE_GROUP_NAME" desc="In Title Case and without trailing colon: The title of the themes group">
           Appearance
         </message>
diff --git a/chrome/app/resources/locale_settings.grd b/chrome/app/resources/locale_settings.grd
index c591457..9c571f5 100644
--- chrome/app/resources/locale_settings.grd
+++ chrome/app/resources/locale_settings.grd
@@@@ -590,7 +590,7 @@@@
       </message>
 
       <!-- The width and height for the "create application shortcuts error" dialog. -->
-      <if expr="os == 'linux2' or os == 'openbsd4' or os == 'freebsd6'">
+      <if expr="os == 'linux2' or os.find('bsd') != -1">
         <message name="IDS_CREATE_SHORTCUTS_ERROR_DIALOG_WIDTH_CHARS" use_name_for_id="true">
          60
         </message>
d708 1
a708 1
index 09eee48..71fbc94 100644
d711 1
a711 1
@@@@ -202,7 +202,7 @@@@ Browser::~Browser() {
d720 1
a720 1
@@@@ -586,7 +586,7 @@@@ string16 Browser::GetWindowTitleForCurrentTab() const {
d729 1
a729 1
@@@@ -1161,9 +1161,9 @@@@ void Browser::ToggleFullscreenMode() {
d741 1
a741 1
@@@@ -1377,7 +1377,7 @@@@ void Browser::OpenFile() {
d750 1
a750 1
@@@@ -1993,7 +1993,7 @@@@ void Browser::DuplicateContentsAt(int index) {
d759 62
a820 19
diff --git a/chrome/browser/browser_resources.grd b/chrome/browser/browser_resources.grd
index 48d09f9..3d94009 100644
--- chrome/browser/browser_resources.grd
+++ chrome/browser/browser_resources.grd
@@@@ -13,13 +13,13 @@@@ without changes to the corresponding grd file. fbt1 -->
     <includes>
       <include name="IDR_ABOUT_VERSION_HTML" file="resources\about_version.html" flattenhtml="true" type="BINDATA" />
 
-      <if expr="os == 'linux2' or os == 'freebsd7' or os == 'openbsd4'">
+      <if expr="os == 'linux2' or os.find('bsd') != -1">
         <include name="IDR_ABOUT_MEMORY_HTML" file="resources\about_memory_linux.html" flattenhtml="true" type="BINDATA" />
       </if>
       <if expr="os == 'darwin'">
         <include name="IDR_ABOUT_MEMORY_HTML" file="resources\about_memory_mac.html" flattenhtml="true" type="BINDATA" />
       </if>
-      <if expr="os != 'linux2' and os != 'darwin' and os != 'freebsd' and os != 'openbsd'">
+      <if expr="os != 'linux2' and os != 'darwin' and os.find('bsd') == -1">
         <include name="IDR_ABOUT_MEMORY_HTML" file="resources\about_memory.html" flattenhtml="true" type="BINDATA" />
       </if>
d822 2
d825 1
a825 1
index 0af39cb..86552e7 100644
d837 1
a837 1
@@@@ -237,12 +237,12 @@@@ class BrowserThemeProvider : public NonThreadSafe,
a851 16
diff --git a/chrome/browser/child_process_host.cc b/chrome/browser/child_process_host.cc
index 539670b..10b2c90 100644
--- chrome/browser/child_process_host.cc
+++ chrome/browser/child_process_host.cc
@@@@ -26,9 +26,9 @@@@
 #include "chrome/common/result_codes.h"
 #include "chrome/installer/util/google_update_settings.h"
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
 #include "base/linux_util.h"
-#endif  // OS_LINUX
+#endif  // OS_NIX
 
 #if defined(OS_POSIX)
 // This is defined in chrome/browser/google_update_settings_posix.cc.  It's the
d853 1
a853 1
index 534368b..e7532e5 100644
d856 1
a856 1
@@@@ -16,7 +16,7 @@@@
d865 1
a865 1
@@@@ -65,7 +65,7 @@@@ class ChildProcessLauncher::Context
d874 1
a874 1
@@@@ -135,7 +135,7 @@@@ class ChildProcessLauncher::Context
d883 1
a883 1
@@@@ -155,7 +155,7 @@@@ class ChildProcessLauncher::Context
d892 1
a892 1
@@@@ -187,7 +187,7 @@@@ class ChildProcessLauncher::Context
d901 1
a901 1
@@@@ -214,20 +214,20 @@@@ class ChildProcessLauncher::Context
d925 1
a925 1
@@@@ -247,7 +247,7 @@@@ class ChildProcessLauncher::Context
d934 1
a934 1
@@@@ -255,7 +255,7 @@@@ class ChildProcessLauncher::Context
d943 1
a943 1
@@@@ -265,13 +265,13 @@@@ class ChildProcessLauncher::Context
d959 1
a959 1
@@@@ -284,7 +284,7 @@@@ class ChildProcessLauncher::Context
d968 1
a968 1
@@@@ -329,7 +329,7 @@@@ base::ProcessHandle ChildProcessLauncher::GetHandle() {
d978 1
a978 1
index 8e1d5e4..0139812 100644
d981 20
a1000 2
@@@@ -64,7 +64,7 @@@@ class CookiePromptModalDialog : public AppModalDialog {
   static void RegisterPrefs(PrefService* prefs);
d1008 1
a1008 1
@@@@ -97,7 +97,7 @@@@ class CookiePromptModalDialog : public AppModalDialog {
d1015 3
a1017 3
 #endif
 
@@@@ -130,7 +130,7 @@@@ class CookiePromptModalDialog : public AppModalDialog {
d1025 1
a1025 1
 #endif
d1027 1
a1027 1
index 720d203..e5c0d04 100644
d1030 1
a1030 1
@@@@ -42,14 +42,14 @@@@
d1047 1
a1047 1
@@@@ -335,7 +335,7 @@@@ void DragDownload(const DownloadItem* download,
d1056 1
a1056 1
@@@@ -346,13 +346,13 @@@@ void DragDownload(const DownloadItem* download,
d1073 1
a1073 1
index 7432102..c6cec8d 100644
d1076 1
a1076 1
@@@@ -49,10 +49,10 @@@@ ExtensionProcessManager::ExtensionProcessManager(Profile* profile)
d1089 1
a1089 1
@@@@ -271,7 +271,7 @@@@ void ExtensionProcessManager::Observe(NotificationType type,
d1098 1
a1098 1
@@@@ -281,7 +281,7 @@@@ void ExtensionProcessManager::Observe(NotificationType type,
d1105 14
a1118 7
       // Don't follow the behavior of having the last browser window closed
       // being an indication that the app should close.
diff --git a/chrome/browser/find_bar_host_browsertest.cc b/chrome/browser/find_bar_host_browsertest.cc
index 8ac5a6c..1438b11 100644
--- chrome/browser/find_bar_host_browsertest.cc
+++ chrome/browser/find_bar_host_browsertest.cc
@@@@ -706,7 +706,7 @@@@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest,
a1119 16
 #if defined(TOOLKIT_VIEWS)
 // Make sure Find box grabs the Esc accelerator and restores it again.
-#if defined(OS_LINUX)
+#if defined(USE_X11)
 // TODO(oshima): On Gtk/Linux, a focus out event is asynchronous and
 // hiding a find bar does not immediately update the target
 // accelerator. The last condition fails in most cases due to this
@@@@ -730,7 +730,7 @@@@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest,
   // GetNativeView / GetNativewWindow methods on BrowserWindow.
   // See http://crbug.com/26873.
   gfx::NativeView browser_view = browser()->window()->GetNativeHandle();
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_GTK)
   gfx::NativeView browser_view =
       GTK_WIDGET(browser()->window()->GetNativeHandle());
 #else
d1133 44
d1178 1
a1178 1
index 7c9a7d0..20dd6f4 100644
d1181 1
a1181 1
@@@@ -18,7 +18,7 @@@@
d1190 1
a1190 1
@@@@ -73,7 +73,7 @@@@ void MemoryDetails::CollectChildInfoOnIOThread() {
d1199 1
a1199 1
@@@@ -152,7 +152,7 @@@@ void MemoryDetails::CollectChildInfoOnUIThread() {
d1209 1
a1209 1
index 60e4bbe..8ea3cca 100644
d1221 26
d1248 1
a1248 1
index 99f6d1e..a1a9cac 100644
d1261 1
a1261 1
index a012aea..fae088a 100644
d1264 12
a1275 3
@@@@ -667,14 +667,14 @@@@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessWithTimeout(
       return PROFILE_IN_USE;
     }
d1277 14
a1290 24
-    FilePath other_chrome_path(base::GetProcessExecutablePath(pid));
+  /*  FilePath other_chrome_path(base::GetProcessExecutablePath(pid));
     if (other_chrome_path.empty() ||
         other_chrome_path.BaseName() !=
         FilePath::FromWStringHack(chrome::kBrowserProcessExecutableName)) {
       // Orphaned lockfile (no process with pid, or non-chrome process.)
       UnlinkPath(lock_path_.value());
       return PROCESS_NONE;
-    }
+    }*/
 
     if (retries == timeout_seconds) {
       // Retries failed.  Kill the unresponsive chrome process and continue.
diff --git a/chrome/browser/renderer_host/backing_store_x.cc b/chrome/browser/renderer_host/backing_store_x.cc
index d88dca7..11281b6 100644
--- chrome/browser/renderer_host/backing_store_x.cc
+++ chrome/browser/renderer_host/backing_store_x.cc
@@@@ -48,6 +48,9 @@@@ static void DestroySharedImage(Display* display,
   XShmDetach(display, shminfo);
   XDestroyImage(image);
   shmdt(shminfo->shmaddr);
+#if defined(OS_FREEBSD)
+  shmctl(shminfo->shmid, IPC_RMID, 0);
+#endif
d1293 7
a1299 3
 BackingStoreX::BackingStoreX(RenderWidgetHost* widget,
@@@@ -304,7 +307,9 @@@@ bool BackingStoreX::CopyFromBackingStore(const gfx::Rect& rect,
     }
d1301 2
a1302 3
     void* mapped_memory = shmat(shminfo.shmid, NULL, SHM_RDONLY);
+#if !defined(OS_FREEBSD)
     shmctl(shminfo.shmid, IPC_RMID, 0);
d1304 7
a1310 3
     if (mapped_memory == (void*)-1) {
       XDestroyImage(image);
       return false;
d1312 1
a1312 1
index 8f2e90c..d5ca1ca 100644
d1315 1
a1315 1
@@@@ -312,11 +312,11 @@@@ bool BrowserRenderProcessHost::Init(bool is_extensions_process,
d1329 1
a1329 1
@@@@ -698,13 +698,13 @@@@ TransportDIB* BrowserRenderProcessHost::MapTransportDIB(
d1359 1
a1359 1
index 53c736c..36baf1d 100644
d1362 1
a1362 1
@@@@ -397,7 +397,12 @@@@ void RenderSandboxHostLinux::Init(const std::string& sandbox_path) {
d1376 1
a1376 1
index f6a1c66..e6adf68 100644
d1379 1
a1379 1
@@@@ -10,7 +10,7 @@@@
d1389 1
a1389 1
index 5c379e7..52a6f7e 100644
d1401 1
a1401 1
@@@@ -249,7 +249,7 @@@@ void RenderWidgetHelper::OnCreateWidgetOnUI(
d1411 1
a1411 1
index 53b336c..427c0cc 100644
d1414 1
a1414 1
@@@@ -108,7 +108,7 @@@@ class RenderWidgetHelper
d1423 1
a1423 1
@@@@ -127,7 +127,7 @@@@ class RenderWidgetHelper
d1432 1
a1432 1
@@@@ -177,7 +177,7 @@@@ class RenderWidgetHelper
d1442 1
a1442 1
index 5dc9bad..2dfce72 100644
d1445 4
a1448 4
@@@@ -137,7 +137,7 @@@@ void RenderWidgetHost::OnMessageReceived(const IPC::Message &msg) {
     IPC_MESSAGE_HANDLER(ViewHostMsg_FocusedNodeChanged, OnMsgFocusedNodeChanged)
     IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnMsgSetCursor)
     IPC_MESSAGE_HANDLER(ViewHostMsg_ImeUpdateStatus, OnMsgImeUpdateStatus)
d1454 2
a1455 2
@@@@ -865,7 +865,7 @@@@ void RenderWidgetHost::OnMsgImeUpdateStatus(int control,
   }
d1464 1
a1464 1
index f8b8218..5e2c2e3 100644
d1467 3
a1469 3
@@@@ -445,7 +445,7 @@@@ class RenderWidgetHost : public IPC::Channel::Listener,
   // having to bring in render_messages.h in a header file.
   void OnMsgImeUpdateStatus(int control, const gfx::Rect& caret_rect);
d1477 1
a1477 1
index e0ffe1a..20e062e 100644
d1480 1
a1480 1
@@@@ -369,7 +369,7 @@@@ TEST_F(RenderWidgetHostTest, ResizeThenCrash) {
d1490 1
a1490 1
index 7b516ed..9d7ab57 100644
d1493 1
a1493 1
@@@@ -209,7 +209,7 @@@@ class RenderWidgetHostView {
d1503 1
a1503 1
index 6119c18..e2a74a9 100644
d1506 1
a1506 1
@@@@ -498,7 +498,7 @@@@ bool ResourceMessageFilter::OnMessageReceived(const IPC::Message& msg) {
d1515 1
a1515 1
@@@@ -522,7 +522,7 @@@@ bool ResourceMessageFilter::OnMessageReceived(const IPC::Message& msg) {
d1524 1
a1524 1
@@@@ -1257,7 +1257,7 @@@@ void ResourceMessageFilter::OnRendererHistograms(
d1534 1
a1534 1
index a43af51..66e64a3 100644
d1537 1
a1537 1
@@@@ -98,7 +98,7 @@@@ class TestRenderWidgetHostView : public RenderWidgetHostView {
d1546 18
d1596 1
a1596 1
index 9bc6632..3739f23 100644
d1609 1
a1609 1
index 19d1730..83c5036 100644
d1621 1
a1621 2
@@@@ -156,6 +158,7 @@@@ void CreateShortcutOnDesktop(const FilePath& shortcut_filename,
   }
d1623 2
a1624 1
   HANDLE_EINTR(close(desktop_fd));
d1630 1
a1630 1
index 4776d8d..25049a5 100644
d1633 1
a1633 3
@@@@ -18,13 +18,13 @@@@
 #include "googleurl/src/gurl.h"
 #include "testing/gtest/include/gtest/gtest.h"
d1635 4
a1638 2
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
d1651 1
a1651 1
index 20ba481..92ae148 100644
d1654 1
a1654 1
@@@@ -221,7 +221,7 @@@@ void SyncerThread::ThreadMainLoop() {
d1663 1
a1663 1
@@@@ -300,7 +300,7 @@@@ void SyncerThread::ThreadMainLoop() {
d1672 1
a1672 1
@@@@ -704,7 +704,7 @@@@ int SyncerThread::UserIdleTime() {
d1682 1
a1682 1
index dddcac8..b6db53a 100644
d1685 1
a1685 1
@@@@ -21,7 +21,7 @@@@
d1694 1
a1694 1
@@@@ -310,7 +310,7 @@@@ class SyncerThread : public base::RefCountedThreadSafe<SyncerThread>,
d1696 1
a1696 1
   scoped_ptr<EventListenerHookup> syncer_events_;
d1703 20
a1722 39
diff --git a/chrome/browser/sync/notifier/base/nethelpers.cc b/chrome/browser/sync/notifier/base/nethelpers.cc
index e342479..f92b388 100644
--- chrome/browser/sync/notifier/base/nethelpers.cc
+++ chrome/browser/sync/notifier/base/nethelpers.cc
@@@@ -16,7 +16,7 @@@@ hostent* SafeGetHostByName(const char* hostname, hostent* host,
   if (!result) {
     *herrno = WSAGetLastError();
   }
-#elif OS_LINUX
+#elif OS_NIX
   gethostbyname_r(hostname, host, buffer, buffer_len, &result, herrno);
 #elif OS_MACOSX
   result = getipnodebyname(hostname, AF_INET, AI_DEFAULT, herrno);
@@@@ -31,7 +31,7 @@@@ hostent* SafeGetHostByName(const char* hostname, hostent* host,
 void FreeHostEnt(hostent* host) {
 #if WIN32
   // No need to free anything, struct returned is static memory.
-#elif OS_LINUX
+#elif OS_NIX
   // No need to free anything, we pass in a pointer to a struct.
 #elif OS_MACOSX
   freehostent(host);
diff --git a/chrome/browser/sync/notifier/base/network_status_detector_task_mt.cc b/chrome/browser/sync/notifier/base/network_status_detector_task_mt.cc
index e9f5971..da4a1c3 100644
--- chrome/browser/sync/notifier/base/network_status_detector_task_mt.cc
+++ chrome/browser/sync/notifier/base/network_status_detector_task_mt.cc
@@@@ -25,6 +25,7 @@@@ void NetworkStatusDetectorTaskMT::OnNetworkAliveDone(
 
 void NetworkStatusDetectorTaskMT::StartAsyncDetection(
     PlatformNetworkInfo* previous_info) {
+#if !defined(OS_FREEBSD)
   // Use the AsyncNetworkAlive to determine the network state (and changes in
   // the network state).
   AsyncNetworkAlive* network_alive = AsyncNetworkAlive::Create();
@@@@ -37,6 +38,7 @@@@ void NetworkStatusDetectorTaskMT::StartAsyncDetection(
   task->SignalWorkDone.connect(
       this, &NetworkStatusDetectorTaskMT::OnNetworkAliveDone);
   task->Start();
+#endif
a1723 55
 
 NetworkStatusDetectorTask* NetworkStatusDetectorTask::Create(
diff --git a/chrome/browser/sync/sync_setup_flow.cc b/chrome/browser/sync/sync_setup_flow.cc
index 595b3a3..4262520 100644
--- chrome/browser/sync/sync_setup_flow.cc
+++ chrome/browser/sync/sync_setup_flow.cc
@@@@ -59,7 +59,7 @@@@ void FlowHandler::RegisterMessages() {
       NewCallback(this, &FlowHandler::HandleUserClickedCustomize));
   // On OS X, the customize dialog is modal to the HTML window so we
   // don't need to hook up the two functions below.
-#if defined(OS_WIN) || defined(OS_LINUX)
+#if defined(OS_WIN) || defined(OS_NIX)
   dom_ui_->RegisterMessageCallback("ClickCustomizeOk",
       NewCallback(this, &FlowHandler::ClickCustomizeOk));
   dom_ui_->RegisterMessageCallback("ClickCustomizeCancel",
diff --git a/chrome/browser/sync/sync_setup_flow.h b/chrome/browser/sync/sync_setup_flow.h
index 35ac55e..f7b8ec7 100644
--- chrome/browser/sync/sync_setup_flow.h
+++ chrome/browser/sync/sync_setup_flow.h
@@@@ -15,7 +15,7 @@@@
 #include "chrome/browser/sync/sync_setup_wizard.h"
 #if defined(OS_WIN)
 #include "chrome/browser/views/options/customize_sync_window_view.h"
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_USES_GTK)
 #include "chrome/browser/gtk/options/customize_sync_window_gtk.h"
 #elif defined(OS_MACOSX)
 #include "chrome/browser/cocoa/sync_customize_controller_cppsafe.h"
@@@@ -87,7 +87,7 @@@@ class SyncSetupFlow : public HtmlDialogUIDelegate {
   void OnUserClickedCustomize() {
 #if defined(OS_WIN)
     CustomizeSyncWindowView::Show(NULL, service_->profile());
-#elif defined(OS_LINUX)
+#elif defined(OS_NIX)
     ShowCustomizeSyncWindow(service_->profile());
 #elif defined(OS_MACOSX)
     DCHECK(html_dialog_window_);
@@@@ -98,7 +98,7 @@@@ class SyncSetupFlow : public HtmlDialogUIDelegate {
   bool ClickCustomizeOk() {
 #if defined(OS_WIN)
     return CustomizeSyncWindowView::ClickOk();
-#elif defined(OS_LINUX)
+#elif defined(OS_NIX)
     return CustomizeSyncWindowOk();
 #else
     return true;
@@@@ -106,7 +106,7 @@@@ class SyncSetupFlow : public HtmlDialogUIDelegate {
   void ClickCustomizeCancel() {
 #if defined(OS_WIN)
     CustomizeSyncWindowView::ClickCancel();
-#elif defined(OS_LINUX)
+#elif defined(OS_NIX)
     CustomizeSyncWindowCancel();
 #endif
   }
d1725 1
a1725 1
index 920090c..592e5e5 100644
d1728 1
a1728 1
@@@@ -80,7 +80,7 @@@@ int64 Now() {
d1738 1
a1738 1
index 14eb26b..b82da15 100644
d1741 1
a1741 1
@@@@ -483,7 +483,7 @@@@ void InterstitialPage::CancelForNavigation() {
d1751 1
a1751 1
index 9a4f951..5d81c54 100644
d1754 2
a1755 2
@@@@ -793,7 +793,7 @@@@ bool RenderViewContextMenu::IsItemCommandEnabled(int id) const {
           WebContextMenuData::CheckableMenuItemEnabled;
d1760 3
a1762 3
     // Enable the input methods context menu if the content is editable.
     // TODO(suzhe): It should not be enabled in password boxes. Anyway,
     // it's not a big issue.
d1764 1
a1764 1
index b783b2c..9220304 100644
d1767 1
a1767 1
@@@@ -322,7 +322,7 @@@@ TabContents::TabContents(Profile* profile,
d1776 1
a1776 1
@@@@ -2872,7 +2872,7 @@@@ void TabContents::Observe(NotificationType type,
d1786 1
a1786 1
index e9219a3..fa98ffe 100644
d1789 1
a1789 1
@@@@ -847,7 +847,7 @@@@ TaskManagerBrowserProcessResource::TaskManagerBrowserProcessResource()
d1798 7
a1804 6
diff --git a/chrome/browser/unload_uitest.cc b/chrome/browser/unload_uitest.cc
index 62072f9..a0b8b7b 100644
--- chrome/browser/unload_uitest.cc
+++ chrome/browser/unload_uitest.cc
@@@@ -166,7 +166,7 @@@@ class UnloadTest : public UITest {
   }
d1806 4
a1809 18
   void ClickModalDialogButton(MessageBoxFlags::DialogButton button) {
-#if defined(OS_WIN) || defined(OS_LINUX)
+#if defined(OS_WIN) || defined(OS_NIX)
     bool modal_dialog_showing = false;
     MessageBoxFlags::DialogButton available_buttons;
     EXPECT_TRUE(automation()->WaitForAppModalDialog());
diff --git a/chrome/browser/views/app_launcher.cc b/chrome/browser/views/app_launcher.cc
index fd55086..63dde51 100644
--- chrome/browser/views/app_launcher.cc
+++ chrome/browser/views/app_launcher.cc
@@@@ -36,7 +36,7 @@@@
 #if defined(OS_WIN)
 #include "chrome/browser/autocomplete/autocomplete_edit_view_win.h"
 #include "chrome/browser/renderer_host/render_widget_host_view_win.h"
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_USES_GTK)
 #include "chrome/browser/autocomplete/autocomplete_edit_view_gtk.h"
 #include "chrome/browser/renderer_host/render_widget_host_view_gtk.h"
d1811 7
a1817 10
@@@@ -264,7 +264,7 @@@@ class NavigationBar : public views::View,
   views::NativeViewHost* location_entry_view_;
 #if defined(OS_WIN)
   scoped_ptr<AutocompleteEditViewWin> location_entry_;
-#elif defined(OS_LINUX) && defined(TOOLKIT_VIEWS)
+#elif defined(TOOLKIT_USES_GTK) && defined(TOOLKIT_VIEWS)
   scoped_ptr<AutocompleteEditViewGtk> location_entry_;
 #else
   NOTIMPLEMENTED();
@@@@ -396,7 +396,7 @@@@ AppLauncher::AppLauncher(Browser* browser)
a1818 2
   // On Windows, we'll create the RWHV HWND once we are attached as we need
   // to be parented for CreateWindow to work.
d1821 6
a1826 5
   RenderWidgetHostViewGtk* view_gtk =
       static_cast<RenderWidgetHostViewGtk*>(rwhv_);
   view_gtk->InitAsChild();
@@@@ -449,7 +449,7 @@@@ void AppLauncher::InfoBubbleClosing(InfoBubble* info_bubble,
 }
a1827 1
 void AppLauncher::RequestMove(const gfx::Rect& new_bounds) {
d1830 3
a1832 3
   // Invoking PositionChild results in a gtk signal that triggers attempting to
   // to resize the window. We need to set the size request so that it resizes
   // correctly when this happens.
d1834 1
a1834 1
index b5e5f2a..0b4339a 100644
d1837 1
a1837 1
@@@@ -30,7 +30,7 @@@@
d1846 1
a1846 1
@@@@ -98,7 +98,7 @@@@ void ShowBugReportView(views::Window* parent,
a1854 9
@@@@ -169,7 +169,7 @@@@ void BugReportView::SetupControl() {
 
   description_label_ = new views::Label(
       l10n_util::GetString(IDS_BUGREPORT_DESCRIPTION_LABEL));
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_GTK)
   // TODO(davemoore) Remove this when gtk textfields support multiline.
   description_text_ = new views::Textfield;
 #else
d1856 1
a1856 1
index 79c4bbe..79be833 100644
d1878 1
a1878 1
index 0d3f6e2..2610a41 100644
d1891 1
a1891 1
index 3127813..b499837 100644
d1894 1
a1894 1
@@@@ -258,7 +258,7 @@@@ DownloadItemView::DownloadItemView(DownloadItem* download,
d1903 1
a1903 1
@@@@ -267,7 +267,7 @@@@ DownloadItemView::DownloadItemView(DownloadItem* download,
d1913 1
a1913 1
index 963a81e..40d95dc 100644
d1926 1
a1926 1
index ab0032a..529d15b 100644
d1929 1
a1929 1
@@@@ -22,7 +22,7 @@@@
d1938 1
a1938 1
@@@@ -97,7 +97,7 @@@@ ExtensionPopup::ExtensionPopup(ExtensionHost* host,
d1970 1
a1970 1
index e0819e6..af68c0e 100644
d1982 49
d2032 1
a2032 1
index 1437c50..bd21ef4 100644
d2045 1
a2045 1
index dba7844..1913b9c 100644
d2057 1
a2057 1
@@@@ -64,7 +64,7 @@@@
d2060 1
a2060 1
 #include "chrome/browser/jumplist.h"
d2062 1
a2062 2
+#elif defined(TOOLKIT_GTK)
 #include "chrome/browser/gtk/accessible_widget_helper_gtk.h"
d2065 2
a2066 10
@@@@ -640,7 +640,7 @@@@ bool BrowserView::IsPositionInWindowCaption(const gfx::Point& point) {
 // BrowserView, BrowserWindow implementation:
 
 void BrowserView::Show() {
- #if defined(OS_LINUX)
+ #if defined(TOOLKIT_USES_GTK)
   if (!accessible_widget_helper_.get()) {
     accessible_widget_helper_.reset(new AccessibleWidgetHelper(
         GTK_WIDGET(GetWindow()->GetNativeWindow()), browser_->profile()));
@@@@ -1027,7 +1027,7 @@@@ void BrowserView::ShowProfileErrorDialog(int message_id) {
d2075 1
a2075 1
@@@@ -1910,7 +1910,7 @@@@ void BrowserView::ProcessFullscreen(bool fullscreen) {
a2083 22
diff --git a/chrome/browser/views/frame/browser_view.h b/chrome/browser/views/frame/browser_view.h
index 8b6c120..05a8434 100644
--- chrome/browser/views/frame/browser_view.h
+++ chrome/browser/views/frame/browser_view.h
@@@@ -56,7 +56,7 @@@@ class ZoomMenuModel;
 #if defined(OS_WIN)
 class AeroPeekManager;
 class JumpList;
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_USES_GTK)
 class AccessibleWidgetHelper;
 #endif
 
@@@@ -573,7 +573,7 @@@@ class BrowserView : public BrowserBubbleHost,
 
   UnhandledKeyboardEventHandler unhandled_keyboard_event_handler_;
 
- #if defined(OS_LINUX)
+ #if defined(TOOLKIT_USES_GTK)
   scoped_ptr<AccessibleWidgetHelper> accessible_widget_helper_;
  #endif
 
d2085 1
a2085 1
index 2b0f2e0..3d8e13a 100644
d2088 1
a2088 1
@@@@ -19,7 +19,7 @@@@
d2098 1
a2098 1
index c91cb51..77397cf 100644
d2111 1
a2111 1
index c12326a..f7d9afb 100644
d2173 1
a2173 1
index e5c4858..5d3d833 100644
d2176 1
a2176 1
@@@@ -216,7 +216,7 @@@@ void InfoBubble::Close() {
d2183 6
a2188 6
 #endif
       delegate_(NULL),
@@@@ -237,7 +237,7 @@@@ void InfoBubble::Init(views::Window* parent,
   set_window_style(WS_POPUP | WS_CLIPCHILDREN);
   set_window_ex_style(WS_EX_TOOLWINDOW);
   WidgetWin::Init(parent->GetNativeWindow(), gfx::Rect());
d2190 1
a2190 1
+#elif defined(TOOLKIT_GTK)
d2193 2
a2194 4
   WidgetGtk::Init(GTK_WIDGET(parent->GetNativeWindow()), gfx::Rect());
@@@@ -310,7 +310,7 @@@@ void InfoBubble::Init(views::Window* parent,
 #if defined(OS_WIN)
   border_->ShowWindow(SW_SHOW);
d2196 2
d2199 1
a2199 1
+#elif defined(TOOLKIT_GTK)
d2203 1
a2203 1
@@@@ -325,7 +325,7 @@@@ void InfoBubble::OnActivate(UINT action, BOOL minimized, HWND window) {
d2212 1
a2212 1
@@@@ -342,7 +342,7 @@@@ void InfoBubble::Close(bool closed_by_escape) {
d2222 1
a2222 1
index 90911b5..c6fd3b0 100644
d2225 2
a2226 2
@@@@ -9,7 +9,7 @@@@
 #include "views/accelerator.h"
d2234 1
a2234 1
@@@@ -88,7 +88,7 @@@@ class InfoBubbleDelegate {
d2242 2
a2243 2
       public views::AcceleratorTarget {
@@@@ -128,7 +128,7 @@@@ class InfoBubble
d2252 13
a2264 4
diff --git a/chrome/browser/views/location_bar_view.cc b/chrome/browser/views/location_bar_view.cc
index 324731f..1a67eb1 100644
--- chrome/browser/views/location_bar_view.cc
+++ chrome/browser/views/location_bar_view.cc
d2267 1
a2267 1
 #include "chrome/browser/views/location_bar_view.h"
d2270 1
a2270 1
+#if defined(TOOLKIT_GTK)
d2274 13
d2288 1
a2288 1
index 3919d5e..a72e92e 100644
d2291 1
a2291 1
@@@@ -35,7 +35,7 @@@@
d2301 1
a2301 1
index bfb02fa..23f0e2b 100644
a2329 22
diff --git a/chrome/browser/views/page_info_window_view.cc b/chrome/browser/views/page_info_window_view.cc
index 80d0db1..677a462 100644
--- chrome/browser/views/page_info_window_view.cc
+++ chrome/browser/views/page_info_window_view.cc
@@@@ -35,7 +35,7 @@@@
 
 #if defined(OS_WIN)
 #include "app/win_util.h"
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_GTK)
 #include "chrome/browser/gtk/certificate_viewer.h"
 #endif
 
@@@@ -359,7 +359,7 @@@@ void PageInfoWindowView::ShowCertDialog(int cert_id) {
   // This next call blocks but keeps processing windows messages, making it
   // modal to the browser window.
   BOOL rv = ::CryptUIDlgViewCertificate(&view_info, &properties_changed);
-#elif defined(OS_LINUX)
+#elif defined(TOOLKIT_GTK)
   ShowCertificateViewer(window()->GetNativeWindow(), cert_id);
 #else
   NOTIMPLEMENTED();
d2331 1
a2331 1
index 6b9306e..c973e01 100644
d2334 2
a2335 2
@@@@ -14,7 +14,7 @@@@
 #include "views/widget/widget.h"
d2344 1
a2344 1
index 8e770e2..901662d 100644
d2347 1
a2347 1
@@@@ -17,7 +17,7 @@@@
d2356 1
a2356 1
@@@@ -96,7 +96,7 @@@@ class DraggedTabView : public views::View,
d2366 1
a2366 1
index 56bf512..4839daf 100644
d2369 1
a2369 1
@@@@ -42,7 +42,7 @@@@
d2378 1
a2378 1
@@@@ -1194,7 +1194,7 @@@@ bool TabStrip::IsCursorInTabStripZone() const {
d2383 2
a2384 2
+#elif defined(TOOLKIT_GTK)
   // TODO: make sure this is right with multiple monitors.
d2388 1
a2388 1
index e1cbfda..f29d81a 100644
d2391 1
a2391 1
@@@@ -23,7 +23,7 @@@@ class TabStripModel;
a2399 13
diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc
index 97224d1..77ddaa8 100644
--- chrome/browser/views/toolbar_view.cc
+++ chrome/browser/views/toolbar_view.cc
@@@@ -791,7 +791,7 @@@@ void ToolbarView::SwitchToOtherMenuIfNeeded(
 }
 
 void ToolbarView::ActivateMenuButton(views::MenuButton* menu_button) {
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_USES_GTK)
   // Under GTK, opening a pop-up menu causes the main window to lose focus.
   // Focus is automatically returned when the menu closes.
   //
d2401 1
a2401 1
index 0674c0d..576dda2 100644
d2416 1
a2416 1
@@@@ -260,7 +260,7 @@@@ void CreateShortcutTask::Run() {
d2425 22
d2448 1
a2448 1
index cdeda42..7c5daaf 100644
d2451 14
a2464 1
@@@@ -70,7 +75,12 @@@@ void ZygoteHost::Init(const std::string& sandbox_cmd) {
d2477 19
a2495 3
@@@@ -218,6 +228,7 @@@@ pid_t ZygoteHost::ForkRenderer(
   if (HANDLE_EINTR(read(control_fd_, &pid, sizeof(pid))) != sizeof(pid))
     return base::kNullProcessHandle;
d2499 1
a2499 1
   if (using_suid_sandbox_) {
d2501 3
a2503 3
@@@@ -236,6 +247,7 @@@@ pid_t ZygoteHost::ForkRenderer(
   } else {
     base::AdjustOOMScore(pid, kRendererScore);
d2509 14
d2524 1
a2524 1
index 793c855..a77aedf 100644
d2554 13
a2566 1
@@@@ -207,7 +218,11 @@@@ class Zygote {
d2578 17
a2594 1
@@@@ -250,10 +265,13 @@@@ class Zygote {
d2608 1
a2608 1
@@@@ -547,6 +565,8 @@@@ static bool EnterSandbox() {
d2617 1
a2617 1
@@@@ -572,6 +592,7 @@@@ static bool EnterSandbox() {
d2626 1
a2626 1
index fef2da9..f88a373 100644
d2629 3
a2631 3
@@@@ -78,6 +78,10 @@@@
         'platform_locale_settings_grd':
             'app/resources/locale_settings_linux.grd',
d2640 1
a2640 1
@@@@ -558,7 +562,7 @@@@
d2649 12
a2660 11
@@@@ -754,7 +758,6 @@@@
         'browser/sync/notifier/base/async_dns_lookup.h',
         'browser/sync/notifier/base/async_network_alive.h',
         'browser/sync/notifier/base/fastalloc.h',
-        'browser/sync/notifier/base/linux/async_network_alive_linux.cc',
         'browser/sync/notifier/base/mac/network_status_detector_task_mac.h',
         'browser/sync/notifier/base/mac/network_status_detector_task_mac.cc',
         'browser/sync/notifier/base/nethelpers.cc',
@@@@ -1004,6 +1007,12 @@@@
             ],
           },
d2662 5
a2666 9
+        [ 'OS == "freebsd"', {
+          'dependencies': [
+            '../build/linux/system.gyp:gtk'
+          ],
+          'sources/': [['exclude', '^browser/sync/util/path_helpers_linux.cc$']],
+        }],
         ['OS=="mac"', {
           'link_settings': {
             'libraries': [
d2668 1
a2668 1
index 8e01b6f..d2ff48b 100644
d2671 2
a2672 2
@@@@ -2467,7 +2467,7 @@@@
             ['exclude', '^browser/chromeos'],
d2679 3
a2681 2
             # Temporarily disabled while we figure some stuff out.
@@@@ -2478,12 +2478,6 @@@@
a2682 1
             '../base/base.gyp:linux_versioninfo',
d2693 1
a2693 1
@@@@ -2539,6 +2533,9 @@@@
d2703 1
a2703 1
@@@@ -3047,7 +3044,7 @@@@
d2707 2
a2708 2
-            ['OS=="linux" and chromeos==0 and toolkit_views==0', {
+            ['(OS=="linux" or OS=="freebsd") and chromeos==0 and toolkit_views==0', {
d2713 1
a2713 1
index 774af6d..e0a2534 100755
d2716 1
a2716 1
@@@@ -201,6 +201,14 @@@@
d2732 1
a2732 1
index 1d74d00..908d17a 100644
d2735 1
a2735 1
@@@@ -125,7 +125,7 @@@@
d2743 2
a2744 2
           ],
@@@@ -170,7 +170,7 @@@@
d2753 1
a2753 1
@@@@ -194,7 +194,7 @@@@
d2762 1
a2762 1
@@@@ -229,7 +229,7 @@@@
d2771 1
a2771 1
@@@@ -333,7 +333,7 @@@@
d2780 2
a2781 2
@@@@ -1003,7 +1003,7 @@@@
             '../sandbox/sandbox.gyp:*',
d2787 1
a2787 1
             [ 'gcc_version==44', {
d2789 3
a2791 3
@@@@ -1331,7 +1331,7 @@@@
             },
           }
d2798 1
a2798 10
@@@@ -1363,7 +1363,7 @@@@
             'browser/chromeos/status/power_menu_button_browsertest.cc',
           ],
         }],
-        ['OS=="linux" and toolkit_views==0 and chromeos==0', {
+        ['(OS=="linux" or OS=="freebsd") and toolkit_views==0 and chromeos==0', {
           'sources': [
             'browser/extensions/browser_action_test_util_gtk.cc',
             'browser/gtk/view_id_util_browsertest.cc',
@@@@ -1420,7 +1420,7 @@@@
d2807 1
a2807 1
@@@@ -1490,7 +1490,7 @@@@
d2816 1
a2816 1
@@@@ -1516,7 +1516,7 @@@@
d2825 1
a2825 1
@@@@ -1553,7 +1553,7 @@@@
d2834 1
a2834 1
@@@@ -1587,7 +1587,7 @@@@
d2843 1
a2843 1
@@@@ -1726,7 +1726,7 @@@@
d2852 1
a2852 1
@@@@ -1795,7 +1795,7 @@@@
d2861 2
a2862 1
@@@@ -1804,7 +1804,7 @@@@
a2864 1
         # Linux-specific rules.
d2869 2
a2870 2
            ],
@@@@ -1874,7 +1874,7 @@@@
d2879 1
a2879 1
@@@@ -2013,7 +2013,7 @@@@
d2883 3
a2885 2
-    ['OS=="mac" or OS=="win" or (OS=="linux" and target_arch==python_arch '
+    ['OS=="mac" or OS=="win" or ((OS=="linux" or OS=="freebsd") and target_arch==python_arch '
d2890 1
a2890 1
index 47745f4..bf21ea3 100644
d2912 1
a2912 1
index 8796843..abb8c42 100644
d2915 2
a2916 2
@@@@ -167,7 +167,7 @@@@ bool PathProvider(int key, FilePath* result) {
       cur = cur.Append(FILE_PATH_LITERAL("net_internals"));
d2924 39
d2986 1
a2986 1
index a1028b2..5efba03 100644
d2989 1
a2989 1
@@@@ -1710,7 +1710,7 @@@@ IPC_BEGIN_MESSAGES(ViewHost)
d2998 1
a2998 1
@@@@ -1875,7 +1875,7 @@@@ IPC_BEGIN_MESSAGES(ViewHost)
d3007 60
a3066 13
diff --git a/chrome/common_constants.gypi b/chrome/common_constants.gypi
index e9a47c5..d17b05c 100644
--- chrome/common_constants.gypi
+++ chrome/common_constants.gypi
@@@@ -63,7 +63,7 @@@@
         '../base/base.gyp:base',
       ],
       'conditions': [
-        ['OS=="linux"', {
+        ['OS=="linux" or OS=="freebsd"', {
           'dependencies': ['../build/linux/system.gyp:gtk'],
         }],
       ],
d3068 1
a3068 1
index dcb16e9..579c570 100644
d3071 1
a3071 1
@@@@ -20,7 +20,7 @@@@
d3080 1
a3080 1
@@@@ -28,7 +28,7 @@@@ GpuThread::GpuThread() {
d3089 21
a3130 13
diff --git a/chrome/installer/installer_util.gypi b/chrome/installer/installer_util.gypi
index 528a5bf..3601bef 100644
--- chrome/installer/installer_util.gypi
+++ chrome/installer/installer_util.gypi
@@@@ -128,7 +128,7 @@@@
         },
       ],
     }],
-    ['OS=="linux"', {
+    ['OS=="linux" or OS=="freebsd"', {
       'targets': [
         {
           'target_name': 'installer_util',
d3145 1
a3145 1
index 688fe91..dc6707d 100644
d3152 2
a3153 2
-#if defined(OS_LINUX)
+#if defined(TOOLKIT_GTK)
d3155 3
a3157 3
 #endif
 
@@@@ -46,7 +46,7 @@@@ PluginThread::PluginThread()
d3166 30
a3195 17
@@@@ -222,7 +222,7 @@@@ bool GetPluginFinderURL(std::string* plugin_finder_url) {
 bool IsDefaultPluginEnabled() {
 #if defined(OS_WIN)
   return true;
-#elif defined(OS_LINUX)
+#elif defined(OS_NIX)
   // http://code.google.com/p/chromium/issues/detail?id=10952
   return false;
 #elif defined(OS_MACOSX)
diff --git a/chrome/renderer/render_process.cc b/chrome/renderer/render_process.cc
index 85c374e..25dd4f1 100644
--- chrome/renderer/render_process.cc
+++ chrome/renderer/render_process.cc
@@@@ -128,7 +128,7 @@@@ RenderProcess::~RenderProcess() {
 
 bool RenderProcess::InProcessPlugins() {
   const CommandLine& command_line = *CommandLine::ForCurrentProcess();
d3198 10
a3207 15
   // Plugin processes require a UI message loop, and the Linux message loop
   // implementation only allows one UI loop per process.
   if (command_line.HasSwitch(switches::kInProcessPlugins))
@@@@ -169,7 +169,7 @@@@ TransportDIB* RenderProcess::CreateTransportDIB(size_t size) {
 #if defined(OS_WIN) || defined(OS_LINUX)
   // Windows and Linux create transport DIBs inside the renderer
   return TransportDIB::Create(size, sequence_number_++);
-#elif defined(OS_MACOSX)  // defined(OS_WIN) || defined(OS_LINUX)
+#elif defined(OS_MACOSX) || defined(OS_FREEBSD) // defined(OS_WIN) || defined(OS_NIX)
   // Mac creates transport DIBs in the browser, so we need to do a sync IPC to
   // get one.  The TransportDIB is cached in the browser.
   TransportDIB::Handle handle;
@@@@ -186,7 +186,7 @@@@ void RenderProcess::FreeTransportDIB(TransportDIB* dib) {
   if (!dib)
     return;
a3208 9
-#if defined(OS_MACOSX)
+#if defined(OS_MACOSX) || defined(OS_FREEBSD)
   // On Mac we need to tell the browser that it can drop a reference to the
   // shared memory.
   IPC::Message* msg = new ViewHostMsg_FreeTransportDIB(dib->id());
@@@@ -204,7 +204,7 @@@@ skia::PlatformCanvas* RenderProcess::GetDrawingCanvas(
   int width = rect.width();
   int height = rect.height();
   const size_t stride = skia::PlatformCanvas::StrideForWidth(rect.width());
d3211 3
a3213 3
   const size_t max_size = base::SysInfo::MaxSharedMemorySize();
 #else
   const size_t max_size = 0;
d3215 1
a3215 1
index e82fed9..c82eb1d 100644
d3218 1
a3218 1
@@@@ -190,7 +190,7 @@@@ TransportDIB* RenderProcessImpl::CreateTransportDIB(size_t size) {
d3227 1
a3227 1
@@@@ -207,7 +207,7 @@@@ void RenderProcessImpl::FreeTransportDIB(TransportDIB* dib) {
d3236 1
a3236 1
@@@@ -225,7 +225,7 @@@@ skia::PlatformCanvas* RenderProcessImpl::GetDrawingCanvas(
d3246 1
a3246 1
index 3a0385a..b9da639 100644
d3249 1
a3249 1
@@@@ -878,7 +878,7 @@@@ void RenderThread::EnsureWebKitInitialized() {
d3258 1
a3258 1
@@@@ -953,7 +953,7 @@@@ void RenderThread::OnPurgeMemory() {
d3268 1
a3268 1
index c3a0190..c7a63bb 100644
d3271 3
a3273 3
@@@@ -873,7 +873,7 @@@@ class RenderView : public RenderWidget,
 
   void Print(WebKit::WebFrame* frame, bool script_initiated);
d3279 29
a3307 7
   void UpdateFontRenderingFromRendererPrefs() { }
diff --git a/chrome/renderer/renderer_main.cc b/chrome/renderer/renderer_main.cc
index 90a25ea..d9c782b 100644
--- chrome/renderer/renderer_main.cc
+++ chrome/renderer/renderer_main.cc
@@@@ -264,7 +264,7 @@@@ int RendererMain(const MainFunctionParams& parameters) {
   }
d3315 1
a3315 1
@@@@ -274,7 +274,7 @@@@ int RendererMain(const MainFunctionParams& parameters) {
d3338 1
a3338 1
index c5b042a..10cf59a 100644
d3341 3
a3343 3
@@@@ -33,7 +33,7 @@@@
 #include "third_party/WebKit/WebKit/chromium/public/WebVector.h"
 #include "webkit/glue/webkit_glue.h"
d3350 2
a3351 11
@@@@ -61,7 +61,7 @@@@ WebKit::WebMimeRegistry* RendererWebKitClientImpl::mimeRegistry() {
 }
 
 WebKit::WebSandboxSupport* RendererWebKitClientImpl::sandboxSupport() {
-#if defined(OS_WIN) || defined(OS_LINUX)
+#if defined(OS_WIN) || defined(OS_NIX)
   return &sandbox_support_;
 #else
   return NULL;
@@@@ -233,7 +233,7 @@@@ bool RendererWebKitClientImpl::SandboxSupport::ensureFontLoaded(HFONT font) {
   return RenderThread::current()->Send(new ViewHostMsg_LoadFont(logfont));
d3360 1
a3360 1
index 3606eaa..163332f 100644
d3363 1
a3363 1
@@@@ -13,7 +13,7 @@@@
d3372 1
a3372 1
@@@@ -81,7 +81,7 @@@@ class RendererWebKitClientImpl : public webkit_glue::WebKitClientImpl {
d3381 7
a3387 2
@@@@ -102,7 +102,7 @@@@ class RendererWebKitClientImpl : public webkit_glue::WebKitClientImpl {
   webkit_glue::WebClipboardImpl clipboard_;
d3389 3
a3391 4
   MimeRegistry mime_registry_;
-#if defined(OS_WIN) || defined(OS_LINUX)
+#if defined(OS_WIN) || defined(OS_NIX)
   SandboxSupport sandbox_support_;
d3394 29
a3422 5
diff --git a/chrome/renderer/webplugin_delegate_pepper.cc b/chrome/renderer/webplugin_delegate_pepper.cc
index 9d8d651..c8be9f1 100644
--- chrome/renderer/webplugin_delegate_pepper.cc
+++ chrome/renderer/webplugin_delegate_pepper.cc
@@@@ -997,7 +997,7 @@@@ int WebPluginDelegatePepper::PrintBegin(const gfx::Rect& printable_area,
d3424 41
a3464 6
 bool WebPluginDelegatePepper::PrintPage(int page_number,
                                         WebKit::WebCanvas* canvas) {
-#if defined(OS_WIN) || defined(OS_LINUX)
+#if defined(OS_WIN) || defined(OS_NIX)
   NPPPrintExtensions* print_extensions = GetPrintExtensions();
   if (!print_extensions)
a3465 2
@@@@ -1072,10 +1072,10 @@@@ bool WebPluginDelegatePepper::PrintPage(int page_number,
     canvas->drawBitmapRect(committed, &src_rect, dest_rect);
d3467 16
a3482 7
   return true;
-#else  // defined(OS_WIN) || defined(OS_LINUX)
+#else  // defined(OS_WIN) || defined(OS_NIX)
   NOTIMPLEMENTED();
   return false;
-#endif  // defined(OS_WIN) || defined(OS_LINUX)
+#endif  // defined(OS_WIN) || defined(OS_NIX)
d3485 58
a3542 1
 void WebPluginDelegatePepper::PrintEnd() {
d3544 1
a3544 1
index b3dce0f..1a1864e 100644
d3547 1
a3547 1
@@@@ -1271,7 +1271,7 @@@@ TEST_F(ExternalTabUITestPopupEnabled, UserGestureTargetBlank) {
d3556 1
a3556 1
@@@@ -1315,7 +1315,7 @@@@ TEST_F(AutomationProxyTest, AutocompleteParallelProxy) {
d3566 1
a3566 1
index 5f47df0..ca983e1 100644
d3569 2
a3570 2
@@@@ -83,7 +83,7 @@@@ ChromeProcessList GetRunningChromeProcesses(base::ProcessId browser_pid) {
 #endif
d3578 1
a3578 1
@@@@ -94,9 +94,9 @@@@ ChromeProcessList GetRunningChromeProcesses(base::ProcessId browser_pid) {
d3580 1
a3580 1
       result.push_back(process_entry->pid);
d3591 1
a3591 1
index 78ba891..54be333 100644
d3594 1
a3594 1
@@@@ -37,7 +37,7 @@@@
d3603 1
a3603 1
@@@@ -196,7 +196,7 @@@@ void InProcessBrowserTest::SetUp() {
d3613 1
a3613 1
index 603b7fa..920204a 100644
d3616 1
a3616 1
@@@@ -48,7 +48,7 @@@@
d3620 2
a3621 2
-    ['OS=="linux" and toolkit_views==0 and chromeos==0', {
+    ['(OS=="linux" or OS=="freebsd") and toolkit_views==0 and chromeos==0', {
d3624 1
a3624 1
         '<(DEPTH)/tools/xdisplaycheck/xdisplaycheck.gyp:xdisplaycheck',
d3626 1
a3626 1
index 96f678e..e3282fe 100644
d3629 1
a3629 1
@@@@ -292,7 +292,7 @@@@ class PageCyclerReferenceTest : public PageCyclerTest {
d3639 1
a3639 1
index 8d63696..5da2c7e 100644
d3642 1
a3642 1
@@@@ -159,7 +159,7 @@@@ class PageLoadTest : public UITest {
d3648 3
a3650 3
     // TODO(fmeawad): the version retrieved here belongs to the test module and
     // not the chrome binary, need to be changed to chrome binary instead.
     file_info.reset(FileVersionInfo::CreateFileVersionInfoForCurrentModule());
d3665 1
a3665 1
index ff9ec7e..adc3a4d 100644
d3668 2
a3669 2
@@@@ -198,7 +198,7 @@@@ TEST_F(StartupTest, PerfColdComplexTheme) {
                  false /* not important */, UITest::COMPLEX_THEME);
d3673 4
a3676 4
+#if defined(TOOLKIT_GTK)
 TEST_F(StartupTest, PerfColdGtkTheme) {
   RunStartupTest("warm", "gtk-theme", false /* warm */,
                  false /* not important */, UITest::NATIVE_THEME);
d3678 1
a3678 1
index b95b3a8..a035e1f 100644
d3681 1
a3681 1
@@@@ -47,7 +47,7 @@@@ class TestingBrowserProcess : public BrowserProcess {
d3691 1
a3691 1
index a69e2e2..bd63440 100644
d3694 1
a3694 1
@@@@ -20,7 +20,7 @@@@
d3703 1
a3703 1
@@@@ -286,7 +286,7 @@@@ webkit_database::DatabaseTracker* TestingProfile::GetDatabaseTracker() {
d3713 1
a3713 1
index 47f18a2..20b6986 100644
d3716 1
a3716 10
@@@@ -76,7 +76,7 @@@@ TEST_F(HistoryTester, DISABLED_VerifyHistoryLength3) {
                 kTestCompleteSuccess, action_max_timeout_ms());
 }
 
-#if defined(OS_WIN) || defined(OS_LINUX)
+#if defined(OS_WIN) || defined(OS_NIX)
 // Flaky, http://crbug.com/39785.
 TEST_F(HistoryTester, FLAKY_ConsiderRedirectAfterGestureAsUserInitiated) {
   // Test the history length for the following page transition.
@@@@ -110,7 +110,7 @@@@ TEST_F(HistoryTester, FLAKY_ConsiderRedirectAfterGestureAsUserInitiated) {
d3723 2
a3724 15
 // Flaky, http://crbug.com/39785.
 TEST_F(HistoryTester, FLAKY_ConsiderSlowRedirectAsUserInitiated) {
diff --git a/chrome/test/ui/npapi_test_helper.cc b/chrome/test/ui/npapi_test_helper.cc
index d5e24ad..8e80880 100644
--- chrome/test/ui/npapi_test_helper.cc
+++ chrome/test/ui/npapi_test_helper.cc
@@@@ -20,7 +20,7 @@@@ static const char kNpapiTestPluginName[] = "npapi_test_plugin.dll";
 #elif defined(OS_MACOSX)
 static const char kNpapiTestPluginName[] = "npapi_test_plugin.plugin";
 static const char kLayoutPluginName[] = "TestNetscapePlugIn.plugin";
-#elif defined(OS_LINUX)
+#elif defined(OS_NIX)
 static const char kNpapiTestPluginName[] = "libnpapi_test_plugin.so";
 #endif
 
d3739 1
a3739 1
index f5be28d..61e8d79 100644
d3752 1
a3752 1
index f9c5151..fce148a 100644
d3755 1
a3755 1
@@@@ -64,7 +64,7 @@@@ const wchar_t UITestBase::kFailedNoCrashService[] =
d3764 1
a3764 1
@@@@ -1478,7 +1478,7 @@@@ void UITestBase::PrintMemoryUsageInfo(const char* test_name) {
d3787 1
a3787 1
index 612d921..439ffc1 100644
d3790 1
a3790 1
@@@@ -331,7 +331,7 @@@@ void RunMessageLoop() {
d3800 1
a3800 1
index d4d3287..24e2a97 100644
d3823 1
a3823 1
index d300a5e..61d8f6e 100644
d3826 1
a3826 1
@@@@ -83,7 +83,7 @@@@ class WorkerTest : public UILayoutTest {
d3835 110
d3946 1
a3946 1
index da7172b..3921a52 100644
d3949 2
a3950 2
@@@@ -88,7 +88,7 @@@@
         '../third_party/glew/src/glew.c',
d3953 5
a3957 14
-        [ 'OS=="linux"',
+        [ 'OS=="linux" or OS=="freebsd"',
           {
             'all_dependent_settings': {
               'defines': [
@@@@ -286,7 +286,7 @@@@
         '<@@(gpu_service_source_files)',
       ],
       'conditions': [
-        ['OS == "linux"',
+        ['OS == "linux" or OS=="freebsd"',
           {
             'dependencies': [
               '../build/linux/system.gyp:gtk',
d3959 1
a3959 1
index 07141fe..a0fb0e5 100644
d3962 2
a3963 2
@@@@ -63,7 +63,7 @@@@
             '../views/views.gyp:views',
a3970 98
diff --git a/ipc/ipc_channel_posix.cc b/ipc/ipc_channel_posix.cc
index f6b19f7..c4f99f4 100644
--- ipc/ipc_channel_posix.cc
+++ ipc/ipc_channel_posix.cc
@@@@ -273,7 +273,7 @@@@ Channel::ChannelImpl::ChannelImpl(const std::string& channel_id, Mode mode,
       server_listen_pipe_(-1),
       pipe_(-1),
       client_pipe_(-1),
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
       fd_pipe_(-1),
       remote_fd_pipe_(-1),
 #endif
@@@@ -384,7 +384,7 @@@@ bool Channel::ChannelImpl::CreatePipe(const std::string& channel_id,
   scoped_ptr<Message> msg(new Message(MSG_ROUTING_NONE,
                                       HELLO_MESSAGE_TYPE,
                                       IPC::Message::PRIORITY_NORMAL));
-  #if defined(OS_LINUX)
+  #if defined(OS_NIX)
   if (!uses_fifo_) {
     // On Linux, the seccomp sandbox makes it very expensive to call
     // recvmsg() and sendmsg(). Often, we are perfectly OK with resorting to
@@@@ -460,7 +460,7 @@@@ bool Channel::ChannelImpl::ProcessIncomingMessages() {
       // Read from pipe.
       // recvmsg() returns 0 if the connection has closed or EAGAIN if no data
       // is waiting on the pipe.
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
       if (fd_pipe_ >= 0) {
         bytes_read = HANDLE_EINTR(read(pipe_, input_buf_,
                                        Channel::kReadBufferSize));
@@@@ -592,7 +592,7 @@@@ bool Channel::ChannelImpl::ProcessIncomingMessages() {
           if (m.header()->num_fds > num_fds - fds_i) {
             // the message has been completely received, but we didn't get
             // enough file descriptors.
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
             if (!uses_fifo_) {
               char dummy;
               struct iovec fd_pipe_iov = { &dummy, 1 };
@@@@ -677,7 +677,7 @@@@ bool Channel::ChannelImpl::ProcessIncomingMessages() {
           if (!m.ReadInt(&iter, &pid)) {
             NOTREACHED();
           }
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
           if (mode_ == MODE_SERVER && !uses_fifo_) {
             // On Linux, the Hello message from the client to the server
             // also contains the fd_pipe_, which  will be used for all
@@@@ -740,7 +740,7 @@@@ bool Channel::ChannelImpl::ProcessOutgoingMessages() {
   while (!output_queue_.empty()) {
     Message* msg = output_queue_.front();
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
     scoped_ptr<Message> hello;
     if (remote_fd_pipe_ != -1 &&
         msg->routing_id() == MSG_ROUTING_NONE &&
@@@@ -801,7 +801,7 @@@@ bool Channel::ChannelImpl::ProcessOutgoingMessages() {
       // num_fds < MAX_DESCRIPTORS_PER_MESSAGE so no danger of overflow.
       msg->header()->num_fds = static_cast<uint16>(num_fds);
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
       if (!uses_fifo_ &&
           (msg->routing_id() != MSG_ROUTING_NONE ||
            msg->type() != HELLO_MESSAGE_TYPE)) {
@@@@ -823,7 +823,7 @@@@ bool Channel::ChannelImpl::ProcessOutgoingMessages() {
 
     if (bytes_written == 1) {
       fd_written = pipe_;
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
       if (mode_ != MODE_SERVER && !uses_fifo_ &&
           msg->routing_id() == MSG_ROUTING_NONE &&
           msg->type() == HELLO_MESSAGE_TYPE) {
@@@@ -994,7 +994,7 @@@@ void Channel::ChannelImpl::Close() {
     Singleton<PipeMap>()->RemoveAndClose(pipe_name_);
     client_pipe_ = -1;
   }
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
   if (fd_pipe_ != -1) {
     HANDLE_EINTR(close(fd_pipe_));
     fd_pipe_ = -1;
diff --git a/ipc/ipc_channel_posix.h b/ipc/ipc_channel_posix.h
index dd45345..7cb4238 100644
--- ipc/ipc_channel_posix.h
+++ ipc/ipc_channel_posix.h
@@@@ -86,7 +86,7 @@@@ class Channel::ChannelImpl : public MessageLoopForIO::Watcher {
   // pipe_ that is passed to the client.
   int client_pipe_;
 
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
   // Linux uses a dedicated socketpair() for passing file descriptors.
   int fd_pipe_;
   int remote_fd_pipe_;
d3988 1
a3988 1
index 7fa286e..633d36b 100644
d4001 1
a4001 1
index 28e3bb6..d0d9e1d 100644
d4014 1
a4014 1
index c12aabf..f509df6 100644
d4017 1
a4017 1
@@@@ -389,7 +389,6 @@@@
d4025 36
d4062 1
a4062 1
index 84daae0..b22430d 100644
a4083 12
diff --git a/net/base/listen_socket.cc b/net/base/listen_socket.cc
index 88e9592..c2eb003 100644
--- net/base/listen_socket.cc
+++ net/base/listen_socket.cc
@@@@ -10,6 +10,7 @@@@
 #include <winsock2.h>
 #elif defined(OS_POSIX)
 #include <errno.h>
+#include <netinet/in.h>
 #include <sys/socket.h>
 #include <arpa/inet.h>
 #include "net/base/net_errors.h"
d4085 1
a4085 1
index eb224c3..24c915a 100644
a4095 35
diff --git a/net/base/mime_util.cc b/net/base/mime_util.cc
index aa3934b..6feef0e 100644
--- net/base/mime_util.cc
+++ net/base/mime_util.cc
@@@@ -189,7 +189,7 @@@@ static const char* const supported_media_types[] = {
   "audio/ogg",
   "application/ogg",
 
-#if defined(GOOGLE_CHROME_BUILD)
+//#if defined(GOOGLE_CHROME_BUILD)
   // MPEG-4.
   "video/mp4",
   "video/x-m4v",
@@@@ -200,7 +200,7 @@@@ static const char* const supported_media_types[] = {
   "audio/mp3",
   "audio/x-mp3",
   "audio/mpeg",
-#endif
+//#endif
 };
 
 // List of supported codecs when passed in with <source type="...">.
@@@@ -208,10 +208,10 @@@@ static const char* const supported_media_types[] = {
 // Refer to http://wiki.whatwg.org/wiki/Video_type_parameters#Browser_Support
 // for more information.
 static const char* const supported_media_codecs[] = {
-#if defined(GOOGLE_CHROME_BUILD)
+//#if defined(GOOGLE_CHROME_BUILD)
   "avc1",
   "mp4a",
-#endif
+//#endif
   "theora",
   "vorbis",
 };
d4097 1
a4097 1
index 099746b..7b3e6ed 100644
d4100 1
a4100 1
@@@@ -24,8 +24,9 @@@@
d4104 4
a4107 4
-#include <net/if.h>
 #include <sys/socket.h>
+#include <net/if.h>
+#include <netinet/in.h>
d4112 1
a4112 1
index aeca2ab..7ffc296 100644
d4115 1
a4115 1
@@@@ -24,7 +24,6 @@@@ NetworkChangeNotifier::CreateDefaultNetworkChangeNotifier() {
a4122 25
diff --git a/net/base/sys_addrinfo.h b/net/base/sys_addrinfo.h
index cfdd424..3f8c859 100644
--- net/base/sys_addrinfo.h
+++ net/base/sys_addrinfo.h
@@@@ -22,3 +22,7 @@@@
 #include <netdb.h>
 #endif
 
+#if defined(OS_FREEBSD)
+#include <netinet/in.h>
+#include <sys/socket.h>
+#endif
diff --git a/net/base/x509_certificate_unittest.cc b/net/base/x509_certificate_unittest.cc
index fb550ad..63ddd92 100644
--- net/base/x509_certificate_unittest.cc
+++ net/base/x509_certificate_unittest.cc
@@@@ -294,7 +294,7 @@@@ TEST(X509CertificateTest, PaypalNullCertParsing) {
   // Either the system crypto library should correctly report a certificate
   // name mismatch, or our certificate blacklist should cause us to report an
   // invalid certificate.
-#if defined(OS_LINUX) || defined(OS_WIN)
+#if !defined(OS_MACOSX)
   EXPECT_NE(0, verify_result.cert_status &
             (CERT_STATUS_COMMON_NAME_INVALID | CERT_STATUS_INVALID));
 #endif
d4124 1
a4124 1
index a0602e1..75e52f3 100644
d4127 1
a4127 1
@@@@ -110,11 +110,9 @@@@
d4139 1
a4139 3
@@@@ -543,6 +541,7 @@@@
             '../build/linux/system.gyp:gdk',
             '../build/linux/system.gyp:nss',
a4140 1
+          'sources!': [ 'proxy/proxy_config_service_linux.cc', ],
a4141 4
         [ 'OS == "win"', {
             'sources!': [
@@@@ -570,7 +569,7 @@@@
         ],
d4143 5
a4147 8
           },
-          {  # else: OS != "linux"
+          {  # else: OS != "linux" and OS != "freebsd"
             'sources!': [
               'ocsp/nss_ocsp.cc',
               'ocsp/nss_ocsp.h',
@@@@ -689,7 +688,6 @@@@
         'proxy/init_proxy_resolver_unittest.cc',
d4149 1
d4155 1
a4155 1
@@@@ -732,7 +730,7 @@@@
d4164 1
a4164 1
@@@@ -844,7 +842,7 @@@@
a4172 49
diff --git a/net/socket/tcp_client_socket_libevent.cc b/net/socket/tcp_client_socket_libevent.cc
index db00c55..dc1ad71 100644
--- net/socket/tcp_client_socket_libevent.cc
+++ net/socket/tcp_client_socket_libevent.cc
@@@@ -9,6 +9,9 @@@@
 #include <netdb.h>
 #include <sys/socket.h>
 #include <netinet/tcp.h>
+#if defined(OS_FREEBSD)
+#include <netinet/in.h>
+#endif
 
 #include "base/eintr_wrapper.h"
 #include "base/message_loop.h"
diff --git a/net/third_party/nss/nss.gyp b/net/third_party/nss/nss.gyp
index 1e7ef49..3ec44c0 100644
--- net/third_party/nss/nss.gyp
+++ net/third_party/nss/nss.gyp
@@@@ -4,7 +4,7 @@@@
 
 {
   'conditions': [
-    [ 'OS == "linux"', {
+    [ 'OS == "linux" or OS == "freebsd"', {
       'conditions': [
         ['sysroot!=""', {
           'variables': {
@@@@ -77,7 +77,7 @@@@
         'NO_NSPR_10_SUPPORT',
       ],
       'conditions': [
-        [ 'OS == "linux"', {
+        [ 'OS == "linux" or OS == "freebsd"', {
           'sources!': [
             'ssl/os2_err.c',
             'ssl/os2_err.h',
diff --git a/net/tools/hresolv/hresolv.cc b/net/tools/hresolv/hresolv.cc
index f092703..4c7a0b8 100644
--- net/tools/hresolv/hresolv.cc
+++ net/tools/hresolv/hresolv.cc
@@@@ -50,7 +50,7 @@@@ static const FlagName kAddrinfoFlagNames[] = {
   {AI_V4MAPPED, "AI_V4MAPPED"},
   {AI_ALL, "AI_ALL"},
   {AI_ADDRCONFIG, "AI_ADDRCONFIG"},
-#if defined(OS_LINUX) || defined(OS_WIN)
+#if !defined(OS_MACOSX)
   {AI_NUMERICSERV, "AI_NUMERICSERV"},
 #endif
 };
d4174 1
a4174 1
index 2e255a0..d4cbf49 100644
d4177 10
a4186 1
@@@@ -113,14 +113,12 @@@@
d4205 27
a4231 6
diff --git a/sandbox/sandbox.gyp b/sandbox/sandbox.gyp
index a835089..19a5714 100644
--- sandbox/sandbox.gyp
+++ sandbox/sandbox.gyp
@@@@ -126,6 +126,15 @@@@
     ],
d4233 1
d4235 2
a4236 10
+    [ 'OS=="freebsd"', {
+      # GYP requires that each file have at least one target defined.
+      'targets': [
+        {
+          'target_name': 'sandbox',
+          'type': 'settings',
+        },
+      ],
+    }],
     [ 'OS=="linux" and selinux==0', {
d4238 1
d4240 2
a4241 34
diff --git a/skia/ext/image_operations.cc b/skia/ext/image_operations.cc
index f6ee4ca..818846c 100644
--- skia/ext/image_operations.cc
+++ skia/ext/image_operations.cc
@@@@ -271,7 +271,7 @@@@ SkBitmap ImageOperations::ResizeSubpixel(const SkBitmap& source,
                                          const SkIRect& dest_subset) {
   // Currently only works on Linux because this is the only platform where
   // SkFontHost::GetSubpixelOrder is defined.
-#if defined(OS_LINUX)
+#if defined(OS_NIX)
   // Understand the display.
   const SkFontHost::LCDOrder order = SkFontHost::GetSubpixelOrder();
   const SkFontHost::LCDOrientation orientation =
@@@@ -361,7 +361,7 @@@@ SkBitmap ImageOperations::ResizeSubpixel(const SkBitmap& source,
   return result;
 #else
   return SkBitmap();
-#endif  // OS_LINUX
+#endif  // OS_NIX
 }
 
 // static
diff --git a/skia/skia.gyp b/skia/skia.gyp
index d9fb72e..ca01718 100644
--- skia/skia.gyp
+++ skia/skia.gyp
@@@@ -692,7 +692,7 @@@@
         '../third_party/skia/src/core',
       ],
       'conditions': [
-        [ 'OS == "linux" and target_arch != "arm"', {
+        [ '(OS == "linux" or OS == "freebsd") and target_arch != "arm"', {
           'cflags': [
             '-msse2',
d4243 8
a4250 55
diff --git a/third_party/bzip2/bzip2.gyp b/third_party/bzip2/bzip2.gyp
index c0f36e0..aa612bb 100644
--- third_party/bzip2/bzip2.gyp
+++ third_party/bzip2/bzip2.gyp
@@@@ -5,7 +5,7 @@@@
 {
   'variables': {
     'conditions': [
-      [ 'OS=="linux"', {
+      [ 'OS=="linux" or OS=="freebsd"', {
         # Link to system .so since we already use it due to GTK.
         'use_system_bzip2%': 1,
       }, {  # OS!="linux"
diff --git a/third_party/expat/expat.gyp b/third_party/expat/expat.gyp
index ab017f6..f8ff168 100644
--- third_party/expat/expat.gyp
+++ third_party/expat/expat.gyp
@@@@ -15,7 +15,7 @@@@
     ]
   },
   'conditions': [
-    ['OS=="linux"', {
+    ['OS=="linux" or OS=="freebsd"', {
       # On Linux, we implicitly already depend on expat via fontconfig;
       # let's not pull it in twice.
       'targets': [
@@@@ -59,7 +59,7 @@@@
                 'COMPILED_FROM_DSP',
               ],
             }],
-            ['OS=="mac"', {
+            ['OS=="mac" or OS=="freebsd"', {
               'defines': [
                 'HAVE_EXPAT_CONFIG_H',
               ],
diff --git a/third_party/ffmpeg/ffmpeg.gyp b/third_party/ffmpeg/ffmpeg.gyp
index 2b577cb..c6efe20 100644
--- third_party/ffmpeg/ffmpeg.gyp
+++ third_party/ffmpeg/ffmpeg.gyp
@@@@ -62,7 +62,7 @@@@
     'ffmpeg_variant%': '<(target_arch)',
 
     'use_system_ffmpeg%': 0,
-    'use_system_yasm%': 0,
+    'use_system_yasm%': 1,
     'build_ffmpegsumo%': 1,
 
     # Locations for generated artifacts.
@@@@ -127,11 +127,11 @@@@
             'source/patched-ffmpeg-mt/libavutil/pixdesc.c',
             'source/patched-ffmpeg-mt/libavutil/rational.c',
             # Config file for the OS and architecture.
-            'source/config/<(ffmpeg_branding)/<(OS)/<(ffmpeg_config)/config.h',
+            'source/config/<(ffmpeg_branding)/linux/<(ffmpeg_config)/config.h',
             'source/config/libavutil/avconfig.h',
d4252 6
a4257 151
           'include_dirs': [
-            'source/config/<(ffmpeg_branding)/<(OS)/<(ffmpeg_config)',
+            'source/config/<(ffmpeg_branding)/linux/<(ffmpeg_config)',
             'source/patched-ffmpeg-mt',
             'source/config',
           ],
@@@@ -757,7 +757,7 @@@@
 
           'conditions': [
             # Non-Mac platforms need libdl for dlopen() and friends.
-            ['OS!="mac"', {
+            ['OS!="mac" and OS!="freebsd"', {
               'link_settings': {
                 'libraries': [
                   '-ldl',
diff --git a/third_party/ffmpeg/source/config/Chrome/linux/ia32/config.h b/third_party/ffmpeg/source/config/Chrome/linux/ia32/config.h
index d53b272..efeb2b5 100644
--- third_party/ffmpeg/source/config/Chrome/linux/ia32/config.h
+++ third_party/ffmpeg/source/config/Chrome/linux/ia32/config.h
@@@@ -45,7 +45,7 @@@@
 #define HAVE_NEON 0
 #define HAVE_PPC4XX 0
 #define HAVE_SSE 1
-#define HAVE_SSSE3 1
+#define HAVE_SSSE3 0
 #define HAVE_VIS 0
 #define HAVE_BIGENDIAN 0
 #define HAVE_BEOSTHREADS 0
@@@@ -94,16 +94,16 @@@@
 #define HAVE_LLRINT 1
 #define HAVE_LOCAL_ALIGNED_16 1
 #define HAVE_LOCAL_ALIGNED_8 1
-#define HAVE_LOG2 1
-#define HAVE_LOG2F 1
+#define HAVE_LOG2 0
+#define HAVE_LOG2F 0
 #define HAVE_LOONGSON 0
 #define HAVE_LRINT 1
 #define HAVE_LRINTF 1
 #define HAVE_LZO1X_999_COMPRESS 0
 #define HAVE_MACHINE_IOCTL_BT848_H 0
 #define HAVE_MACHINE_IOCTL_METEOR_H 0
-#define HAVE_MALLOC_H 1
-#define HAVE_MEMALIGN 1
+#define HAVE_MALLOC_H 0
+#define HAVE_MEMALIGN 0
 #define HAVE_MKSTEMP 1
 #define HAVE_PLD 0
 #define HAVE_POSIX_MEMALIGN 1
diff --git a/third_party/ffmpeg/source/config/Chrome/linux/x64/config.h b/third_party/ffmpeg/source/config/Chrome/linux/x64/config.h
index 2d528b4..053ea45 100644
--- third_party/ffmpeg/source/config/Chrome/linux/x64/config.h
+++ third_party/ffmpeg/source/config/Chrome/linux/x64/config.h
@@@@ -45,7 +45,7 @@@@
 #define HAVE_NEON 0
 #define HAVE_PPC4XX 0
 #define HAVE_SSE 1
-#define HAVE_SSSE3 1
+#define HAVE_SSSE3 0
 #define HAVE_VIS 0
 #define HAVE_BIGENDIAN 0
 #define HAVE_BEOSTHREADS 0
@@@@ -94,16 +94,16 @@@@
 #define HAVE_LLRINT 1
 #define HAVE_LOCAL_ALIGNED_16 1
 #define HAVE_LOCAL_ALIGNED_8 1
-#define HAVE_LOG2 1
-#define HAVE_LOG2F 1
+#define HAVE_LOG2 0
+#define HAVE_LOG2F 0
 #define HAVE_LOONGSON 0
 #define HAVE_LRINT 1
 #define HAVE_LRINTF 1
 #define HAVE_LZO1X_999_COMPRESS 0
 #define HAVE_MACHINE_IOCTL_BT848_H 0
 #define HAVE_MACHINE_IOCTL_METEOR_H 0
-#define HAVE_MALLOC_H 1
-#define HAVE_MEMALIGN 1
+#define HAVE_MALLOC_H 0
+#define HAVE_MEMALIGN 0
 #define HAVE_MKSTEMP 1
 #define HAVE_PLD 0
 #define HAVE_POSIX_MEMALIGN 1
diff --git a/third_party/ffmpeg/source/config/Chromium/linux/ia32/config.h b/third_party/ffmpeg/source/config/Chromium/linux/ia32/config.h
index c11882d..1f77aab 100644
--- third_party/ffmpeg/source/config/Chromium/linux/ia32/config.h
+++ third_party/ffmpeg/source/config/Chromium/linux/ia32/config.h
@@@@ -45,7 +45,7 @@@@
 #define HAVE_NEON 0
 #define HAVE_PPC4XX 0
 #define HAVE_SSE 1
-#define HAVE_SSSE3 1
+#define HAVE_SSSE3 0
 #define HAVE_VIS 0
 #define HAVE_BIGENDIAN 0
 #define HAVE_BEOSTHREADS 0
@@@@ -94,16 +94,16 @@@@
 #define HAVE_LLRINT 1
 #define HAVE_LOCAL_ALIGNED_16 1
 #define HAVE_LOCAL_ALIGNED_8 1
-#define HAVE_LOG2 1
-#define HAVE_LOG2F 1
+#define HAVE_LOG2 0
+#define HAVE_LOG2F 0
 #define HAVE_LOONGSON 0
 #define HAVE_LRINT 1
 #define HAVE_LRINTF 1
 #define HAVE_LZO1X_999_COMPRESS 0
 #define HAVE_MACHINE_IOCTL_BT848_H 0
 #define HAVE_MACHINE_IOCTL_METEOR_H 0
-#define HAVE_MALLOC_H 1
-#define HAVE_MEMALIGN 1
+#define HAVE_MALLOC_H 0
+#define HAVE_MEMALIGN 0
 #define HAVE_MKSTEMP 1
 #define HAVE_PLD 0
 #define HAVE_POSIX_MEMALIGN 1
diff --git a/third_party/ffmpeg/source/config/Chromium/linux/x64/config.h b/third_party/ffmpeg/source/config/Chromium/linux/x64/config.h
index e834a9d..e4aef46 100644
--- third_party/ffmpeg/source/config/Chromium/linux/x64/config.h
+++ third_party/ffmpeg/source/config/Chromium/linux/x64/config.h
@@@@ -45,7 +45,7 @@@@
 #define HAVE_NEON 0
 #define HAVE_PPC4XX 0
 #define HAVE_SSE 1
-#define HAVE_SSSE3 1
+#define HAVE_SSSE3 0
 #define HAVE_VIS 0
 #define HAVE_BIGENDIAN 0
 #define HAVE_BEOSTHREADS 0
@@@@ -94,16 +94,16 @@@@
 #define HAVE_LLRINT 1
 #define HAVE_LOCAL_ALIGNED_16 1
 #define HAVE_LOCAL_ALIGNED_8 1
-#define HAVE_LOG2 1
-#define HAVE_LOG2F 1
+#define HAVE_LOG2 0
+#define HAVE_LOG2F 0
 #define HAVE_LOONGSON 0
 #define HAVE_LRINT 1
 #define HAVE_LRINTF 1
 #define HAVE_LZO1X_999_COMPRESS 0
 #define HAVE_MACHINE_IOCTL_BT848_H 0
 #define HAVE_MACHINE_IOCTL_METEOR_H 0
-#define HAVE_MALLOC_H 1
-#define HAVE_MEMALIGN 1
+#define HAVE_MALLOC_H 0
+#define HAVE_MEMALIGN 0
 #define HAVE_MKSTEMP 1
 #define HAVE_PLD 0
 #define HAVE_POSIX_MEMALIGN 1
d4259 1
a4259 1
index d987695..ed2ac29 100644
d4262 1
a4262 1
@@@@ -107,7 +107,7 @@@@ void* NSGLGetProcAddress (const GLubyte *name)
d4271 1
a4271 1
@@@@ -143,7 +143,7 @@@@ void* dlGetProcAddress (const GLubyte* name)
a4560 63
diff --git a/third_party/libjingle/files/talk/base/httpcommon.cc b/third_party/libjingle/files/talk/base/httpcommon.cc
index 0358121..1eec46b 100644
--- third_party/libjingle/files/talk/base/httpcommon.cc
+++ third_party/libjingle/files/talk/base/httpcommon.cc
@@@@ -369,7 +369,7 @@@@ bool HttpDateToSeconds(const std::string& date, unsigned long* seconds) {
     }
     gmt = non_gmt + kTimeZoneOffsets[zindex] * 60 * 60;
   }
-#ifdef OSX
+#if defined(OSX) || defined(BSD)
   tm *tm_for_timezone = localtime((time_t *)&gmt);
   *seconds = gmt + tm_for_timezone->tm_gmtoff;
 #else
diff --git a/third_party/libjingle/libjingle.gyp b/third_party/libjingle/libjingle.gyp
index f501c6c..8380c9e 100644
--- third_party/libjingle/libjingle.gyp
+++ third_party/libjingle/libjingle.gyp
@@@@ -46,6 +46,11 @@@@
           'POSIX',
         ],
       }],
+      ['OS=="freebsd"', {
+        'defines': [
+          'BSD',
+        ],
+      }],
     ],
   },
   'targets': [
diff --git a/third_party/libjpeg/libjpeg.gyp b/third_party/libjpeg/libjpeg.gyp
index 1b0798b..020c5f4 100644
--- third_party/libjpeg/libjpeg.gyp
+++ third_party/libjpeg/libjpeg.gyp
@@@@ -5,10 +5,10 @@@@
 {
   'variables': {
     'conditions': [
-      [ 'OS=="linux"', {
+      [ 'OS=="linux" or OS=="freebsd"', {
         # Link to system .so since we already use it due to GTK.
         'use_system_libjpeg%': 1,
-      }, {  # OS!="linux"
+      }, {  # OS!="linux" and OS!="freebsd"
         'use_system_libjpeg%': 0,
       }],
     ],
diff --git a/third_party/libpng/libpng.gyp b/third_party/libpng/libpng.gyp
index d29d8c1..09a9805 100644
--- third_party/libpng/libpng.gyp
+++ third_party/libpng/libpng.gyp
@@@@ -5,10 +5,10 @@@@
 {
   'variables': {
     'conditions': [
-      [ 'OS=="linux"', {
+      [ 'OS=="linux" or OS=="freebsd"', {
         # Link to system .so since we already use it due to GTK.
         'use_system_libpng%': 1,
-      }, {  # OS!="linux"
+      }, {  # OS!="linux" and OS!="freebsd"
         'use_system_libpng%': 0,
       }],
     ],
d4562 1
a4562 1
index 7dda868..7a749d9 100644
d4565 1
a4565 1
@@@@ -17,7 +17,7 @@@@
d4569 2
a4570 2
-        ['OS=="linux" and use_system_libxslt', {
+        ['(OS=="linux" or OS=="freebsd") and use_system_libxslt', {
d4574 13
a4586 35
diff --git a/third_party/npapi/npapi.gyp b/third_party/npapi/npapi.gyp
index 3e761de..1c46f46 100644
--- third_party/npapi/npapi.gyp
+++ third_party/npapi/npapi.gyp
@@@@ -24,7 +24,7 @@@@
         'bindings/npruntime.h',
       ],
       'conditions': [
-        ['OS=="linux"', {
+        ['OS=="linux" or OS=="freebsd"', {
           'sources': [
             'bindings/npapi_x11.h',
           ],
diff --git a/third_party/sqlite/sqlite.gyp b/third_party/sqlite/sqlite.gyp
index d0cc7ec..4fa10b3 100644
--- third_party/sqlite/sqlite.gyp
+++ third_party/sqlite/sqlite.gyp
@@@@ -29,7 +29,7 @@@@
             ],
           },
         }],
-        ['OS=="linux" and use_system_sqlite', {
+        ['(OS=="linux" or OS=="freebsd") and use_system_sqlite', {
           'type': 'settings',
           'direct_dependent_settings': {
             'cflags': [
@@@@ -226,7 +226,7 @@@@
     },
   ],
   'conditions': [
-    ['OS=="linux" and not use_system_sqlite', {
+    ['(OS=="linux" or OS=="freebsd") and not use_system_sqlite', {
       'targets': [
         {
           'target_name': 'sqlite_shell',
d4840 147
a4986 43
diff --git a/third_party/tcmalloc/tcmalloc.gyp b/third_party/tcmalloc/tcmalloc.gyp
index 8c86b3d..8d4849d 100644
--- third_party/tcmalloc/tcmalloc.gyp
+++ third_party/tcmalloc/tcmalloc.gyp
@@@@ -205,7 +205,7 @@@@
             'tcmalloc/src/profiler.cc',
           ],
         }],
-        ['OS=="linux"', {
+        ['OS=="linux" or OS=="freebsd"', {
           'sources!': [
             'page_heap.cc',
             'port.cc',
diff --git a/third_party/zlib/zlib.gyp b/third_party/zlib/zlib.gyp
index 36613a7..6cf0efa 100644
--- third_party/zlib/zlib.gyp
+++ third_party/zlib/zlib.gyp
@@@@ -5,10 +5,10 @@@@
 {
   'variables': {
     'conditions': [
-      [ 'OS=="linux"', {
+      [ 'OS=="linux" or OS=="freebsd"', {
         # Link to system .so since we already use it due to GTK.
         'use_system_zlib%': 1,
-      }, {  # OS!="linux"
+      }, {  # OS!="linux" and OS!="freebsd"
         'use_system_zlib%': 0,
       }],
     ],
diff --git a/webkit/glue/webkit_resources.grd b/webkit/glue/webkit_resources.grd
index 2d2df0f..4b3ff7a 100644
--- webkit/glue/webkit_resources.grd
+++ webkit/glue/webkit_resources.grd
@@@@ -27,7 +27,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' or os == 'freebsd7' or os == 'openbsd4' or os == 'sunos5'">
+      <if expr="os == 'linux2' or os.find('bsd') != -1 or os == 'sunos5'">
         <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" />
d4988 1
a4988 1
index 2ac34f8..671ac8a 100644
d4991 1
a4991 1
@@@@ -40,7 +40,7 @@@@
d5000 13
a5012 12
diff --git a/webkit/tools/test_shell/test_shell.gypi b/webkit/tools/test_shell/test_shell.gypi
index 84c085f..9c94deb 100644
--- webkit/tools/test_shell/test_shell.gypi
+++ webkit/tools/test_shell/test_shell.gypi
@@@@ -504,6 +504,7 @@@@
       ],
       'include_dirs': [
         '../../..',
+        '/usr/local/include',
       ],
       'dependencies': [
         '<(DEPTH)/third_party/npapi/npapi.gyp:npapi',
@

