Initial gtk3 support

Currently we're sticking with deprecated apis to make it easier to support both gtk2 and gtk3. If Chrome ever drops gtk2 support, it might be a good idea to do a complete port.

BUG=132847
R=erg@chromium.org,estade@chromium.org

Review URL: https://codereview.chromium.org/1234223005

Cr-Commit-Position: refs/heads/master@{#348339}
diff --git a/AUTHORS b/AUTHORS
index 52ba2b9..e04571c 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -309,6 +309,7 @@
 Keene Pan <keenepan@linpus.com>
 Keith Chen <keitchen@amazon.com>
 Kenneth Rohde Christiansen <kenneth.r.christiansen@intel.com>
+Kenneth Zhou <knthzh@gmail.com>
 Keonho Kim <keonho07.kim@samsung.com>
 Ketan Goyal <ketan.goyal@samsung.com>
 Kevin Lee Helpingstine <sig11@reprehensible.net>
diff --git a/chrome/browser/ui/libgtk2ui/chrome_gtk_frame.cc b/chrome/browser/ui/libgtk2ui/chrome_gtk_frame.cc
index c69e609..67d54c5 100644
--- a/chrome/browser/ui/libgtk2ui/chrome_gtk_frame.cc
+++ b/chrome/browser/ui/libgtk2ui/chrome_gtk_frame.cc
@@ -4,6 +4,8 @@
 
 #include "chrome/browser/ui/libgtk2ui/chrome_gtk_frame.h"
 
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+
 G_BEGIN_DECLS
 
 // MetaFrames declaration
diff --git a/chrome/browser/ui/libgtk2ui/gtk2_border.cc b/chrome/browser/ui/libgtk2ui/gtk2_border.cc
index 8839f0b..a00c725 100644
--- a/chrome/browser/ui/libgtk2ui/gtk2_border.cc
+++ b/chrome/browser/ui/libgtk2ui/gtk2_border.cc
@@ -16,7 +16,6 @@
 #include "ui/gfx/geometry/rect.h"
 #include "ui/gfx/image/image_skia_source.h"
 #include "ui/gfx/skia_util.h"
-#include "ui/views/controls/button/blue_button.h"
 #include "ui/views/controls/button/label_button.h"
 #include "ui/views/controls/button/label_button_border.h"
 #include "ui/views/native_theme_delegate.h"
@@ -26,46 +25,6 @@
 
 namespace libgtk2ui {
 
-namespace {
-
-const int kNumberOfFocusedStates = 2;
-
-class ButtonImageSkiaSource : public gfx::ImageSkiaSource {
- public:
-  ButtonImageSkiaSource(const Gtk2UI* gtk2_ui,
-                        const GtkStateType state,
-                        const bool focused,
-                        const bool call_to_action,
-                        const gfx::Size& size)
-      : gtk2_ui_(gtk2_ui),
-        state_(state),
-        focused_(focused),
-        call_to_action_(call_to_action),
-        size_(size) {
-  }
-
-  ~ButtonImageSkiaSource() override {}
-
-  gfx::ImageSkiaRep GetImageForScale(float scale) override {
-    int w = size_.width() * scale;
-    int h = size_.height() * scale;
-    return gfx::ImageSkiaRep(
-        gtk2_ui_->DrawGtkButtonBorder(state_, focused_, call_to_action_, w, h),
-        scale);
-  }
-
- private:
-  const Gtk2UI* gtk2_ui_;
-  const GtkStateType state_;
-  const bool focused_;
-  const bool call_to_action_;
-  const gfx::Size size_;
-
-  DISALLOW_COPY_AND_ASSIGN(ButtonImageSkiaSource);
-};
-
-}  // namespace
-
 Gtk2Border::Gtk2Border(Gtk2UI* gtk2_ui,
                        views::LabelButton* owning_button,
                        scoped_ptr<views::LabelButtonBorder> border)
@@ -119,7 +78,7 @@
 
 void Gtk2Border::OnNativeThemeUpdated(ui::NativeTheme* observed_theme) {
   DCHECK_EQ(observed_theme, NativeThemeGtk2::instance());
-  for (int i = 0; i < kNumberOfFocusedStates; ++i) {
+  for (int i = 0; i < 2; ++i) {
     for (int j = 0; j < views::Button::STATE_COUNT; ++j) {
       button_images_[i][j] = gfx::ImageSkia();
     }
@@ -141,16 +100,11 @@
     gfx::ImageSkia* image = &button_images_[focused][views_state];
 
     if (image->isNull() || image->size() != rect.size()) {
-      bool call_to_action = owning_button_->GetClassName() ==
-          views::BlueButton::kViewClassName;
-      GtkStateType gtk_state = GetGtkState(state);
-      *image = gfx::ImageSkia(
-          new ButtonImageSkiaSource(gtk2_ui_,
-                                    gtk_state,
-                                    focused,
-                                    call_to_action,
-                                    rect.size()),
-          rect.size());
+      *image = gfx::ImageSkia::CreateFrom1xBitmap(
+          gtk2_ui_->DrawGtkButtonBorder(owning_button_->GetClassName(),
+                                        state,
+                                        rect.width(),
+                                        rect.height()));
     }
     canvas->DrawImageInt(*image, rect.x(), rect.y());
   }
diff --git a/chrome/browser/ui/libgtk2ui/gtk2_key_bindings_handler.cc b/chrome/browser/ui/libgtk2ui/gtk2_key_bindings_handler.cc
index eec9dde..aad16cc 100644
--- a/chrome/browser/ui/libgtk2ui/gtk2_key_bindings_handler.cc
+++ b/chrome/browser/ui/libgtk2ui/gtk2_key_bindings_handler.cc
@@ -61,7 +61,14 @@
   edit_commands_.clear();
   // If this key event matches a predefined key binding, corresponding signal
   // will be emitted.
-  gtk_bindings_activate_event(GTK_OBJECT(handler_.get()), &gdk_event);
+
+  gtk_bindings_activate_event(
+#if GDK_MAJOR_VERSION >= 3
+      G_OBJECT(handler_.get()),
+#else
+      GTK_OBJECT(handler_.get()),
+#endif
+      &gdk_event);
 
   bool matched = !edit_commands_.empty();
   if (edit_commands)
@@ -123,7 +130,7 @@
     gdk_event->group = 0;
   }
 
-  gdk_event->keyval = GDK_VoidSymbol;
+  gdk_event->keyval = GDK_KEY_VoidSymbol;
   gdk_keymap_translate_keyboard_state(
       keymap,
       gdk_event->hardware_keycode,
diff --git a/chrome/browser/ui/libgtk2ui/gtk2_status_icon.cc b/chrome/browser/ui/libgtk2ui/gtk2_status_icon.cc
index be66aa6..ef1a680 100644
--- a/chrome/browser/ui/libgtk2ui/gtk2_status_icon.cc
+++ b/chrome/browser/ui/libgtk2ui/gtk2_status_icon.cc
@@ -12,6 +12,8 @@
 #include "ui/base/models/menu_model.h"
 #include "ui/gfx/image/image_skia.h"
 
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+
 namespace libgtk2ui {
 
 Gtk2StatusIcon::Gtk2StatusIcon(const gfx::ImageSkia& image,
diff --git a/chrome/browser/ui/libgtk2ui/gtk2_ui.cc b/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
index 21e7ce3..43f7954 100644
--- a/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
+++ b/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
@@ -21,7 +21,6 @@
 #include "base/strings/stringprintf.h"
 #include "chrome/browser/themes/theme_properties.h"
 #include "chrome/browser/ui/libgtk2ui/app_indicator_icon.h"
-#include "chrome/browser/ui/libgtk2ui/chrome_gtk_frame.h"
 #include "chrome/browser/ui/libgtk2ui/gtk2_border.h"
 #include "chrome/browser/ui/libgtk2ui/gtk2_event_loop.h"
 #include "chrome/browser/ui/libgtk2ui/gtk2_key_bindings_handler.h"
@@ -52,6 +51,7 @@
 #include "ui/gfx/skia_util.h"
 #include "ui/native_theme/native_theme.h"
 #include "ui/resources/grit/ui_resources.h"
+#include "ui/views/controls/button/blue_button.h"
 #include "ui/views/controls/button/label_button.h"
 #include "ui/views/controls/button/label_button_border.h"
 #include "ui/views/linux_ui/window_button_order_observer.h"
@@ -87,7 +87,9 @@
 };
 struct GtkIconInfoDeleter {
   void operator()(GtkIconInfo* ptr) {
+    G_GNUC_BEGIN_IGNORE_DEPRECATIONS
     gtk_icon_info_free(ptr);
+    G_GNUC_END_IGNORE_DEPRECATIONS
   }
 };
 typedef scoped_ptr<GIcon, GObjectDeleter> ScopedGIcon;
@@ -107,13 +109,6 @@
 const int kToolbarImageWidth = 64;
 const int kToolbarImageHeight = 128;
 
-// How much to tint the GTK+ color lighter at the top of the window.
-const color_utils::HSL kGtkFrameShift = { -1, -1, 0.58 };
-
-// How much to tint the GTK+ color when an explicit frame color hasn't been
-// specified.
-const color_utils::HSL kDefaultFrameShift = { -1, -1, 0.4 };
-
 // Values used as the new luminance and saturation values in the inactive tab
 // text color.
 const double kDarkInactiveLuminance = 0.85;
@@ -121,12 +116,6 @@
 const double kHeavyInactiveSaturation = 0.7;
 const double kLightInactiveSaturation = 0.3;
 
-// Default color for links on the NTP when the GTK+ theme doesn't define a
-// link color. Constant taken from gtklinkbutton.c.
-const GdkColor kDefaultLinkColor = { 0, 0, 0, 0xeeee };
-
-const int kSkiaToGDKMultiplier = 257;
-
 // TODO(erg): ThemeService has a whole interface just for reading default
 // constants. Figure out what to do with that more long term; for now, just
 // copy the constants themselves here.
@@ -181,21 +170,21 @@
 struct IDRGtkMapping {
   int idr;
   const char* stock_id;
-  GtkStateType gtk_state;
+  bool enabled;
 } const kGtkIcons[] = {
-  { IDR_BACK,      GTK_STOCK_GO_BACK,    GTK_STATE_NORMAL },
-  { IDR_BACK_D,    GTK_STOCK_GO_BACK,    GTK_STATE_INSENSITIVE },
+  { IDR_BACK,      "go-previous",  true },
+  { IDR_BACK_D,    "go-previous",  false },
 
-  { IDR_FORWARD,   GTK_STOCK_GO_FORWARD, GTK_STATE_NORMAL },
-  { IDR_FORWARD_D, GTK_STOCK_GO_FORWARD, GTK_STATE_INSENSITIVE },
+  { IDR_FORWARD,   "go-next",      true },
+  { IDR_FORWARD_D, "go-next",      false },
 
-  { IDR_HOME,      GTK_STOCK_HOME,       GTK_STATE_NORMAL },
+  { IDR_HOME,      "go-home",      true },
 
-  { IDR_RELOAD,    GTK_STOCK_REFRESH,    GTK_STATE_NORMAL },
-  { IDR_RELOAD_D,  GTK_STOCK_REFRESH,    GTK_STATE_INSENSITIVE },
+  { IDR_RELOAD,    "view-refresh", true },
+  { IDR_RELOAD_D,  "view-refresh", false },
 
-  { IDR_STOP,      GTK_STOCK_STOP,       GTK_STATE_NORMAL },
-  { IDR_STOP_D,    GTK_STOCK_STOP,       GTK_STATE_INSENSITIVE },
+  { IDR_STOP,      "process-stop", true },
+  { IDR_STOP_D,    "process-stop", false },
 };
 
 // The image resources that will be tinted by the 'button' tint value.
@@ -229,28 +218,37 @@
   return images.count(id) > 0;
 }
 
+// Get ChromeGtkFrame theme colors. No-op in GTK3.
+void GetChromeStyleColor(const char* style_property, SkColor* ret_color) {
+#if GTK_MAJOR_VERSION == 2
+  GdkColor* style_color = NULL;
+
+  gtk_widget_style_get(NativeThemeGtk2::instance()->GetWindow(),
+                       style_property, &style_color,
+                       NULL);
+
+  if (style_color) {
+    *ret_color = GdkColorToSkColor(*style_color);
+    gdk_color_free(style_color);
+  }
+#endif
+}
+
 // Picks a button tint from a set of background colors. While
-// |accent_gdk_color| will usually be the same color through a theme, this
+// |accent_color| will usually be the same color through a theme, this
 // function will get called with the normal GtkLabel |text_color|/GtkWindow
 // |background_color| pair and the GtkEntry |text_color|/|background_color|
 // pair. While 3/4 of the time the resulting tint will be the same, themes that
 // have a dark window background (with light text) and a light text entry (with
 // dark text) will get better icons with this separated out.
-void PickButtonTintFromColors(const GdkColor& accent_gdk_color,
-                              const GdkColor& text_color,
-                              const GdkColor& background_color,
+void PickButtonTintFromColors(SkColor accent_color,
+                              SkColor text_color,
+                              SkColor background_color,
                               color_utils::HSL* tint) {
-  SkColor accent_color = GdkColorToSkColor(accent_gdk_color);
-  color_utils::HSL accent_tint;
+  color_utils::HSL accent_tint, text_tint, background_tint;
   color_utils::SkColorToHSL(accent_color, &accent_tint);
-
-  color_utils::HSL text_tint;
-  color_utils::SkColorToHSL(GdkColorToSkColor(text_color),
-                            &text_tint);
-
-  color_utils::HSL background_tint;
-  color_utils::SkColorToHSL(GdkColorToSkColor(background_color),
-                            &background_tint);
+  color_utils::SkColorToHSL(text_color, &text_tint);
+  color_utils::SkColorToHSL(background_color, &background_tint);
 
   // If the accent color is gray, then our normal HSL tomfoolery will bring out
   // whatever color is oddly dominant (for example, in rgb space [125, 128,
@@ -297,17 +295,6 @@
   }
 }
 
-// Applies an HSL shift to a GdkColor (instead of an SkColor)
-void GdkColorHSLShift(const color_utils::HSL& shift, GdkColor* frame_color) {
-  SkColor shifted = color_utils::HSLShift(
-      GdkColorToSkColor(*frame_color), shift);
-
-  frame_color->pixel = 0;
-  frame_color->red = SkColorGetR(shifted) * kSkiaToGDKMultiplier;
-  frame_color->green = SkColorGetG(shifted) * kSkiaToGDKMultiplier;
-  frame_color->blue = SkColorGetB(shifted) * kSkiaToGDKMultiplier;
-}
-
 // Copied Default blah sections from ThemeService.
 color_utils::HSL GetDefaultTint(int id) {
   switch (id) {
@@ -428,23 +415,23 @@
   GtkInitFromCommandLine(*base::CommandLine::ForCurrentProcess());
 }
 
+
+
+void OnThemeChanged(GObject* obj, GParamSpec* param, Gtk2UI* gtkui) {
+  gtkui->ResetStyle();
+}
+
 void Gtk2UI::Initialize() {
-  signals_.reset(new Gtk2SignalRegistrar);
+  GtkSettings* settings = gtk_settings_get_default();
+  g_signal_connect_after(settings,
+                         "notify::gtk-theme-name",
+                         G_CALLBACK(OnThemeChanged),
+                         this);
+  g_signal_connect_after(settings,
+                         "notify::gtk-icon-theme-name",
+                         G_CALLBACK(OnThemeChanged),
+                         this);
 
-  // Create our fake widgets.
-  fake_window_ = gtk_window_new(GTK_WINDOW_TOPLEVEL);
-  fake_frame_ = chrome_gtk_frame_new();
-  fake_label_.Own(gtk_label_new(""));
-  fake_entry_.Own(gtk_entry_new());
-
-  // Only realized widgets receive style-set notifications, which we need to
-  // broadcast new theme images and colors. Only realized widgets have style
-  // properties, too, which we query for some colors.
-  gtk_widget_realize(fake_frame_);
-  gtk_widget_realize(fake_window_);
-
-  signals_->Connect(fake_frame_, "style-set",
-                    G_CALLBACK(&OnStyleSetThunk), this);
 
   LoadGtkValues();
 
@@ -465,11 +452,6 @@
 }
 
 Gtk2UI::~Gtk2UI() {
-  gtk_widget_destroy(fake_window_);
-  gtk_widget_destroy(fake_frame_);
-  fake_label_.Destroy();
-  fake_entry_.Destroy();
-
   ClearAllThemeData();
 }
 
@@ -741,114 +723,14 @@
   return key_bindings_handler_->MatchEvent(event, commands);
 }
 
-void Gtk2UI::GetScrollbarColors(GdkColor* thumb_active_color,
-                                GdkColor* thumb_inactive_color,
-                                GdkColor* track_color) {
-  GdkColor* theme_thumb_active = NULL;
-  GdkColor* theme_thumb_inactive = NULL;
-  GdkColor* theme_trough_color = NULL;
-  gtk_widget_style_get(GTK_WIDGET(fake_frame_),
-                       "scrollbar-slider-prelight-color", &theme_thumb_active,
-                       "scrollbar-slider-normal-color", &theme_thumb_inactive,
-                       "scrollbar-trough-color", &theme_trough_color,
-                       NULL);
+void Gtk2UI::SetScrollbarColors() {
+  thumb_active_color_ = SkColorSetRGB(244, 244, 244);
+  thumb_inactive_color_ = SkColorSetRGB(234, 234, 234);
+  track_color_ = SkColorSetRGB(211, 211, 211);
 
-  // Ask the theme if the theme specifies all the scrollbar colors and short
-  // circuit the expensive painting/compositing if we have all of them.
-  if (theme_thumb_active && theme_thumb_inactive && theme_trough_color) {
-    *thumb_active_color = *theme_thumb_active;
-    *thumb_inactive_color = *theme_thumb_inactive;
-    *track_color = *theme_trough_color;
-
-    gdk_color_free(theme_thumb_active);
-    gdk_color_free(theme_thumb_inactive);
-    gdk_color_free(theme_trough_color);
-    return;
-  }
-
-  // Create window containing scrollbar elements
-  GtkWidget* window    = gtk_window_new(GTK_WINDOW_POPUP);
-  GtkWidget* fixed     = gtk_fixed_new();
-  GtkWidget* scrollbar = gtk_hscrollbar_new(NULL);
-  gtk_container_add(GTK_CONTAINER(window), fixed);
-  gtk_container_add(GTK_CONTAINER(fixed),  scrollbar);
-  gtk_widget_realize(window);
-  gtk_widget_realize(scrollbar);
-
-  // Draw scrollbar thumb part and track into offscreen image
-  const int kWidth  = 100;
-  const int kHeight = 20;
-  GtkStyle* style   = gtk_rc_get_style(scrollbar);
-  GdkWindow* gdk_window = gtk_widget_get_window(window);
-  GdkPixmap* pm     = gdk_pixmap_new(gdk_window, kWidth, kHeight, -1);
-  GdkRectangle rect = { 0, 0, kWidth, kHeight };
-  unsigned char data[3 * kWidth * kHeight];
-  for (int i = 0; i < 3; ++i) {
-    if (i < 2) {
-      // Thumb part
-      gtk_paint_slider(style, pm,
-                       i == 0 ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL,
-                       GTK_SHADOW_OUT, &rect, scrollbar, "slider", 0, 0,
-                       kWidth, kHeight, GTK_ORIENTATION_HORIZONTAL);
-    } else {
-      // Track
-      gtk_paint_box(style, pm, GTK_STATE_ACTIVE, GTK_SHADOW_IN, &rect,
-                    scrollbar, "trough-upper", 0, 0, kWidth, kHeight);
-    }
-    GdkPixbuf* pb = gdk_pixbuf_new_from_data(data, GDK_COLORSPACE_RGB,
-                                             FALSE, 8, kWidth, kHeight,
-                                             3 * kWidth, 0, 0);
-    gdk_pixbuf_get_from_drawable(pb, pm, NULL, 0, 0, 0, 0, kWidth, kHeight);
-
-    // Sample pixels
-    int components[3] = { 0 };
-    for (int y = 2; y < kHeight - 2; ++y) {
-      for (int c = 0; c < 3; ++c) {
-        // Sample a vertical slice of pixels at about one-thirds from the
-        // left edge. This allows us to avoid any fixed graphics that might be
-        // located at the edges or in the center of the scrollbar.
-        // Each pixel is made up of a red, green, and blue component; taking up
-        // a total of three bytes.
-        components[c] += data[3 * (kWidth / 3 + y * kWidth) + c];
-      }
-    }
-    GdkColor* color = i == 0 ? thumb_active_color :
-                      i == 1 ? thumb_inactive_color :
-                               track_color;
-    color->pixel = 0;
-    // We sampled pixels across the full height of the image, ignoring a two
-    // pixel border. In some themes, the border has a completely different
-    // color which we do not want to factor into our average color computation.
-    //
-    // We now need to scale the colors from the 0..255 range, to the wider
-    // 0..65535 range, and we need to actually compute the average color; so,
-    // we divide by the total number of pixels in the sample.
-    color->red   = components[0] * 65535 / (255 * (kHeight - 4));
-    color->green = components[1] * 65535 / (255 * (kHeight - 4));
-    color->blue  = components[2] * 65535 / (255 * (kHeight - 4));
-
-    g_object_unref(pb);
-  }
-  g_object_unref(pm);
-
-  gtk_widget_destroy(window);
-
-  // Override any of the default colors with ones that were specified by the
-  // theme.
-  if (theme_thumb_active) {
-    *thumb_active_color = *theme_thumb_active;
-    gdk_color_free(theme_thumb_active);
-  }
-
-  if (theme_thumb_inactive) {
-    *thumb_inactive_color = *theme_thumb_inactive;
-    gdk_color_free(theme_thumb_inactive);
-  }
-
-  if (theme_trough_color) {
-    *track_color = *theme_trough_color;
-    gdk_color_free(theme_trough_color);
-  }
+  GetChromeStyleColor("scrollbar-slider-prelight-color", &thumb_active_color_);
+  GetChromeStyleColor("scrollbar-slider-normal-color", &thumb_inactive_color_);
+  GetChromeStyleColor("scrollbar-trough-color", &track_color_);
 }
 
 void Gtk2UI::LoadGtkValues() {
@@ -857,31 +739,31 @@
   // regress startup time. Figure out how to do that when we can't access the
   // prefs system from here.
 
-  GtkStyle* frame_style = gtk_rc_get_style(fake_frame_);
+  NativeThemeGtk2* theme = NativeThemeGtk2::instance();
 
-  GtkStyle* window_style = gtk_rc_get_style(fake_window_);
-  SetThemeColorFromGtk(ThemeProperties::COLOR_CONTROL_BACKGROUND,
-                       &window_style->bg[GTK_STATE_NORMAL]);
+  SkColor toolbar_color =
+      theme->GetSystemColor(ui::NativeTheme::kColorId_LabelBackgroundColor);
+  SkColor button_color =
+      theme->GetSystemColor(ui::NativeTheme::kColorId_ButtonHighlightColor);
+  SkColor label_color =
+      theme->GetSystemColor(ui::NativeTheme::kColorId_LabelEnabledColor);
 
-  GdkColor toolbar_color = window_style->bg[GTK_STATE_NORMAL];
-  SetThemeColorFromGtk(ThemeProperties::COLOR_TOOLBAR, &toolbar_color);
+  colors_[ThemeProperties::COLOR_CONTROL_BACKGROUND] = toolbar_color;
+  colors_[ThemeProperties::COLOR_TOOLBAR] = toolbar_color;
 
-  GdkColor button_color = window_style->bg[GTK_STATE_SELECTED];
-  SetThemeTintFromGtk(ThemeProperties::TINT_BUTTONS, &button_color);
+  SetThemeTint(ThemeProperties::TINT_BUTTONS, button_color);
 
-  GtkStyle* label_style = gtk_rc_get_style(fake_label_.get());
-  GdkColor label_color = label_style->fg[GTK_STATE_NORMAL];
-  SetThemeColorFromGtk(ThemeProperties::COLOR_TAB_TEXT, &label_color);
-  SetThemeColorFromGtk(ThemeProperties::COLOR_BOOKMARK_TEXT, &label_color);
-  SetThemeColorFromGtk(ThemeProperties::COLOR_STATUS_BAR_TEXT, &label_color);
+  colors_[ThemeProperties::COLOR_TAB_TEXT] = label_color;
+  colors_[ThemeProperties::COLOR_BOOKMARK_TEXT] = label_color;
+  colors_[ThemeProperties::COLOR_STATUS_BAR_TEXT] = label_color;
 
-  UpdateDefaultFont(label_style->font_desc);
+  UpdateDefaultFont();
 
   // Build the various icon tints.
   GetNormalButtonTintHSL(&button_tint_);
   GetNormalEntryForegroundHSL(&entry_tint_);
   GetSelectedEntryForegroundHSL(&selected_entry_tint_);
-  GdkColor frame_color = BuildFrameColors(frame_style);
+  SkColor frame_color = BuildFrameColors();
 
   // The inactive frame color never occurs naturally in the theme, as it is a
   // tinted version of |frame_color|. We generate another color based on the
@@ -908,140 +790,136 @@
   // as |toolbar_color|, is usually a white, and when it isn't a white,
   // provides sufficient contrast to |toolbar_color|. Try this out with
   // Darklooks, HighContrastInverse or ThinIce.
-  GtkStyle* entry_style = gtk_rc_get_style(fake_entry_.get());
-  GdkColor ntp_background = entry_style->base[GTK_STATE_NORMAL];
-  GdkColor ntp_foreground = entry_style->text[GTK_STATE_NORMAL];
-  SetThemeColorFromGtk(ThemeProperties::COLOR_NTP_BACKGROUND,
-                       &ntp_background);
-  SetThemeColorFromGtk(ThemeProperties::COLOR_NTP_TEXT,
-                       &ntp_foreground);
+
+  SkColor ntp_background =
+      theme->GetSystemColor(
+          ui::NativeTheme::kColorId_TextfieldDefaultBackground);
+  SkColor ntp_foreground =
+      theme->GetSystemColor(
+          ui::NativeTheme::kColorId_TextfieldDefaultColor);
+
+  colors_[ThemeProperties::COLOR_NTP_BACKGROUND] = ntp_background;
+  colors_[ThemeProperties::COLOR_NTP_TEXT] = ntp_foreground;
 
   // The NTP header is the color that surrounds the current active thumbnail on
   // the NTP, and acts as the border of the "Recent Links" box. It would be
   // awesome if they were separated so we could use GetBorderColor() for the
   // border around the "Recent Links" section, but matching the frame color is
   // more important.
-  SetThemeColorFromGtk(ThemeProperties::COLOR_NTP_HEADER,
-                       &frame_color);
-  SetThemeColorFromGtk(ThemeProperties::COLOR_NTP_SECTION,
-                       &toolbar_color);
-  SetThemeColorFromGtk(ThemeProperties::COLOR_NTP_SECTION_TEXT,
-                       &label_color);
 
-  // Override the link color if the theme provides it.
-  const GdkColor* link_color = NULL;
-  gtk_widget_style_get(GTK_WIDGET(fake_window_),
-                       "link-color", &link_color, NULL);
+  colors_[ThemeProperties::COLOR_NTP_HEADER] = frame_color;
+  colors_[ThemeProperties::COLOR_NTP_SECTION] = toolbar_color;
+  colors_[ThemeProperties::COLOR_NTP_SECTION_TEXT] = label_color;
 
-  bool is_default_link_color = false;
-  if (!link_color) {
-    link_color = &kDefaultLinkColor;
-    is_default_link_color = true;
-  }
+  // Default link color, taken from gtklinkbutton.c.
+  SkColor link_color = SkColorSetRGB(0, 0, 0xee);
+  GetChromeStyleColor("link-color", &link_color);
 
-  SetThemeColorFromGtk(ThemeProperties::COLOR_NTP_LINK,
-                       link_color);
-  SetThemeColorFromGtk(ThemeProperties::COLOR_NTP_LINK_UNDERLINE,
-                       link_color);
-  SetThemeColorFromGtk(ThemeProperties::COLOR_NTP_SECTION_LINK,
-                       link_color);
-  SetThemeColorFromGtk(ThemeProperties::COLOR_NTP_SECTION_LINK_UNDERLINE,
-                       link_color);
-
-  if (!is_default_link_color)
-    gdk_color_free(const_cast<GdkColor*>(link_color));
+  colors_[ThemeProperties::COLOR_NTP_LINK] = link_color;
+  colors_[ThemeProperties::COLOR_NTP_LINK_UNDERLINE] = link_color;
+  colors_[ThemeProperties::COLOR_NTP_SECTION_LINK] = link_color;
+  colors_[ThemeProperties::COLOR_NTP_SECTION_LINK_UNDERLINE] = link_color;
 
   // Generate the colors that we pass to WebKit.
-  focus_ring_color_ = GdkColorToSkColor(frame_color);
+  focus_ring_color_ = frame_color;
 
-  GdkColor thumb_active_color, thumb_inactive_color, track_color;
-  Gtk2UI::GetScrollbarColors(&thumb_active_color,
-                             &thumb_inactive_color,
-                             &track_color);
-  thumb_active_color_ = GdkColorToSkColor(thumb_active_color);
-  thumb_inactive_color_ = GdkColorToSkColor(thumb_inactive_color);
-  track_color_ = GdkColorToSkColor(track_color);
+  SetScrollbarColors();
 
   // Some GTK themes only define the text selection colors on the GtkEntry
   // class, so we need to use that for getting selection colors.
   active_selection_bg_color_ =
-      GdkColorToSkColor(entry_style->base[GTK_STATE_SELECTED]);
+      theme->GetSystemColor(
+          ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused);
   active_selection_fg_color_ =
-      GdkColorToSkColor(entry_style->text[GTK_STATE_SELECTED]);
+      theme->GetSystemColor(
+          ui::NativeTheme::kColorId_TextfieldSelectionColor);
   inactive_selection_bg_color_ =
-      GdkColorToSkColor(entry_style->base[GTK_STATE_ACTIVE]);
+      theme->GetSystemColor(
+          ui::NativeTheme::kColorId_TextfieldReadOnlyBackground);
   inactive_selection_fg_color_ =
-      GdkColorToSkColor(entry_style->text[GTK_STATE_ACTIVE]);
+      theme->GetSystemColor(
+          ui::NativeTheme::kColorId_TextfieldReadOnlyColor);
 
   colors_[ThemeProperties::COLOR_THROBBER_SPINNING] =
-      NativeThemeGtk2::instance()->GetSystemColor(
-          ui::NativeTheme::kColorId_ThrobberSpinningColor);
+      theme->GetSystemColor(ui::NativeTheme::kColorId_ThrobberSpinningColor);
   colors_[ThemeProperties::COLOR_THROBBER_WAITING] =
-      NativeThemeGtk2::instance()->GetSystemColor(
-          ui::NativeTheme::kColorId_ThrobberWaitingColor);
+      theme->GetSystemColor(ui::NativeTheme::kColorId_ThrobberWaitingColor);
 }
 
-GdkColor Gtk2UI::BuildFrameColors(GtkStyle* frame_style) {
-  GdkColor* theme_frame = NULL;
-  GdkColor* theme_inactive_frame = NULL;
-  GdkColor* theme_incognito_frame = NULL;
-  GdkColor* theme_incognito_inactive_frame = NULL;
-  gtk_widget_style_get(GTK_WIDGET(fake_frame_),
-                       "frame-color", &theme_frame,
-                       "inactive-frame-color", &theme_inactive_frame,
-                       "incognito-frame-color", &theme_incognito_frame,
-                       "incognito-inactive-frame-color",
-                       &theme_incognito_inactive_frame,
-                       NULL);
+SkColor Gtk2UI::BuildFrameColors() {
+  SkColor frame_color =
+      NativeThemeGtk2::instance()->GetSystemColor(
+          ui::NativeTheme::kColorId_WindowBackground);
+  SkColor temp_color;
+  SetThemeTint(ThemeProperties::TINT_BACKGROUND_TAB, frame_color);
 
-  GdkColor frame_color = BuildAndSetFrameColor(
-      &frame_style->bg[GTK_STATE_SELECTED],
-      theme_frame,
-      kDefaultFrameShift,
-      ThemeProperties::COLOR_FRAME,
-      ThemeProperties::TINT_FRAME);
-  if (theme_frame)
-    gdk_color_free(theme_frame);
-  SetThemeTintFromGtk(ThemeProperties::TINT_BACKGROUND_TAB, &frame_color);
 
-  BuildAndSetFrameColor(
-      &frame_style->bg[GTK_STATE_INSENSITIVE],
-      theme_inactive_frame,
-      kDefaultFrameShift,
-      ThemeProperties::COLOR_FRAME_INACTIVE,
-      ThemeProperties::TINT_FRAME_INACTIVE);
-  if (theme_inactive_frame)
-    gdk_color_free(theme_inactive_frame);
+#if GTK_MAJOR_VERSION == 2
+  color_utils::HSL kDefaultFrameShift = { -1, -1, 0.4 };
+  GtkStyle* style = gtk_rc_get_style(NativeThemeGtk2::instance()->GetWindow());
 
-  BuildAndSetFrameColor(
-      &frame_color,
-      theme_incognito_frame,
-      GetDefaultTint(ThemeProperties::TINT_FRAME_INCOGNITO),
-      ThemeProperties::COLOR_FRAME_INCOGNITO,
-      ThemeProperties::TINT_FRAME_INCOGNITO);
-  if (theme_incognito_frame)
-    gdk_color_free(theme_incognito_frame);
+  frame_color = color_utils::HSLShift(frame_color, kDefaultFrameShift);
+  GetChromeStyleColor("frame-color", &frame_color);
 
-  BuildAndSetFrameColor(
-      &frame_color,
-      theme_incognito_inactive_frame,
-      GetDefaultTint(ThemeProperties::TINT_FRAME_INCOGNITO_INACTIVE),
-      ThemeProperties::COLOR_FRAME_INCOGNITO_INACTIVE,
-      ThemeProperties::TINT_FRAME_INCOGNITO_INACTIVE);
-  if (theme_incognito_inactive_frame)
-    gdk_color_free(theme_incognito_inactive_frame);
+  temp_color = frame_color;
+  colors_[ThemeProperties::COLOR_FRAME] = temp_color;
+  SetThemeTint(ThemeProperties::TINT_FRAME, temp_color);
+
+  temp_color = color_utils::HSLShift(
+      GdkColorToSkColor(style->bg[GTK_STATE_INSENSITIVE]),
+      kDefaultFrameShift);
+  GetChromeStyleColor("inactive-frame-color", &temp_color);
+  colors_[ThemeProperties::COLOR_FRAME_INACTIVE] = temp_color;
+  SetThemeTint(ThemeProperties::TINT_FRAME_INACTIVE, temp_color);
+
+  temp_color = color_utils::HSLShift(
+      frame_color,
+      GetDefaultTint(ThemeProperties::TINT_FRAME_INCOGNITO));
+  GetChromeStyleColor("incognito-frame-color", &temp_color);
+  colors_[ThemeProperties::COLOR_FRAME_INCOGNITO] = temp_color;
+  SetThemeTint(ThemeProperties::TINT_FRAME_INCOGNITO, temp_color);
+
+  temp_color = color_utils::HSLShift(
+      frame_color,
+      GetDefaultTint(ThemeProperties::TINT_FRAME_INCOGNITO_INACTIVE));
+  GetChromeStyleColor("incognito-inactive-frame-color", &temp_color);
+  colors_[ThemeProperties::COLOR_FRAME_INCOGNITO_INACTIVE] = temp_color;
+  SetThemeTint(ThemeProperties::TINT_FRAME_INCOGNITO_INACTIVE, temp_color);
+#else
+  const SkBitmap* bitmap;
+
+  bitmap = GetThemeImageNamed(IDR_THEME_FRAME).ToSkBitmap();
+  bitmap->lockPixels();
+  temp_color = bitmap->getColor(bitmap->width() / 2, bitmap->height() - 1);
+  bitmap->unlockPixels();
+  colors_[ThemeProperties::COLOR_FRAME] = temp_color;
+
+  bitmap = GetThemeImageNamed(IDR_THEME_FRAME_INACTIVE).ToSkBitmap();
+  bitmap->lockPixels();
+  temp_color = bitmap->getColor(bitmap->width() / 2, bitmap->height() - 1);
+  bitmap->unlockPixels();
+  colors_[ThemeProperties::COLOR_FRAME_INACTIVE] = temp_color;
+
+  bitmap = GetThemeImageNamed(IDR_THEME_FRAME_INCOGNITO).ToSkBitmap();
+  bitmap->lockPixels();
+  temp_color = bitmap->getColor(bitmap->width() / 2, bitmap->height() - 1);
+  bitmap->unlockPixels();
+  colors_[ThemeProperties::COLOR_FRAME_INCOGNITO] = temp_color;
+
+  bitmap = GetThemeImageNamed(IDR_THEME_FRAME_INCOGNITO_INACTIVE).ToSkBitmap();
+  bitmap->lockPixels();
+  temp_color = bitmap->getColor(bitmap->width() / 2, bitmap->height() - 1);
+  bitmap->unlockPixels();
+  colors_[ThemeProperties::COLOR_FRAME_INCOGNITO_INACTIVE] = temp_color;
+#endif
 
   return frame_color;
 }
 
-void Gtk2UI::SetThemeColorFromGtk(int id, const GdkColor* color) {
-  colors_[id] = GdkColorToSkColor(*color);
-}
-
-void Gtk2UI::SetThemeTintFromGtk(int id, const GdkColor* color) {
+void Gtk2UI::SetThemeTint(int id, SkColor color) {
   color_utils::HSL default_tint = GetDefaultTint(id);
   color_utils::HSL hsl;
-  color_utils::SkColorToHSL(GdkColorToSkColor(*color), &hsl);
+  color_utils::SkColorToHSL(color, &hsl);
 
   if (default_tint.s != -1)
     hsl.s = default_tint.s;
@@ -1052,35 +930,14 @@
   tints_[id] = hsl;
 }
 
-GdkColor Gtk2UI::BuildAndSetFrameColor(const GdkColor* base,
-                                       const GdkColor* gtk_base,
-                                       const color_utils::HSL& tint,
-                                       int color_id,
-                                       int tint_id) {
-  GdkColor out_color = *base;
-  if (gtk_base) {
-    // The theme author specified a color to use, use it without modification.
-    out_color = *gtk_base;
-  } else {
-    // Tint the basic color since this is a heuristic color instead of one
-    // specified by the theme author.
-    GdkColorHSLShift(tint, &out_color);
-  }
-  SetThemeColorFromGtk(color_id, &out_color);
-  SetThemeTintFromGtk(tint_id, &out_color);
-
-  return out_color;
-}
-
 SkBitmap Gtk2UI::GenerateGtkThemeBitmap(int id) const {
   switch (id) {
     case IDR_THEME_TOOLBAR: {
-      GtkStyle* style = gtk_rc_get_style(fake_window_);
-      GdkColor* color = &style->bg[GTK_STATE_NORMAL];
       SkBitmap bitmap;
       bitmap.allocN32Pixels(kToolbarImageWidth, kToolbarImageHeight);
-      bitmap.eraseARGB(0xff, color->red >> 8, color->green >> 8,
-                       color->blue >> 8);
+      bitmap.eraseColor(
+          NativeThemeGtk2::instance()->GetSystemColor(
+              ui::NativeTheme::kColorId_LabelBackgroundColor));
       return bitmap;
     }
     case IDR_THEME_TAB_BACKGROUND:
@@ -1143,9 +1000,11 @@
       return GenerateGTKIcon(id);
     }
     case IDR_TOOLBAR_BEZEL_HOVER:
-      return GenerateToolbarBezel(GTK_STATE_PRELIGHT, IDR_TOOLBAR_BEZEL_HOVER);
+      return GenerateToolbarBezel(
+          ui::NativeTheme::kHovered, IDR_TOOLBAR_BEZEL_HOVER);
     case IDR_TOOLBAR_BEZEL_PRESSED:
-      return GenerateToolbarBezel(GTK_STATE_ACTIVE, IDR_TOOLBAR_BEZEL_PRESSED);
+      return GenerateToolbarBezel(
+          ui::NativeTheme::kPressed, IDR_TOOLBAR_BEZEL_PRESSED);
     default: {
       return GenerateTintedIcon(id, button_tint_);
     }
@@ -1157,28 +1016,29 @@
 SkBitmap Gtk2UI::GenerateFrameImage(
     int color_id,
     const char* gradient_name) const {
-  // We use two colors: the main color (passed in) and a lightened version of
-  // that color (which is supposed to match the light gradient at the top of
-  // several GTK+ themes, such as Ambiance, Clearlooks or Bluebird).
+#if GTK_MAJOR_VERSION == 2
   ColorMap::const_iterator it = colors_.find(color_id);
   DCHECK(it != colors_.end());
   SkColor base = it->second;
 
+  // We use two colors: the main color (passed in) and a lightened version of
+  // that color (which is supposed to match the light gradient at the top of
+  // several GTK+ themes, such as Ambiance, Clearlooks or Bluebird).
+  const color_utils::HSL kGtkFrameShift = { -1, -1, 0.58 };
   gfx::Canvas canvas(gfx::Size(kToolbarImageWidth, kToolbarImageHeight),
       1.0f, true);
 
+  SkColor gradient_top_color = color_utils::HSLShift(base, kGtkFrameShift);
   int gradient_size;
-  GdkColor* gradient_top_color = NULL;
-  gtk_widget_style_get(GTK_WIDGET(fake_frame_),
+
+  GetChromeStyleColor(gradient_name, &gradient_top_color);
+  gtk_widget_style_get(NativeThemeGtk2::instance()->GetWindow(),
                        "frame-gradient-size", &gradient_size,
-                       gradient_name, &gradient_top_color,
                        NULL);
+
   if (gradient_size) {
-    SkColor lighter = gradient_top_color ?
-        GdkColorToSkColor(*gradient_top_color) :
-        color_utils::HSLShift(base, kGtkFrameShift);
     skia::RefPtr<SkShader> shader = gfx::CreateGradientShader(
-        0, gradient_size, lighter, base);
+        0, gradient_size, gradient_top_color, base);
     SkPaint paint;
     paint.setStyle(SkPaint::kFill_Style);
     paint.setAntiAlias(true);
@@ -1187,12 +1047,54 @@
     canvas.DrawRect(gfx::Rect(0, 0, kToolbarImageWidth, gradient_size), paint);
   }
 
-  if (gradient_top_color)
-    gdk_color_free(gradient_top_color);
-
   canvas.FillRect(gfx::Rect(0, gradient_size, kToolbarImageWidth,
                             kToolbarImageHeight - gradient_size), base);
   return canvas.ExtractImageRep().sk_bitmap();
+
+#else
+  // Render a GtkHeaderBar as our title bar, cropping out any curved edges on
+  // the left and right sides. Also remove the bottom border for good measure.
+  SkBitmap bitmap;
+  bitmap.allocN32Pixels(kToolbarImageWidth, 40);
+  bitmap.eraseColor(0);
+
+
+  static GtkWidget* title = NULL;
+  if (!title) {
+    title = gtk_header_bar_new();
+    gtk_widget_set_size_request(title, kToolbarImageWidth * 2, 48);
+
+    GtkWidget* window = gtk_offscreen_window_new();
+    gtk_container_add(GTK_CONTAINER(window), title);
+
+    gtk_widget_show_all(window);
+  }
+
+  cairo_surface_t* surface = cairo_image_surface_create_for_data(
+    static_cast<unsigned char*>(bitmap.getAddr(0, 0)),
+    CAIRO_FORMAT_ARGB32,
+    bitmap.width(), bitmap.height(),
+    bitmap.width() * 4);
+  cairo_t* cr = cairo_create(surface);
+  cairo_translate(cr, kToolbarImageWidth / -2, 0);
+  gtk_widget_draw(title, cr);
+  cairo_destroy(cr);
+  cairo_surface_destroy(surface);
+
+  switch (color_id) {
+    case ThemeProperties::COLOR_FRAME_INACTIVE:
+      return SkBitmapOperations::CreateHSLShiftedBitmap(bitmap,
+          kDefaultTintFrameInactive);
+    case ThemeProperties::COLOR_FRAME_INCOGNITO:
+      return SkBitmapOperations::CreateHSLShiftedBitmap(bitmap,
+          kDefaultTintFrameIncognito);
+    case ThemeProperties::COLOR_FRAME_INCOGNITO_INACTIVE:
+      return SkBitmapOperations::CreateHSLShiftedBitmap(bitmap,
+          kDefaultTintFrameIncognitoInactive);
+  }
+
+  return bitmap;
+#endif
 }
 
 SkBitmap Gtk2UI::GenerateTabImage(int base_id) const {
@@ -1213,11 +1115,11 @@
 
 SkBitmap Gtk2UI::GenerateGTKIcon(int base_id) const {
   const char* stock_id = NULL;
-  GtkStateType gtk_state = GTK_STATE_NORMAL;
+  bool enabled = true;
   for (unsigned int i = 0; i < arraysize(kGtkIcons); ++i) {
     if (kGtkIcons[i].idr == base_id) {
       stock_id = kGtkIcons[i].stock_id;
-      gtk_state = kGtkIcons[i].gtk_state;
+      enabled = kGtkIcons[i].enabled;
       break;
     }
   }
@@ -1226,20 +1128,13 @@
   ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
   SkBitmap default_bitmap = rb.GetImageNamed(base_id).AsBitmap();
 
-  gtk_widget_ensure_style(fake_frame_);
-  GtkStyle* style = gtk_widget_get_style(fake_frame_);
-  GtkIconSet* icon_set = gtk_style_lookup_icon_set(style, stock_id);
-  if (!icon_set)
-    return default_bitmap;
-
   // Ask GTK to render the icon to a buffer, which we will steal from.
-  GdkPixbuf* gdk_icon = gtk_icon_set_render_icon(
-      icon_set,
-      style,
-      base::i18n::IsRTL() ? GTK_TEXT_DIR_RTL : GTK_TEXT_DIR_LTR,
-      gtk_state,
-      GTK_ICON_SIZE_SMALL_TOOLBAR,
-      fake_frame_,
+  GtkIconTheme* icon_theme = gtk_icon_theme_get_default();
+  GdkPixbuf* gdk_icon = gtk_icon_theme_load_icon(
+      icon_theme,
+      stock_id,
+      20,
+      (GtkIconLookupFlags)0,
       NULL);
 
   if (!gdk_icon) {
@@ -1249,6 +1144,25 @@
     return default_bitmap;
   }
 
+#if GTK_MAJOR_VERSION == 2
+  GtkIconSource* icon_source = gtk_icon_source_new();
+  gtk_icon_source_set_pixbuf(icon_source, gdk_icon);
+
+  GdkPixbuf* temp = gtk_style_render_icon(
+      gtk_rc_get_style(NativeThemeGtk2::instance()->GetButton()),
+      icon_source,
+      GTK_TEXT_DIR_NONE,
+      enabled ? GTK_STATE_NORMAL : GTK_STATE_INSENSITIVE,
+      (GtkIconSize)-1,
+      NativeThemeGtk2::instance()->GetButton(),
+      NULL);
+
+  gtk_icon_source_free(icon_source);
+  g_object_unref(gdk_icon);
+
+  gdk_icon = temp;
+#endif
+
   SkBitmap retval;
   retval.allocN32Pixels(default_bitmap.width(), default_bitmap.height());
   retval.eraseColor(0);
@@ -1257,125 +1171,143 @@
   g_object_unref(gdk_icon);
 
   SkCanvas canvas(retval);
+  SkPaint paint;
 
-  if (gtk_state == GTK_STATE_ACTIVE || gtk_state == GTK_STATE_PRELIGHT) {
-    SkBitmap border = DrawGtkButtonBorder(gtk_state,
-                                          false,
-                                          false,
-                                          default_bitmap.width(),
-                                          default_bitmap.height());
-    canvas.drawBitmap(border, 0, 0);
-  }
+#if GTK_MAJOR_VERSION > 2
+  if (!enabled)
+    paint.setAlpha(128);
+#endif
 
   canvas.drawBitmap(icon,
                     (default_bitmap.width() / 2) - (icon.width() / 2),
-                    (default_bitmap.height() / 2) - (icon.height() / 2));
+                    (default_bitmap.height() / 2) - (icon.height() / 2),
+                    &paint);
 
   return retval;
 }
 
-SkBitmap Gtk2UI::GenerateToolbarBezel(int gtk_state, int sizing_idr) const {
+SkBitmap Gtk2UI::GenerateToolbarBezel(
+    ui::NativeTheme::State state,
+    int sizing_idr) const {
   ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
   SkBitmap default_bitmap =
       rb.GetImageNamed(sizing_idr).AsBitmap();
 
-  SkBitmap retval;
-  retval.allocN32Pixels(default_bitmap.width(), default_bitmap.height());
-  retval.eraseColor(0);
-
-  SkCanvas canvas(retval);
-  SkBitmap border = DrawGtkButtonBorder(
-      gtk_state,
-      false,
-      false,
+  return DrawGtkButtonBorder(
+      NULL,
+      state,
       default_bitmap.width(),
       default_bitmap.height());
-  canvas.drawBitmap(border, 0, 0);
-
-  return retval;
 }
 
 void Gtk2UI::GetNormalButtonTintHSL(color_utils::HSL* tint) const {
-  GtkStyle* window_style = gtk_rc_get_style(fake_window_);
-  const GdkColor accent_gdk_color = window_style->bg[GTK_STATE_SELECTED];
-  const GdkColor base_color = window_style->base[GTK_STATE_NORMAL];
+  NativeThemeGtk2* theme = NativeThemeGtk2::instance();
 
-  GtkStyle* label_style = gtk_rc_get_style(fake_label_.get());
-  const GdkColor text_color = label_style->fg[GTK_STATE_NORMAL];
+  SkColor accent_color =
+      theme->GetSystemColor(
+          ui::NativeTheme::kColorId_ButtonHighlightColor);
+  SkColor text_color =
+      theme->GetSystemColor(
+          ui::NativeTheme::kColorId_LabelEnabledColor);
+  SkColor base_color =
+      theme->GetSystemColor(
+          ui::NativeTheme::kColorId_LabelBackgroundColor);
 
-  PickButtonTintFromColors(accent_gdk_color, text_color, base_color, tint);
+  PickButtonTintFromColors(accent_color, text_color, base_color, tint);
 }
 
 void Gtk2UI::GetNormalEntryForegroundHSL(color_utils::HSL* tint) const {
-  GtkStyle* window_style = gtk_rc_get_style(fake_window_);
-  const GdkColor accent_gdk_color = window_style->bg[GTK_STATE_SELECTED];
+  NativeThemeGtk2* theme = NativeThemeGtk2::instance();
 
-  GtkStyle* style = gtk_rc_get_style(fake_entry_.get());
-  const GdkColor text_color = style->text[GTK_STATE_NORMAL];
-  const GdkColor base_color = style->base[GTK_STATE_NORMAL];
+  SkColor accent_color =
+      theme->GetSystemColor(
+          ui::NativeTheme::kColorId_ButtonHighlightColor);
+  SkColor text_color =
+      theme->GetSystemColor(
+          ui::NativeTheme::kColorId_TextfieldDefaultColor);
+  SkColor base_color =
+      theme->GetSystemColor(
+          ui::NativeTheme::kColorId_TextfieldDefaultBackground);
 
-  PickButtonTintFromColors(accent_gdk_color, text_color, base_color, tint);
+  PickButtonTintFromColors(accent_color, text_color, base_color, tint);
 }
 
 void Gtk2UI::GetSelectedEntryForegroundHSL(color_utils::HSL* tint) const {
   // The simplest of all the tints. We just use the selected text in the entry
   // since the icons tinted this way will only be displayed against
   // base[GTK_STATE_SELECTED].
-  GtkStyle* style = gtk_rc_get_style(fake_entry_.get());
-  const GdkColor color = style->text[GTK_STATE_SELECTED];
-  color_utils::SkColorToHSL(GdkColorToSkColor(color), tint);
+  SkColor color =
+      NativeThemeGtk2::instance()->GetSystemColor(
+          ui::NativeTheme::kColorId_TextfieldSelectionColor);
+
+  color_utils::SkColorToHSL(color, tint);
 }
 
-SkBitmap Gtk2UI::DrawGtkButtonBorder(int gtk_state,
-                                     bool focused,
-                                     bool call_to_action,
+SkBitmap Gtk2UI::DrawGtkButtonBorder(const char* class_name,
+                                     ui::NativeTheme::State state,
                                      int width,
                                      int height) const {
+  SkBitmap border;
+  border.allocN32Pixels(width, height);
+  border.eraseColor(0);
+
   // Create a temporary GTK button to snapshot
   GtkWidget* window = gtk_offscreen_window_new();
-  GtkWidget* button = gtk_button_new();
+  GtkWidget* button = gtk_toggle_button_new();
+
+  if (state == ui::NativeTheme::kPressed)
+    gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), true);
+  else if (state == ui::NativeTheme::kDisabled)
+    gtk_widget_set_sensitive(button, false);
+
   gtk_widget_set_size_request(button, width, height);
   gtk_container_add(GTK_CONTAINER(window), button);
-  gtk_widget_realize(window);
-  gtk_widget_realize(button);
-  gtk_widget_show(button);
-  gtk_widget_show(window);
 
-  if (call_to_action)
-    GTK_WIDGET_SET_FLAGS(button, GTK_HAS_DEFAULT);
-
-  if (focused) {
-    // We can't just use gtk_widget_grab_focus() here because that sets
-    // gtk_widget_is_focus(), but not gtk_widget_has_focus(), which is what the
-    // GtkButton's paint checks.
-    GTK_WIDGET_SET_FLAGS(button, GTK_HAS_FOCUS);
+  if (class_name == views::BlueButton::kViewClassName) {
+    gtk_widget_set_can_default(button, true);
+    gtk_widget_grab_default(button);
   }
 
-  gtk_widget_set_state(button, static_cast<GtkStateType>(gtk_state));
+  gtk_widget_show_all(window);
 
+
+  cairo_surface_t* surface = cairo_image_surface_create_for_data(
+    static_cast<unsigned char*>(border.getAddr(0, 0)),
+    CAIRO_FORMAT_ARGB32,
+    width, height,
+    width * 4);
+  cairo_t* cr = cairo_create(surface);
+
+#if GTK_MAJOR_VERSION == 2
+  int w, h;
   GdkPixmap* pixmap;
+
   {
     // http://crbug.com/346740
     ANNOTATE_SCOPED_MEMORY_LEAK;
     pixmap = gtk_widget_get_snapshot(button, NULL);
   }
-  int w, h;
-  gdk_drawable_get_size(GDK_DRAWABLE(pixmap), &w, &h);
-  DCHECK_EQ(w, width);
-  DCHECK_EQ(h, height);
 
-  // We render the Pixmap to a Pixbuf. This can be slow, as we're scrapping
-  // bits from X.
+  gdk_drawable_get_size(GDK_DRAWABLE(pixmap), &w, &h);
   GdkColormap* colormap = gdk_drawable_get_colormap(pixmap);
   GdkPixbuf* pixbuf = gdk_pixbuf_get_from_drawable(NULL,
                                                    GDK_DRAWABLE(pixmap),
                                                    colormap,
                                                    0, 0, 0, 0, w, h);
 
-  // Finally, we convert our pixbuf into a type we can use.
-  SkBitmap border = GdkPixbufToImageSkia(pixbuf);
+  gdk_cairo_set_source_pixbuf(cr, pixbuf, 0, 0);
+  cairo_paint(cr);
+
   g_object_unref(pixbuf);
   g_object_unref(pixmap);
+#else
+  gtk_widget_draw(button, cr);
+#endif
+
+  cairo_destroy(cr);
+  cairo_surface_destroy(surface);
+
+
   gtk_widget_destroy(window);
 
   return border;
@@ -1385,7 +1317,11 @@
   gtk_images_.clear();
 }
 
-void Gtk2UI::UpdateDefaultFont(const PangoFontDescription* desc) {
+void Gtk2UI::UpdateDefaultFont() {
+  PangoContext* pc = gtk_widget_get_pango_context(
+    NativeThemeGtk2::instance()->GetLabel());
+  const PangoFontDescription* desc = pango_context_get_font_description(pc);
+
   // Use gfx::FontRenderParams to select a family and determine the rendering
   // settings.
   gfx::FontRenderParamsQuery query;
@@ -1422,7 +1358,7 @@
   default_font_style_ = query.style;
 }
 
-void Gtk2UI::OnStyleSet(GtkWidget* widget, GtkStyle* previous_style) {
+void Gtk2UI::ResetStyle() {
   ClearAllThemeData();
   LoadGtkValues();
   NativeThemeGtk2::instance()->NotifyObservers();
@@ -1430,8 +1366,7 @@
 
 void Gtk2UI::UpdateDeviceScaleFactor(float device_scale_factor) {
   device_scale_factor_ = device_scale_factor;
-  GtkStyle* label_style = gtk_rc_get_style(fake_label_.get());
-  UpdateDefaultFont(label_style->font_desc);
+  UpdateDefaultFont();
 }
 
 float Gtk2UI::GetDeviceScaleFactor() const {
diff --git a/chrome/browser/ui/libgtk2ui/gtk2_ui.h b/chrome/browser/ui/libgtk2ui/gtk2_ui.h
index 5497591a..c7b7524 100644
--- a/chrome/browser/ui/libgtk2ui/gtk2_ui.h
+++ b/chrome/browser/ui/libgtk2ui/gtk2_ui.h
@@ -21,11 +21,9 @@
 #include "ui/views/linux_ui/linux_ui.h"
 #include "ui/views/window/frame_buttons.h"
 
-typedef struct _GdkColor GdkColor;
 typedef struct _GtkBorder GtkBorder;
 typedef struct _GtkStyle GtkStyle;
 typedef struct _GtkWidget GtkWidget;
-typedef struct _PangoFontDescription PangoFontDescription;
 
 class SkBitmap;
 
@@ -55,13 +53,15 @@
       const std::vector<views::FrameButton>& trailing_buttons);
   void SetNonClientMiddleClickAction(NonClientMiddleClickAction action);
 
-  // Draws the GTK button border for state |gtk_state| onto a bitmap.
-  SkBitmap DrawGtkButtonBorder(int gtk_state,
-                               bool focused,
-                               bool call_to_action,
+  // Draws the GTK button border with the given properties onto a bitmap.
+  SkBitmap DrawGtkButtonBorder(const char* class_name,
+                               ui::NativeTheme::State state,
                                int width,
                                int height) const;
 
+  // Called when gtk style changes
+  void ResetStyle();
+
   // ui::LinuxInputMethodContextFactory:
   scoped_ptr<ui::LinuxInputMethodContext> CreateInputMethodContext(
       ui::LinuxInputMethodContextDelegate* delegate,
@@ -132,9 +132,7 @@
   // This method returns the colors webkit will use for the scrollbars. When no
   // colors are specified by the GTK+ theme, this function averages of the
   // thumb part and of the track colors.
-  void GetScrollbarColors(GdkColor* thumb_active_color,
-                          GdkColor* thumb_inactive_color,
-                          GdkColor* track_color);
+  void SetScrollbarColors();
 
   // Extracts colors and tints from the GTK theme, both for the
   // ThemeService interface and the colors we send to webkit.
@@ -142,20 +140,10 @@
 
   // Reads in explicit theme frame colors from the ChromeGtkFrame style class
   // or generates them per our fallback algorithm.
-  GdkColor BuildFrameColors(GtkStyle* frame_style);
+  SkColor BuildFrameColors();
 
-  // Sets the underlying theme colors/tints from a GTK color.
-  void SetThemeColorFromGtk(int id, const GdkColor* color);
-  void SetThemeTintFromGtk(int id, const GdkColor* color);
-
-  // Creates and returns a frame color, either using |gtk_base| verbatim if
-  // non-NULL, or tinting |base| with |tint|. Also sets |color_id| and
-  // |tint_id| to the returned color.
-  GdkColor BuildAndSetFrameColor(const GdkColor* base,
-                                 const GdkColor* gtk_base,
-                                 const color_utils::HSL& tint,
-                                 int color_id,
-                                 int tint_id);
+  // Sets the underlying theme tints.
+  void SetThemeTint(int id, SkColor color);
 
   // Lazily generates each bitmap used in the gtk theme.
   SkBitmap GenerateGtkThemeBitmap(int id) const;
@@ -179,8 +167,9 @@
   SkBitmap GenerateGTKIcon(int base_id) const;
 
   // Renders a GTK button border the size of the image |sizing_idr| in
-  // |gtk_state|.
-  SkBitmap GenerateToolbarBezel(int gtk_state, int sizing_idr) const;
+  // |state|.
+  SkBitmap GenerateToolbarBezel(ui::NativeTheme::State state,
+                                int sizing_idr) const;
 
   // Returns the tint for buttons that contrasts with the normal window
   // background color.
@@ -199,19 +188,8 @@
   // Frees all calculated images and color data.
   void ClearAllThemeData();
 
-  // Updates |default_font_*| based on |desc|.
-  void UpdateDefaultFont(const PangoFontDescription* desc);
-
-  // Handles signal from GTK that our theme has been changed.
-  CHROMEGTK_CALLBACK_1(Gtk2UI, void, OnStyleSet, GtkStyle*);
-
-  GtkWidget* fake_window_;
-  GtkWidget* fake_frame_;
-  OwnedWidgetGtk fake_label_;
-  OwnedWidgetGtk fake_entry_;
-
-  // Tracks all the signals we have connected to on various widgets.
-  scoped_ptr<Gtk2SignalRegistrar> signals_;
+  // Updates |default_font_*|.
+  void UpdateDefaultFont();
 
   // Tints and colors calculated by LoadGtkValues() that are given to the
   // caller while |use_gtk_| is true.
diff --git a/chrome/browser/ui/libgtk2ui/gtk2_util.cc b/chrome/browser/ui/libgtk2ui/gtk2_util.cc
index 8bac9cb..ce2d8f7 100644
--- a/chrome/browser/ui/libgtk2ui/gtk2_util.cc
+++ b/chrome/browser/ui/libgtk2ui/gtk2_util.cc
@@ -71,11 +71,6 @@
 #endif
 }
 
-void SetAlwaysShowImage(GtkWidget* image_menu_item) {
-  gtk_image_menu_item_set_always_show_image(
-      GTK_IMAGE_MENU_ITEM(image_menu_item), TRUE);
-}
-
 guint GetGdkKeyCodeForAccelerator(const ui::Accelerator& accelerator) {
   // The second parameter is false because accelerator keys are expressed in
   // terms of the non-shift-modified key.
@@ -135,15 +130,4 @@
   g_object_set_data(G_OBJECT(dialog), kAuraTransientParent, NULL);
 }
 
-GtkStateType GetGtkState(ui::NativeTheme::State state) {
-  switch (state) {
-    case ui::NativeTheme::kDisabled:  return GTK_STATE_INSENSITIVE;
-    case ui::NativeTheme::kHovered:   return GTK_STATE_PRELIGHT;
-    case ui::NativeTheme::kNormal:    return GTK_STATE_NORMAL;
-    case ui::NativeTheme::kPressed:   return GTK_STATE_ACTIVE;
-    case ui::NativeTheme::kNumStates: NOTREACHED();
-  }
-  return GTK_STATE_NORMAL;
-}
-
 }  // namespace libgtk2ui
diff --git a/chrome/browser/ui/libgtk2ui/gtk2_util.h b/chrome/browser/ui/libgtk2ui/gtk2_util.h
index 0d8c4fd..0d867d3 100644
--- a/chrome/browser/ui/libgtk2ui/gtk2_util.h
+++ b/chrome/browser/ui/libgtk2ui/gtk2_util.h
@@ -32,11 +32,6 @@
 // Returns the name of the ".desktop" file associated with our running process.
 std::string GetDesktopName(base::Environment* env);
 
-// Show the image for the given menu item, even if the user's default is to not
-// show images. Only to be used for favicons or other menus where the image is
-// crucial to its functionality.
-void SetAlwaysShowImage(GtkWidget* image_menu_item);
-
 guint GetGdkKeyCodeForAccelerator(const ui::Accelerator& accelerator);
 
 GdkModifierType GetGdkModifierForAccelerator(
@@ -55,9 +50,6 @@
 // Clears the transient parent for |dialog|.
 void ClearAuraTransientParent(GtkWidget* dialog);
 
-// Converts a NativeTheme state to a GtkStateType.
-GtkStateType GetGtkState(ui::NativeTheme::State state);
-
 }  // namespace libgtk2ui
 
 #endif  // CHROME_BROWSER_UI_LIBGTK2UI_GTK2_UTIL_H_
diff --git a/chrome/browser/ui/libgtk2ui/menu_util.cc b/chrome/browser/ui/libgtk2ui/menu_util.cc
index 96e0634..6cedac2 100644
--- a/chrome/browser/ui/libgtk2ui/menu_util.cc
+++ b/chrome/browser/ui/libgtk2ui/menu_util.cc
@@ -12,6 +12,8 @@
 #include "ui/base/accelerators/menu_label_accelerator_util_linux.h"
 #include "ui/base/models/menu_model.h"
 
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+
 namespace libgtk2ui {
 
 GtkWidget* BuildMenuItemWithImage(const std::string& label, GtkWidget* image) {
@@ -139,7 +141,8 @@
         else
           menu_item = BuildMenuItemWithLabel(label);
         if (GTK_IS_IMAGE_MENU_ITEM(menu_item)) {
-          SetAlwaysShowImage(menu_item);
+          gtk_image_menu_item_set_always_show_image(
+              GTK_IMAGE_MENU_ITEM(menu_item), TRUE);
         }
         break;
       }
diff --git a/chrome/browser/ui/libgtk2ui/native_theme_gtk2.cc b/chrome/browser/ui/libgtk2ui/native_theme_gtk2.cc
index b7a61f1..688fe7c 100644
--- a/chrome/browser/ui/libgtk2ui/native_theme_gtk2.cc
+++ b/chrome/browser/ui/libgtk2ui/native_theme_gtk2.cc
@@ -6,6 +6,7 @@
 
 #include <gtk/gtk.h>
 
+#include "chrome/browser/ui/libgtk2ui/chrome_gtk_frame.h"
 #include "chrome/browser/ui/libgtk2ui/chrome_gtk_menu_subclasses.h"
 #include "chrome/browser/ui/libgtk2ui/gtk2_ui.h"
 #include "chrome/browser/ui/libgtk2ui/gtk2_util.h"
@@ -18,32 +19,21 @@
 #include "ui/gfx/skia_util.h"
 #include "ui/native_theme/common_theme.h"
 
+
 namespace {
 
 // Theme colors returned by GetSystemColor().
 const SkColor kInvalidColorIdColor = SkColorSetRGB(255, 0, 128);
-
-const GdkColor kURLTextColor = GDK_COLOR_RGB(0x0b, 0x80, 0x43);
-
-GdkColor GdkAlphaBlend(GdkColor foreground,
-                       GdkColor background,
-                       SkAlpha alpha) {
-  return libgtk2ui::SkColorToGdkColor(
-      color_utils::AlphaBlend(libgtk2ui::GdkColorToSkColor(foreground),
-                              libgtk2ui::GdkColorToSkColor(background), alpha));
-}
+const SkColor kURLTextColor = SkColorSetRGB(0x0b, 0x80, 0x43);
 
 // Generates the normal URL color, a green color used in unhighlighted URL
 // text. It is a mix of |kURLTextColor| and the current text color.  Unlike the
 // selected text color, it is more important to match the qualities of the
 // foreground typeface color instead of taking the background into account.
-GdkColor NormalURLColor(GdkColor foreground) {
-  color_utils::HSL fg_hsl;
-  color_utils::SkColorToHSL(libgtk2ui::GdkColorToSkColor(foreground), &fg_hsl);
-
-  color_utils::HSL hue_hsl;
-  color_utils::SkColorToHSL(libgtk2ui::GdkColorToSkColor(kURLTextColor),
-                            &hue_hsl);
+SkColor NormalURLColor(SkColor foreground) {
+  color_utils::HSL fg_hsl, hue_hsl;
+  color_utils::SkColorToHSL(foreground, &fg_hsl);
+  color_utils::SkColorToHSL(kURLTextColor, &hue_hsl);
 
   // Only allow colors that have a fair amount of saturation in them (color vs
   // white). This means that our output color will always be fairly green.
@@ -58,7 +48,7 @@
     l = (fg_hsl.l + hue_hsl.l) / 2;
 
   color_utils::HSL output = { hue_hsl.h, s, l };
-  return libgtk2ui::SkColorToGdkColor(color_utils::HSLToSkColor(output, 255));
+  return color_utils::HSLToSkColor(output, 255);
 }
 
 // Generates the selected URL color, a green color used on URL text in the
@@ -66,18 +56,11 @@
 // |kURLTextColor|, the current text color, and the background color (the
 // select highlight). It is more important to contrast with the background
 // saturation than to look exactly like the foreground color.
-GdkColor SelectedURLColor(GdkColor foreground, GdkColor background) {
-  color_utils::HSL fg_hsl;
-  color_utils::SkColorToHSL(libgtk2ui::GdkColorToSkColor(foreground),
-                            &fg_hsl);
-
-  color_utils::HSL bg_hsl;
-  color_utils::SkColorToHSL(libgtk2ui::GdkColorToSkColor(background),
-                            &bg_hsl);
-
-  color_utils::HSL hue_hsl;
-  color_utils::SkColorToHSL(libgtk2ui::GdkColorToSkColor(kURLTextColor),
-                            &hue_hsl);
+SkColor SelectedURLColor(SkColor foreground, SkColor background) {
+  color_utils::HSL fg_hsl, bg_hsl, hue_hsl;
+  color_utils::SkColorToHSL(foreground, &fg_hsl);
+  color_utils::SkColorToHSL(background, &bg_hsl);
+  color_utils::SkColorToHSL(kURLTextColor, &hue_hsl);
 
   // The saturation of the text should be opposite of the background, clamped
   // to 0.2-0.8. We make sure it's greater than 0.2 so there's some color, but
@@ -91,12 +74,7 @@
   double l = std::max(0.1, std::min(0.9, opposite_l));
 
   color_utils::HSL output = { hue_hsl.h, s, l };
-  return libgtk2ui::SkColorToGdkColor(color_utils::HSLToSkColor(output, 255));
-}
-
-GdkColor GetReadableColor(SkColor color, const GdkColor& background) {
-  return libgtk2ui::SkColorToGdkColor(color_utils::GetReadableColor(
-      color, libgtk2ui::GdkColorToSkColor(background)));
+  return color_utils::HSLToSkColor(output, 255);
 }
 
 }  // namespace
@@ -104,64 +82,100 @@
 
 namespace libgtk2ui {
 
+enum WidgetState {
+  NORMAL = 0,
+  ACTIVE = 1,
+  PRELIGHT = 2,
+  SELECTED = 3,
+  INSENSITIVE = 4,
+};
+
+#if GTK_MAJOR_VERSION == 2
+// Same order as enum WidgetState above
+const GtkStateType stateMap[] = {
+  GTK_STATE_NORMAL,
+  GTK_STATE_ACTIVE,
+  GTK_STATE_PRELIGHT,
+  GTK_STATE_SELECTED,
+  GTK_STATE_INSENSITIVE,
+};
+
+
+SkColor GetFGColor(GtkWidget* widget, WidgetState state) {
+  return GdkColorToSkColor(gtk_rc_get_style(widget)->fg[stateMap[state]]);
+}
+SkColor GetBGColor(GtkWidget* widget, WidgetState state) {
+  return GdkColorToSkColor(gtk_rc_get_style(widget)->bg[stateMap[state]]);
+}
+
+SkColor GetTextColor(GtkWidget* widget, WidgetState state) {
+  return GdkColorToSkColor(gtk_rc_get_style(widget)->text[stateMap[state]]);
+}
+SkColor GetTextAAColor(GtkWidget* widget, WidgetState state) {
+  return GdkColorToSkColor(gtk_rc_get_style(widget)->text_aa[stateMap[state]]);
+}
+SkColor GetBaseColor(GtkWidget* widget, WidgetState state) {
+  return GdkColorToSkColor(gtk_rc_get_style(widget)->base[stateMap[state]]);
+}
+
+
+#else
+// Same order as enum WidgetState above
+const GtkStateFlags stateMap[] = {
+  GTK_STATE_FLAG_NORMAL,
+  GTK_STATE_FLAG_ACTIVE,
+  GTK_STATE_FLAG_PRELIGHT,
+  GTK_STATE_FLAG_SELECTED,
+  GTK_STATE_FLAG_INSENSITIVE,
+};
+
+
+SkColor GetFGColor(GtkWidget* widget, WidgetState state) {
+  GdkRGBA color;
+  gtk_style_context_get_color(
+      gtk_widget_get_style_context(widget), stateMap[state], &color);
+  return SkColorSetRGB(color.red * 255, color.green * 255, color.blue * 255);
+}
+SkColor GetBGColor(GtkWidget* widget, WidgetState state) {
+  GdkRGBA color;
+
+  G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+  gtk_style_context_get_background_color(
+      gtk_widget_get_style_context(widget), stateMap[state], &color);
+  G_GNUC_END_IGNORE_DEPRECATIONS
+
+  // Hack for default color
+  if (color.alpha == 0.0)
+    color = {1, 1, 1, 1};
+
+  return SkColorSetRGB(color.red * 255, color.green * 255, color.blue * 255);
+}
+
+SkColor GetTextColor(GtkWidget* widget, WidgetState state) {
+  return GetFGColor(widget, state);
+}
+SkColor GetTextAAColor(GtkWidget* widget, WidgetState state) {
+  return GetFGColor(widget, state);
+}
+SkColor GetBaseColor(GtkWidget* widget, WidgetState state) {
+  return GetBGColor(widget, state);
+}
+
+#endif
+
+
 // static
 NativeThemeGtk2* NativeThemeGtk2::instance() {
   CR_DEFINE_STATIC_LOCAL(NativeThemeGtk2, s_native_theme, ());
   return &s_native_theme;
 }
 
-NativeThemeGtk2::NativeThemeGtk2()
-    : fake_window_(NULL),
-      fake_tooltip_(NULL),
-      fake_menu_item_(NULL) {
-}
+// Constructors automatically called
+NativeThemeGtk2::NativeThemeGtk2() {}
+// This doesn't actually get called
+NativeThemeGtk2::~NativeThemeGtk2() {}
 
-NativeThemeGtk2::~NativeThemeGtk2() {
-  if (fake_window_)
-    gtk_widget_destroy(fake_window_);
-  if (fake_tooltip_)
-    gtk_widget_destroy(fake_tooltip_);
 
-  fake_entry_.Destroy();
-  fake_label_.Destroy();
-  fake_button_.Destroy();
-  fake_tree_.Destroy();
-  fake_menu_.Destroy();
-}
-
-gfx::Size NativeThemeGtk2::GetPartSize(Part part,
-                                       State state,
-                                       const ExtraParams& extra) const {
-  if (part == kComboboxArrow)
-    return gfx::Size(12, 12);
-
-  return ui::NativeThemeBase::GetPartSize(part, state, extra);
-}
-
-void NativeThemeGtk2::Paint(SkCanvas* canvas,
-                            Part part,
-                            State state,
-                            const gfx::Rect& rect,
-                            const ExtraParams& extra) const {
-  if (rect.IsEmpty())
-    return;
-
-  switch (part) {
-    case kComboboxArrow:
-      PaintComboboxArrow(canvas, GetGtkState(state), rect);
-      return;
-
-    default:
-      NativeThemeBase::Paint(canvas, part, state, rect, extra);
-  }
-}
-
-SkColor NativeThemeGtk2::GetSystemColor(ColorId color_id) const {
-  if (color_id == kColorId_BlueButtonShadowColor)
-    return SK_ColorTRANSPARENT;
-
-  return GdkColorToSkColor(GetSystemGdkColor(color_id));
-}
 
 void NativeThemeGtk2::PaintMenuPopupBackground(
     SkCanvas* canvas,
@@ -213,208 +227,203 @@
   canvas->drawRect(gfx::RectToSkRect(rect), paint);
 }
 
-GdkColor NativeThemeGtk2::GetSystemGdkColor(ColorId color_id) const {
+SkColor NativeThemeGtk2::GetSystemColor(ColorId color_id) const {
+  if (color_id == kColorId_BlueButtonShadowColor)
+    return SK_ColorTRANSPARENT;
+
   const SkColor kPositiveTextColor = SkColorSetRGB(0x0b, 0x80, 0x43);
   const SkColor kNegativeTextColor = SkColorSetRGB(0xc5, 0x39, 0x29);
+
   switch (color_id) {
     // Windows
     case kColorId_WindowBackground:
-      return GetWindowStyle()->bg[GTK_STATE_NORMAL];
+      return GetBGColor(GetWindow(), SELECTED);
 
     // Dialogs
     case kColorId_DialogBackground:
-      return GetWindowStyle()->bg[GTK_STATE_NORMAL];
+      return GetBGColor(GetWindow(), NORMAL);
 
     // FocusableBorder
     case kColorId_FocusedBorderColor:
-      return GetEntryStyle()->bg[GTK_STATE_SELECTED];
+      return GetBGColor(GetEntry(), SELECTED);
     case kColorId_UnfocusedBorderColor:
-      return GetEntryStyle()->text_aa[GTK_STATE_NORMAL];
+      return GetTextAAColor(GetEntry(), NORMAL);
 
     // MenuItem
     case kColorId_EnabledMenuItemForegroundColor:
     case kColorId_DisabledEmphasizedMenuItemForegroundColor:
-      return GetMenuItemStyle()->text[GTK_STATE_NORMAL];
+      return GetTextColor(GetMenuItem(), NORMAL);
     case kColorId_DisabledMenuItemForegroundColor:
-      return GetMenuItemStyle()->text[GTK_STATE_INSENSITIVE];
+      return GetTextColor(GetMenuItem(), INSENSITIVE);
     case kColorId_SelectedMenuItemForegroundColor:
-      return GetMenuItemStyle()->text[GTK_STATE_SELECTED];
+      return GetTextColor(GetMenuItem(), SELECTED);
     case kColorId_FocusedMenuItemBackgroundColor:
-      return GetMenuItemStyle()->bg[GTK_STATE_SELECTED];
+      return GetBGColor(GetMenuItem(), SELECTED);
     case kColorId_HoverMenuItemBackgroundColor:
-      return GetMenuItemStyle()->bg[GTK_STATE_PRELIGHT];
+      return GetBGColor(GetMenuItem(), PRELIGHT);
     case kColorId_FocusedMenuButtonBorderColor:
-      return GetEntryStyle()->bg[GTK_STATE_NORMAL];
+      return GetBGColor(GetEntry(), NORMAL);
     case kColorId_HoverMenuButtonBorderColor:
-      return GetEntryStyle()->text_aa[GTK_STATE_PRELIGHT];
+      return GetTextAAColor(GetEntry(), PRELIGHT);
     case kColorId_MenuBorderColor:
     case kColorId_EnabledMenuButtonBorderColor:
     case kColorId_MenuSeparatorColor: {
-      return GetMenuItemStyle()->text[GTK_STATE_INSENSITIVE];
+      return GetTextColor(GetMenuItem(), INSENSITIVE);
     }
     case kColorId_MenuBackgroundColor:
-      return GetMenuStyle()->bg[GTK_STATE_NORMAL];
+      return GetBGColor(GetMenu(), NORMAL);
 
     // Label
     case kColorId_LabelEnabledColor:
-      return GetLabelStyle()->text[GTK_STATE_NORMAL];
+      return GetTextColor(GetEntry(), NORMAL);
     case kColorId_LabelDisabledColor:
-      return GetLabelStyle()->text[GTK_STATE_INSENSITIVE];
+      return GetTextColor(GetLabel(), INSENSITIVE);
     case kColorId_LabelBackgroundColor:
-      return GetWindowStyle()->bg[GTK_STATE_NORMAL];
+      return GetBGColor(GetWindow(), NORMAL);
 
     // Button
     case kColorId_ButtonBackgroundColor:
-      return GetButtonStyle()->bg[GTK_STATE_NORMAL];
+      return GetBGColor(GetButton(), NORMAL);
     case kColorId_ButtonEnabledColor:
     case kColorId_BlueButtonEnabledColor:
-      return GetButtonStyle()->text[GTK_STATE_NORMAL];
+      return GetTextColor(GetButton(), NORMAL);
     case kColorId_ButtonDisabledColor:
     case kColorId_BlueButtonDisabledColor:
-      return GetButtonStyle()->text[GTK_STATE_INSENSITIVE];
+      return GetTextColor(GetButton(), INSENSITIVE);
     case kColorId_ButtonHighlightColor:
-      return GetButtonStyle()->base[GTK_STATE_SELECTED];
+      return GetBaseColor(GetButton(), SELECTED);
     case kColorId_ButtonHoverColor:
     case kColorId_BlueButtonHoverColor:
-      return GetButtonStyle()->text[GTK_STATE_PRELIGHT];
+      return GetTextColor(GetButton(), PRELIGHT);
     case kColorId_ButtonHoverBackgroundColor:
-      return GetButtonStyle()->bg[GTK_STATE_PRELIGHT];
+      return GetBGColor(GetButton(), PRELIGHT);
     case kColorId_BlueButtonPressedColor:
-      return GetButtonStyle()->text[GTK_STATE_ACTIVE];
+      return GetTextColor(GetButton(), ACTIVE);
     case kColorId_BlueButtonShadowColor:
       // Should be handled in GetSystemColor().
       NOTREACHED();
-      return GetButtonStyle()->text[GTK_STATE_NORMAL];
+      return GetTextColor(GetButton(), NORMAL);
 
     // Textfield
     case kColorId_TextfieldDefaultColor:
-      return GetEntryStyle()->text[GTK_STATE_NORMAL];
+      return GetTextColor(GetEntry(), NORMAL);
     case kColorId_TextfieldDefaultBackground:
-      return GetEntryStyle()->base[GTK_STATE_NORMAL];
+      return GetBaseColor(GetEntry(), NORMAL);
     case kColorId_TextfieldReadOnlyColor:
-      return GetEntryStyle()->text[GTK_STATE_INSENSITIVE];
+      return GetTextColor(GetEntry(), INSENSITIVE);
     case kColorId_TextfieldReadOnlyBackground:
-      return GetEntryStyle()->base[GTK_STATE_INSENSITIVE];
+      return GetBaseColor(GetEntry(), INSENSITIVE);
     case kColorId_TextfieldSelectionColor:
-      return GetEntryStyle()->text[GTK_STATE_SELECTED];
+      return GetTextColor(GetEntry(), SELECTED);
     case kColorId_TextfieldSelectionBackgroundFocused:
-      return GetEntryStyle()->base[GTK_STATE_SELECTED];
+      return GetBaseColor(GetEntry(), SELECTED);
 
     // Tooltips
     case kColorId_TooltipBackground:
-      return GetTooltipStyle()->bg[GTK_STATE_NORMAL];
+      return GetBGColor(GetTooltip(), NORMAL);
     case kColorId_TooltipText:
-      return GetTooltipStyle()->fg[GTK_STATE_NORMAL];
+      return GetFGColor(GetTooltip(), NORMAL);
 
     // Trees and Tables (implemented on GTK using the same class)
     case kColorId_TableBackground:
     case kColorId_TreeBackground:
-      return GetTreeStyle()->bg[GTK_STATE_NORMAL];
+      return GetBGColor(GetTree(), NORMAL);
     case kColorId_TableText:
     case kColorId_TreeText:
-      return GetTreeStyle()->text[GTK_STATE_NORMAL];
+      return GetTextColor(GetTree(), NORMAL);
     case kColorId_TableSelectedText:
     case kColorId_TableSelectedTextUnfocused:
     case kColorId_TreeSelectedText:
     case kColorId_TreeSelectedTextUnfocused:
-      return GetTreeStyle()->text[GTK_STATE_SELECTED];
+      return GetTextColor(GetTree(), SELECTED);
     case kColorId_TableSelectionBackgroundFocused:
     case kColorId_TableSelectionBackgroundUnfocused:
     case kColorId_TreeSelectionBackgroundFocused:
     case kColorId_TreeSelectionBackgroundUnfocused:
-      return GetTreeStyle()->bg[GTK_STATE_SELECTED];
+      return GetBGColor(GetTree(), SELECTED);
     case kColorId_TreeArrow:
-      return GetTreeStyle()->fg[GTK_STATE_NORMAL];
+      return GetFGColor(GetTree(), NORMAL);
     case kColorId_TableGroupingIndicatorColor:
-      return GetTreeStyle()->text_aa[GTK_STATE_NORMAL];
+      return GetTextAAColor(GetTree(), NORMAL);
 
       // Results Table
     case kColorId_ResultsTableNormalBackground:
-      return GetEntryStyle()->base[GTK_STATE_NORMAL];
-    case kColorId_ResultsTableHoveredBackground: {
-      GtkStyle* entry_style = GetEntryStyle();
-      return GdkAlphaBlend(
-          entry_style->base[GTK_STATE_NORMAL],
-          entry_style->base[GTK_STATE_SELECTED], 0x80);
-    }
+      return GetBaseColor(GetEntry(), NORMAL);
+    case kColorId_ResultsTableHoveredBackground:
+      return color_utils::AlphaBlend(GetBaseColor(GetEntry(), NORMAL),
+                                     GetBaseColor(GetEntry(), SELECTED),
+                                     0x80);
     case kColorId_ResultsTableSelectedBackground:
-      return GetEntryStyle()->base[GTK_STATE_SELECTED];
+      return GetBaseColor(GetEntry(), SELECTED);
     case kColorId_ResultsTableNormalText:
     case kColorId_ResultsTableHoveredText:
-      return GetEntryStyle()->text[GTK_STATE_NORMAL];
+      return GetTextColor(GetEntry(), NORMAL);
     case kColorId_ResultsTableSelectedText:
-      return GetEntryStyle()->text[GTK_STATE_SELECTED];
+      return GetTextColor(GetEntry(), SELECTED);
     case kColorId_ResultsTableNormalDimmedText:
-    case kColorId_ResultsTableHoveredDimmedText: {
-      GtkStyle* entry_style = GetEntryStyle();
-      return GdkAlphaBlend(
-          entry_style->text[GTK_STATE_NORMAL],
-          entry_style->base[GTK_STATE_NORMAL], 0x80);
-    }
-    case kColorId_ResultsTableSelectedDimmedText: {
-      GtkStyle* entry_style = GetEntryStyle();
-      return GdkAlphaBlend(
-          entry_style->text[GTK_STATE_SELECTED],
-          entry_style->base[GTK_STATE_NORMAL], 0x80);
-    }
+    case kColorId_ResultsTableHoveredDimmedText:
+      return color_utils::AlphaBlend(GetTextColor(GetEntry(), NORMAL),
+                                     GetBaseColor(GetEntry(), NORMAL),
+                                     0x80);
+    case kColorId_ResultsTableSelectedDimmedText:
+      return color_utils::AlphaBlend(GetTextColor(GetEntry(), SELECTED),
+                                     GetBaseColor(GetEntry(), NORMAL),
+                                     0x80);
     case kColorId_ResultsTableNormalUrl:
-    case kColorId_ResultsTableHoveredUrl: {
-      return NormalURLColor(GetEntryStyle()->text[GTK_STATE_NORMAL]);
-    }
-    case kColorId_ResultsTableSelectedUrl: {
-      GtkStyle* entry_style = GetEntryStyle();
-      return SelectedURLColor(entry_style->text[GTK_STATE_SELECTED],
-                              entry_style->base[GTK_STATE_SELECTED]);
-    }
-    case kColorId_ResultsTableNormalDivider: {
-      GtkStyle* win_style = GetWindowStyle();
-      return GdkAlphaBlend(win_style->text[GTK_STATE_NORMAL],
-                           win_style->bg[GTK_STATE_NORMAL], 0x34);
-    }
-    case kColorId_ResultsTableHoveredDivider: {
-      GtkStyle* win_style = GetWindowStyle();
-      return GdkAlphaBlend(win_style->text[GTK_STATE_PRELIGHT],
-                           win_style->bg[GTK_STATE_PRELIGHT], 0x34);
-    }
-    case kColorId_ResultsTableSelectedDivider: {
-      GtkStyle* win_style = GetWindowStyle();
-      return GdkAlphaBlend(win_style->text[GTK_STATE_SELECTED],
-                           win_style->bg[GTK_STATE_SELECTED], 0x34);
-    }
+    case kColorId_ResultsTableHoveredUrl:
+      return NormalURLColor(GetTextColor(GetEntry(), NORMAL));
+
+    case kColorId_ResultsTableSelectedUrl:
+      return SelectedURLColor(GetTextColor(GetEntry(), SELECTED),
+                              GetBaseColor(GetEntry(), SELECTED));
+    case kColorId_ResultsTableNormalDivider:
+      return color_utils::AlphaBlend(GetTextColor(GetWindow(), NORMAL),
+                                     GetBGColor(GetWindow(), NORMAL),
+                                     0x34);
+    case kColorId_ResultsTableHoveredDivider:
+      return color_utils::AlphaBlend(GetTextColor(GetWindow(), PRELIGHT),
+                                     GetBGColor(GetWindow(), PRELIGHT),
+                                     0x34);
+    case kColorId_ResultsTableSelectedDivider:
+      return color_utils::AlphaBlend(GetTextColor(GetWindow(), SELECTED),
+                                     GetBGColor(GetWindow(), SELECTED),
+                                     0x34);
+
     case kColorId_ResultsTablePositiveText: {
-      return GetReadableColor(kPositiveTextColor,
-                              GetEntryStyle()->base[GTK_STATE_NORMAL]);
+      return color_utils::GetReadableColor(kPositiveTextColor,
+                                           GetBaseColor(GetEntry(), NORMAL));
     }
     case kColorId_ResultsTablePositiveHoveredText: {
-      return GetReadableColor(kPositiveTextColor,
-                              GetEntryStyle()->base[GTK_STATE_PRELIGHT]);
+      return color_utils::GetReadableColor(kPositiveTextColor,
+                                           GetBaseColor(GetEntry(), PRELIGHT));
     }
     case kColorId_ResultsTablePositiveSelectedText: {
-      return GetReadableColor(kPositiveTextColor,
-                              GetEntryStyle()->base[GTK_STATE_SELECTED]);
+      return color_utils::GetReadableColor(kPositiveTextColor,
+                                           GetBaseColor(GetEntry(), SELECTED));
     }
     case kColorId_ResultsTableNegativeText: {
-      return GetReadableColor(kNegativeTextColor,
-                              GetEntryStyle()->base[GTK_STATE_NORMAL]);
+      return color_utils::GetReadableColor(kNegativeTextColor,
+                                           GetBaseColor(GetEntry(), NORMAL));
     }
     case kColorId_ResultsTableNegativeHoveredText: {
-      return GetReadableColor(kNegativeTextColor,
-                              GetEntryStyle()->base[GTK_STATE_PRELIGHT]);
+      return color_utils::GetReadableColor(kNegativeTextColor,
+                                           GetBaseColor(GetEntry(), PRELIGHT));
     }
     case kColorId_ResultsTableNegativeSelectedText: {
-      return GetReadableColor(kNegativeTextColor,
-                              GetEntryStyle()->base[GTK_STATE_SELECTED]);
+      return color_utils::GetReadableColor(kNegativeTextColor,
+                                           GetBaseColor(GetEntry(), SELECTED));
     }
 
     // Throbber
     case kColorId_ThrobberSpinningColor:
     case kColorId_ThrobberLightColor: {
-      return GetEntryStyle()->bg[GTK_STATE_SELECTED];
+      return GetBGColor(GetEntry(), SELECTED);
     }
 
     case kColorId_ThrobberWaitingColor: {
-      return GdkAlphaBlend(GetEntryStyle()->bg[GTK_STATE_SELECTED],
-                           GetWindowStyle()->bg[GTK_STATE_NORMAL], 0xff / 2);
+      return color_utils::AlphaBlend(GetBGColor(GetEntry(), SELECTED),
+                                     GetBGColor(GetWindow(), NORMAL),
+                                     0x80);
     }
 
     case kColorId_Amber:
@@ -425,118 +434,76 @@
       break;
   }
 
-  return SkColorToGdkColor(kInvalidColorIdColor);
+  return kInvalidColorIdColor;
 }
 
-GtkWidget* NativeThemeGtk2::GetRealizedWindow() const {
-  if (!fake_window_) {
-    fake_window_ = gtk_window_new(GTK_WINDOW_TOPLEVEL);
-    gtk_widget_realize(fake_window_);
+GtkWidget* NativeThemeGtk2::GetWindow() const {
+  if (!fake_window_.get()) {
+    fake_window_.Own(chrome_gtk_frame_new());
+    gtk_widget_realize(fake_window_.get());
   }
 
-  return fake_window_;
+  return fake_window_.get();
 }
 
-GtkStyle* NativeThemeGtk2::GetWindowStyle() const {
-  return gtk_rc_get_style(GetRealizedWindow());
-}
-
-GtkStyle* NativeThemeGtk2::GetEntryStyle() const {
+GtkWidget* NativeThemeGtk2::GetEntry() const {
   if (!fake_entry_.get()) {
     fake_entry_.Own(gtk_entry_new());
 
     // The fake entry needs to be in the window so it can be realized so we can
     // use the computed parts of the style.
-    gtk_container_add(GTK_CONTAINER(GetRealizedWindow()), fake_entry_.get());
+    gtk_container_add(GTK_CONTAINER(GetWindow()), fake_entry_.get());
     gtk_widget_realize(fake_entry_.get());
   }
-  return gtk_rc_get_style(fake_entry_.get());
+
+  return fake_entry_.get();
 }
 
-GtkStyle* NativeThemeGtk2::GetLabelStyle() const {
+GtkWidget* NativeThemeGtk2::GetLabel() const {
   if (!fake_label_.get())
     fake_label_.Own(gtk_label_new(""));
 
-  return gtk_rc_get_style(fake_label_.get());
+  return fake_label_.get();
 }
 
-GtkStyle* NativeThemeGtk2::GetButtonStyle() const {
+GtkWidget* NativeThemeGtk2::GetButton() const {
   if (!fake_button_.get())
     fake_button_.Own(gtk_button_new());
 
-  return gtk_rc_get_style(fake_button_.get());
+  return fake_button_.get();
 }
 
-GtkStyle* NativeThemeGtk2::GetTreeStyle() const {
+GtkWidget* NativeThemeGtk2::GetTree() const {
   if (!fake_tree_.get())
     fake_tree_.Own(gtk_tree_view_new());
 
-  return gtk_rc_get_style(fake_tree_.get());
+  return fake_tree_.get();
 }
 
-GtkStyle* NativeThemeGtk2::GetTooltipStyle() const {
-  if (!fake_tooltip_) {
-    fake_tooltip_ = gtk_window_new(GTK_WINDOW_TOPLEVEL);
-    gtk_widget_set_name(fake_tooltip_, "gtk-tooltip");
-    gtk_widget_realize(fake_tooltip_);
+GtkWidget* NativeThemeGtk2::GetTooltip() const {
+  if (!fake_tooltip_.get()) {
+    fake_tooltip_.Own(gtk_window_new(GTK_WINDOW_TOPLEVEL));
+    gtk_widget_set_name(fake_tooltip_.get(), "gtk-tooltip");
+    gtk_widget_realize(fake_tooltip_.get());
   }
-  return gtk_rc_get_style(fake_tooltip_);
+
+  return fake_tooltip_.get();
 }
 
-GtkStyle* NativeThemeGtk2::GetMenuStyle() const {
+GtkWidget* NativeThemeGtk2::GetMenu() const {
   if (!fake_menu_.get())
     fake_menu_.Own(gtk_custom_menu_new());
-  return gtk_rc_get_style(fake_menu_.get());
+
+  return fake_menu_.get();
 }
 
-GtkStyle* NativeThemeGtk2::GetMenuItemStyle() const {
-  if (!fake_menu_item_) {
-    if (!fake_menu_.get())
-      fake_menu_.Own(gtk_custom_menu_new());
-
-    fake_menu_item_ = gtk_custom_menu_item_new();
-    gtk_menu_shell_append(GTK_MENU_SHELL(fake_menu_.get()), fake_menu_item_);
+GtkWidget* NativeThemeGtk2::GetMenuItem() const {
+  if (!fake_menu_item_.get()) {
+    fake_menu_item_.Own(gtk_custom_menu_item_new());
+    gtk_menu_shell_append(GTK_MENU_SHELL(GetMenu()), fake_menu_item_.get());
   }
 
-  return gtk_rc_get_style(fake_menu_item_);
-}
-
-void NativeThemeGtk2::PaintComboboxArrow(SkCanvas* canvas,
-                                         GtkStateType state,
-                                         const gfx::Rect& rect) const {
-  GdkPixmap* pm = gdk_pixmap_new(gtk_widget_get_window(GetRealizedWindow()),
-                                 rect.width(),
-                                 rect.height(),
-                                 -1);
-  // Paint the background.
-  gtk_paint_flat_box(GetWindowStyle(),
-                     pm,
-                     state,
-                     GTK_SHADOW_NONE,
-                     NULL,
-                     GetRealizedWindow(),
-                     NULL, 0, 0, rect.width(), rect.height());
-  gtk_paint_arrow(GetWindowStyle(),
-                  pm,
-                  state,
-                  GTK_SHADOW_NONE,
-                  NULL,
-                  GetRealizedWindow(),
-                  NULL,
-                  GTK_ARROW_DOWN,
-                  true,
-                  0, 0, rect.width(), rect.height());
-  GdkPixbuf* pb = gdk_pixbuf_get_from_drawable(NULL,
-                                               pm,
-                                               gdk_drawable_get_colormap(pm),
-                                               0, 0,
-                                               0, 0,
-                                               rect.width(), rect.height());
-  SkBitmap arrow = GdkPixbufToImageSkia(pb);
-  canvas->drawBitmap(arrow, rect.x(), rect.y());
-
-  g_object_unref(pb);
-  g_object_unref(pm);
+  return fake_menu_item_.get();
 }
 
 }  // namespace libgtk2ui
diff --git a/chrome/browser/ui/libgtk2ui/native_theme_gtk2.h b/chrome/browser/ui/libgtk2ui/native_theme_gtk2.h
index 78e9c89..abc4cf1 100644
--- a/chrome/browser/ui/libgtk2ui/native_theme_gtk2.h
+++ b/chrome/browser/ui/libgtk2ui/native_theme_gtk2.h
@@ -10,7 +10,6 @@
 #include "chrome/browser/ui/libgtk2ui/owned_widget_gtk2.h"
 #include "ui/native_theme/native_theme_base.h"
 
-typedef struct _GdkColor GdkColor;
 
 namespace libgtk2ui {
 
@@ -22,14 +21,6 @@
   static NativeThemeGtk2* instance();
 
   // Overridden from ui::NativeThemeBase:
-  gfx::Size GetPartSize(Part part,
-                        State state,
-                        const ExtraParams& extra) const override;
-  void Paint(SkCanvas* canvas,
-             Part part,
-             State state,
-             const gfx::Rect& rect,
-             const ExtraParams& extra) const override;
   SkColor GetSystemColor(ColorId color_id) const override;
   void PaintMenuPopupBackground(
       SkCanvas* canvas,
@@ -41,37 +32,28 @@
       const gfx::Rect& rect,
       const MenuListExtraParams& menu_list) const override;
 
+  // Returns various widgets for theming use.
+  GtkWidget* GetWindow() const;
+  GtkWidget* GetEntry() const;
+  GtkWidget* GetLabel() const;
+  GtkWidget* GetButton() const;
+  GtkWidget* GetTree() const;
+  GtkWidget* GetTooltip() const;
+  GtkWidget* GetMenu() const;
+  GtkWidget* GetMenuItem() const;
+
  private:
   NativeThemeGtk2();
   ~NativeThemeGtk2() override;
 
-  // Implementation of GetSystemColor.
-  GdkColor GetSystemGdkColor(ColorId color_id) const;
-
-  // Returns styles associated with various widget types.
-  GtkWidget* GetRealizedWindow() const;
-  GtkStyle* GetWindowStyle() const;
-  GtkStyle* GetEntryStyle() const;
-  GtkStyle* GetLabelStyle() const;
-  GtkStyle* GetButtonStyle() const;
-  GtkStyle* GetTreeStyle() const;
-  GtkStyle* GetTooltipStyle() const;
-  GtkStyle* GetMenuStyle() const;
-  GtkStyle* GetMenuItemStyle() const;
-
-  void PaintComboboxArrow(SkCanvas* canvas,
-                          GtkStateType state,
-                          const gfx::Rect& rect) const;
-
-  mutable GtkWidget* fake_window_;
-  mutable GtkWidget* fake_tooltip_;
+  mutable OwnedWidgetGtk fake_window_;
   mutable OwnedWidgetGtk fake_entry_;
   mutable OwnedWidgetGtk fake_label_;
   mutable OwnedWidgetGtk fake_button_;
   mutable OwnedWidgetGtk fake_tree_;
-
+  mutable OwnedWidgetGtk fake_tooltip_;
   mutable OwnedWidgetGtk fake_menu_;
-  mutable GtkWidget* fake_menu_item_;
+  mutable OwnedWidgetGtk fake_menu_item_;
 
   DISALLOW_COPY_AND_ASSIGN(NativeThemeGtk2);
 };
diff --git a/chrome/browser/ui/libgtk2ui/owned_widget_gtk2.cc b/chrome/browser/ui/libgtk2ui/owned_widget_gtk2.cc
index cf6a3a4..e459968 100644
--- a/chrome/browser/ui/libgtk2ui/owned_widget_gtk2.cc
+++ b/chrome/browser/ui/libgtk2ui/owned_widget_gtk2.cc
@@ -19,11 +19,8 @@
     return;
 
   DCHECK(!widget_);
-  // We want to make sure that Own() was called properly, right after the
-  // widget was created. There should be a floating reference.
-  DCHECK(g_object_is_floating(widget));
 
-  // Sink the floating reference, we should now own this reference.
+  // Keep a reference
   g_object_ref_sink(widget);
   widget_ = widget;
 }
diff --git a/chrome/browser/ui/libgtk2ui/print_dialog_gtk2.cc b/chrome/browser/ui/libgtk2ui/print_dialog_gtk2.cc
index 3ade592..180de273 100644
--- a/chrome/browser/ui/libgtk2ui/print_dialog_gtk2.cc
+++ b/chrome/browser/ui/libgtk2ui/print_dialog_gtk2.cc
@@ -488,6 +488,18 @@
   }
 }
 
+
+
+static void OnJobCompletedThunk(GtkPrintJob* print_job,
+                                gpointer user_data,
+#if GTK_MAJOR_VERSION == 2
+                                GError* error
+#else
+                                const GError* error
+#endif
+                                ) {
+  static_cast<PrintDialogGtk2*>(user_data)->OnJobCompleted(print_job, error);
+}
 void PrintDialogGtk2::SendDocumentToPrinter(
     const base::string16& document_name) {
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
@@ -512,14 +524,8 @@
   gtk_print_job_send(print_job, OnJobCompletedThunk, this, NULL);
 }
 
-// static
-void PrintDialogGtk2::OnJobCompletedThunk(GtkPrintJob* print_job,
-                                         gpointer user_data,
-                                         GError* error) {
-  static_cast<PrintDialogGtk2*>(user_data)->OnJobCompleted(print_job, error);
-}
-
-void PrintDialogGtk2::OnJobCompleted(GtkPrintJob* print_job, GError* error) {
+void PrintDialogGtk2::OnJobCompleted(GtkPrintJob* print_job,
+                                     const GError* error) {
   if (error)
     LOG(ERROR) << "Printing failed: " << error->message;
   if (print_job)
diff --git a/chrome/browser/ui/libgtk2ui/print_dialog_gtk2.h b/chrome/browser/ui/libgtk2ui/print_dialog_gtk2.h
index ce39b5a..162e2f6 100644
--- a/chrome/browser/ui/libgtk2ui/print_dialog_gtk2.h
+++ b/chrome/browser/ui/libgtk2ui/print_dialog_gtk2.h
@@ -48,6 +48,9 @@
   void AddRefToDialog() override;
   void ReleaseDialog() override;
 
+  // Handles print job response.
+  void OnJobCompleted(GtkPrintJob* print_job, const GError* error);
+
  private:
   friend struct content::BrowserThread::DeleteOnThread<
       content::BrowserThread::UI>;
@@ -62,12 +65,6 @@
   // Prints document named |document_name|.
   void SendDocumentToPrinter(const base::string16& document_name);
 
-  // Handles print job response.
-  static void OnJobCompletedThunk(GtkPrintJob* print_job,
-                                  gpointer user_data,
-                                  GError* error);
-  void OnJobCompleted(GtkPrintJob* print_job, GError* error);
-
   // Helper function for initializing |context_|'s PrintSettings with a given
   // |settings|.
   void InitPrintSettings(printing::PrintSettings* settings);
diff --git a/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.cc b/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.cc
index abeab29..91daa5c 100644
--- a/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.cc
+++ b/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.cc
@@ -386,8 +386,8 @@
   GtkWidget* dialog =
       gtk_file_chooser_dialog_new(title.c_str(), NULL,
                                   GTK_FILE_CHOOSER_ACTION_OPEN,
-                                  GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-                                  GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+                                  "_Cancel", GTK_RESPONSE_CANCEL,
+                                  "_Open", GTK_RESPONSE_ACCEPT,
                                   NULL);
   SetGtkTransientForAura(dialog, parent);
   AddFilters(GTK_FILE_CHOOSER(dialog));
@@ -422,12 +422,12 @@
   }
   std::string accept_button_label = (type == SELECT_UPLOAD_FOLDER) ?
       l10n_util::GetStringUTF8(IDS_SELECT_UPLOAD_FOLDER_DIALOG_UPLOAD_BUTTON) :
-      GTK_STOCK_OPEN;
+      "_Open";
 
   GtkWidget* dialog =
       gtk_file_chooser_dialog_new(title_string.c_str(), NULL,
                                   GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
-                                  GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+                                  "_Cancel", GTK_RESPONSE_CANCEL,
                                   accept_button_label.c_str(),
                                   GTK_RESPONSE_ACCEPT,
                                   NULL);
@@ -482,8 +482,8 @@
   GtkWidget* dialog =
       gtk_file_chooser_dialog_new(title_string.c_str(), NULL,
                                   GTK_FILE_CHOOSER_ACTION_SAVE,
-                                  GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-                                  GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
+                                  "_Cancel", GTK_RESPONSE_CANCEL,
+                                  "_Save", GTK_RESPONSE_ACCEPT,
                                   NULL);
   SetGtkTransientForAura(dialog, parent);
 
diff --git a/chrome/browser/ui/libgtk2ui/x11_input_method_context_impl_gtk2.h b/chrome/browser/ui/libgtk2ui/x11_input_method_context_impl_gtk2.h
index 13fb115..b512859 100644
--- a/chrome/browser/ui/libgtk2ui/x11_input_method_context_impl_gtk2.h
+++ b/chrome/browser/ui/libgtk2ui/x11_input_method_context_impl_gtk2.h
@@ -17,7 +17,6 @@
 #include "ui/gfx/geometry/rect.h"
 
 typedef union _GdkEvent GdkEvent;
-typedef struct _GdkDrawable GdkWindow;
 typedef struct _GtkIMContext GtkIMContext;
 
 namespace libgtk2ui {
@@ -74,7 +73,7 @@
   // IME's input GTK context.
   GtkIMContext* gtk_context_;
 
-  GdkWindow* gdk_last_set_client_window_;
+  gpointer gdk_last_set_client_window_;
 
   // Last known caret bounds relative to the screen coordinates.
   gfx::Rect last_caret_bounds_;
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc
index eb294ef..1e39ed4 100644
--- a/content/browser/browser_main_loop.cc
+++ b/content/browser/browser_main_loop.cc
@@ -241,6 +241,8 @@
     LOG(ERROR) << message << " (http://bugs.chromium.org/329991)";
   } else if (strstr(message, "Cannot do system-bus activation with no user")) {
     LOG(ERROR) << message << " (http://crbug.com/431005)";
+  } else if (strstr(message, "deprecated")) {
+    LOG(ERROR) << message;
   } else {
     LOG(DFATAL) << log_domain << ": " << message;
   }