summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/chromeos/main_menu.cc4
-rw-r--r--chrome/browser/extensions/extension_host.cc6
-rw-r--r--chrome/browser/extensions/extension_host.h2
-rw-r--r--chrome/browser/gtk/gtk_theme_provider.cc89
-rw-r--r--chrome/browser/gtk/gtk_theme_provider.h7
-rw-r--r--chrome/browser/renderer_host/render_view_host.cc5
-rw-r--r--chrome/browser/renderer_host/render_view_host_delegate.h2
-rw-r--r--chrome/browser/renderer_preferences_util.cc30
-rw-r--r--chrome/browser/renderer_preferences_util.h18
-rw-r--r--chrome/browser/tab_contents/interstitial_page.cc4
-rw-r--r--chrome/browser/tab_contents/interstitial_page.h2
-rw-r--r--chrome/browser/tab_contents/tab_contents.cc6
-rw-r--r--chrome/browser/tab_contents/tab_contents.h2
-rwxr-xr-xchrome/chrome_browser.gypi2
-rw-r--r--chrome/common/gtk_util.cc22
-rw-r--r--chrome/common/gtk_util.h3
-rw-r--r--chrome/common/platform_util.h3
-rw-r--r--chrome/common/platform_util_linux.cc12
-rw-r--r--chrome/common/platform_util_mac.mm4
-rw-r--r--chrome/common/platform_util_win.cc4
-rw-r--r--chrome/common/render_messages.h12
-rw-r--r--chrome/common/renderer_preferences.h9
-rw-r--r--chrome/renderer/render_view.cc6
23 files changed, 216 insertions, 38 deletions
diff --git a/chrome/browser/chromeos/main_menu.cc b/chrome/browser/chromeos/main_menu.cc
index 9f6cd15..5547f28 100644
--- a/chrome/browser/chromeos/main_menu.cc
+++ b/chrome/browser/chromeos/main_menu.cc
@@ -20,9 +20,9 @@
#include "chrome/browser/renderer_host/render_widget_host_view.h"
#include "chrome/browser/renderer_host/render_widget_host_view_gtk.h"
#include "chrome/browser/renderer_host/site_instance.h"
+#include "chrome/browser/renderer_preferences_util.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/tab_contents/render_view_host_delegate_helper.h"
-#include "chrome/common/platform_util.h"
#include "grit/app_resources.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
@@ -245,7 +245,7 @@ void MainMenu::RequestMove(const gfx::Rect& new_bounds) {
}
RendererPreferences MainMenu::GetRendererPrefs() const {
- return platform_util::GetInitedRendererPreferences();
+ return renderer_preferences_util::GetInitedRendererPreferences();
}
void MainMenu::CreateNewWindow(int route_id) {
diff --git a/chrome/browser/extensions/extension_host.cc b/chrome/browser/extensions/extension_host.cc
index 0ad3a9e..589a4ca 100644
--- a/chrome/browser/extensions/extension_host.cc
+++ b/chrome/browser/extensions/extension_host.cc
@@ -27,12 +27,12 @@
#include "chrome/browser/renderer_host/render_widget_host.h"
#include "chrome/browser/renderer_host/render_widget_host_view.h"
#include "chrome/browser/renderer_host/site_instance.h"
+#include "chrome/browser/renderer_preferences_util.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/tab_contents/tab_contents_view.h"
#include "chrome/common/bindings_policy.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/notification_service.h"
-#include "chrome/common/platform_util.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "chrome/common/view_types.h"
@@ -415,8 +415,8 @@ void ExtensionHost::Close(RenderViewHost* render_view_host) {
}
}
-RendererPreferences ExtensionHost::GetRendererPrefs() const {
- return platform_util::GetInitedRendererPreferences();
+RendererPreferences ExtensionHost::GetRendererPrefs(Profile* profile) const {
+ return renderer_preferences_util::GetInitedRendererPreferences(profile);
}
WebPreferences ExtensionHost::GetWebkitPrefs() {
diff --git a/chrome/browser/extensions/extension_host.h b/chrome/browser/extensions/extension_host.h
index 76f20d2..21939ba 100644
--- a/chrome/browser/extensions/extension_host.h
+++ b/chrome/browser/extensions/extension_host.h
@@ -119,7 +119,7 @@ class ExtensionHost : public ExtensionPopupHost::PopupDelegate,
IPC::Message* reply_msg,
bool* did_suppress_message);
virtual void Close(RenderViewHost* render_view_host);
- virtual RendererPreferences GetRendererPrefs() const;
+ virtual RendererPreferences GetRendererPrefs(Profile* profile) const;
// RenderViewHostDelegate::View
virtual void CreateNewWindow(int route_id);
diff --git a/chrome/browser/gtk/gtk_theme_provider.cc b/chrome/browser/gtk/gtk_theme_provider.cc
index c12ec92..4f35110 100644
--- a/chrome/browser/gtk/gtk_theme_provider.cc
+++ b/chrome/browser/gtk/gtk_theme_provider.cc
@@ -176,6 +176,95 @@ GdkColor GtkThemeProvider::GetBorderColor() const {
return color;
}
+void GtkThemeProvider::GetScrollbarColors(GdkColor* thumb_active_color,
+ GdkColor* thumb_inactive_color,
+ GdkColor* track_color,
+ bool use_gtk_theme) {
+ if (!use_gtk_theme) {
+ // If using the default non-GTK colors, pick some reasonable choices of
+ // different greys.
+ thumb_active_color->pixel = 0;
+ thumb_active_color->red = 64250;
+ thumb_active_color->green = 63736;
+ thumb_active_color->blue = 62965;
+ thumb_inactive_color->pixel = 0;
+ thumb_inactive_color->red = 61680;
+ thumb_inactive_color->green = 60395;
+ thumb_inactive_color->blue = 58853;
+ track_color->pixel = 0;
+ track_color->red = 58339;
+ track_color->green = 56797;
+ track_color->blue = 55512;
+ 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
+ int kWidth = 100;
+ int kHeight = 20;
+ GtkStyle* style = gtk_rc_get_style(scrollbar);
+ GdkPixmap* pm = gdk_pixmap_new(window->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);
+}
+
CairoCachedSurface* GtkThemeProvider::GetSurfaceNamed(
int id, GtkWidget* widget_on_display) {
GdkDisplay* display = gtk_widget_get_display(widget_on_display);
diff --git a/chrome/browser/gtk/gtk_theme_provider.h b/chrome/browser/gtk/gtk_theme_provider.h
index f39902e..60d72e7 100644
--- a/chrome/browser/gtk/gtk_theme_provider.h
+++ b/chrome/browser/gtk/gtk_theme_provider.h
@@ -65,6 +65,13 @@ class GtkThemeProvider : public BrowserThemeProvider,
// label. Used for borders between GTK stuff and the webcontent.
GdkColor GetBorderColor() const;
+ // This method returns averages of the thumb part and of the track colors.
+ // Used when rendering scrollbars.
+ static void GetScrollbarColors(GdkColor* thumb_active_color,
+ GdkColor* thumb_inactive_color,
+ GdkColor* track_color,
+ bool use_gtk_theme);
+
// Expose the inner label. Only used for testing.
GtkWidget* fake_label() { return fake_label_.get(); }
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc
index a473519..ed6b80e 100644
--- a/chrome/browser/renderer_host/render_view_host.cc
+++ b/chrome/browser/renderer_host/render_view_host.cc
@@ -207,7 +207,7 @@ bool RenderViewHost::CreateRenderView(
}
Send(new ViewMsg_New(GetNativeViewId(),
- delegate_->GetRendererPrefs(),
+ delegate_->GetRendererPrefs(process()->profile()),
webkit_prefs,
routing_id()));
@@ -234,7 +234,8 @@ bool RenderViewHost::IsRenderViewLive() const {
void RenderViewHost::SyncRendererPrefs() {
Send(new ViewMsg_SetRendererPrefs(routing_id(),
- delegate_->GetRendererPrefs()));
+ delegate_->GetRendererPrefs(
+ process()->profile())));
}
void RenderViewHost::Navigate(const ViewMsg_Navigate_Params& params) {
diff --git a/chrome/browser/renderer_host/render_view_host_delegate.h b/chrome/browser/renderer_host/render_view_host_delegate.h
index a3d75c6..1862006 100644
--- a/chrome/browser/renderer_host/render_view_host_delegate.h
+++ b/chrome/browser/renderer_host/render_view_host_delegate.h
@@ -528,7 +528,7 @@ class RenderViewHostDelegate {
// Return a dummy RendererPreferences object that will be used by the renderer
// associated with the owning RenderViewHost.
- virtual RendererPreferences GetRendererPrefs() const = 0;
+ virtual RendererPreferences GetRendererPrefs(Profile* profile) const = 0;
// Returns a WebPreferences object that will be used by the renderer
// associated with the owning render view host.
diff --git a/chrome/browser/renderer_preferences_util.cc b/chrome/browser/renderer_preferences_util.cc
new file mode 100644
index 0000000..d3ef9a4
--- /dev/null
+++ b/chrome/browser/renderer_preferences_util.cc
@@ -0,0 +1,30 @@
+// 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 "chrome/browser/renderer_preferences_util.h"
+
+#include "base/singleton.h"
+#include "chrome/browser/profile.h"
+
+#if defined(OS_LINUX)
+#include "chrome/browser/gtk/gtk_theme_provider.h"
+#include "chrome/common/gtk_util.h"
+#endif
+
+namespace renderer_preferences_util {
+
+RendererPreferences GetInitedRendererPreferences(Profile* profile) {
+ RendererPreferences* prefs = Singleton<RendererPreferences>::get();
+#if defined(OS_LINUX)
+ static bool inited = false;
+ if (!inited) {
+ gtk_util::InitRendererPrefsFromGtkSettings(prefs,
+ GtkThemeProvider::GetFrom(profile)->UseGtkTheme());
+ inited = true;
+ }
+#endif
+ return *prefs;
+}
+
+} // renderer_preferences_util
diff --git a/chrome/browser/renderer_preferences_util.h b/chrome/browser/renderer_preferences_util.h
new file mode 100644
index 0000000..0a36c9d
--- /dev/null
+++ b/chrome/browser/renderer_preferences_util.h
@@ -0,0 +1,18 @@
+// 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.
+
+#ifndef CHROME_BROWSER_RENDERER_PREFERENCES_UTIL_H_
+#define CHROME_BROWSER_RENDERER_PREFERENCES_UTIL_H_
+
+#include "chrome/common/renderer_preferences.h"
+
+class Profile;
+
+namespace renderer_preferences_util {
+
+RendererPreferences GetInitedRendererPreferences(Profile* profile);
+
+} // namespace renderer_preferences_util
+
+#endif // CHROME_BROWSER_RENDERER_PREFERENCES_UTIL_H_
diff --git a/chrome/browser/tab_contents/interstitial_page.cc b/chrome/browser/tab_contents/interstitial_page.cc
index aae90da..1af79b6 100644
--- a/chrome/browser/tab_contents/interstitial_page.cc
+++ b/chrome/browser/tab_contents/interstitial_page.cc
@@ -23,6 +23,7 @@
#include "chrome/browser/tab_contents/tab_contents_view.h"
#include "chrome/common/bindings_policy.h"
#if defined(TOOLKIT_GTK)
+#include "chrome/browser/gtk/gtk_theme_provider.h"
#include "chrome/common/gtk_util.h"
#endif
#include "chrome/common/notification_service.h"
@@ -143,7 +144,8 @@ InterstitialPage::InterstitialPage(TabContents* tab,
DCHECK(new_navigation || !tab->controller().pending_entry());
#if defined(TOOLKIT_GTK)
- gtk_util::InitRendererPrefsFromGtkSettings(&renderer_preferences_);
+ gtk_util::InitRendererPrefsFromGtkSettings(&renderer_preferences_,
+ GtkThemeProvider::GetFrom(tab->profile())->UseGtkTheme());
#endif
}
diff --git a/chrome/browser/tab_contents/interstitial_page.h b/chrome/browser/tab_contents/interstitial_page.h
index aff6a74..0312131 100644
--- a/chrome/browser/tab_contents/interstitial_page.h
+++ b/chrome/browser/tab_contents/interstitial_page.h
@@ -107,7 +107,7 @@ class InterstitialPage : public NotificationObserver,
const std::wstring& title);
virtual void DomOperationResponse(const std::string& json_string,
int automation_id);
- virtual RendererPreferences GetRendererPrefs() const {
+ virtual RendererPreferences GetRendererPrefs(Profile* profile) const {
return renderer_preferences_;
}
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index 964bff1..30b393d 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -45,6 +45,7 @@
#include "chrome/browser/renderer_host/resource_request_details.h"
#include "chrome/browser/renderer_host/site_instance.h"
#include "chrome/browser/renderer_host/web_cache_manager.h"
+#include "chrome/browser/renderer_preferences_util.h"
#include "chrome/browser/tab_contents/infobar_delegate.h"
#include "chrome/browser/tab_contents/interstitial_page.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
@@ -259,7 +260,8 @@ TabContents::TabContents(Profile* profile,
last_javascript_message_dismissal_(),
suppress_javascript_messages_(false),
is_showing_before_unload_dialog_(false),
- renderer_preferences_(platform_util::GetInitedRendererPreferences()),
+ renderer_preferences_(
+ renderer_preferences_util::GetInitedRendererPreferences(profile)),
opener_dom_ui_type_(DOMUIFactory::kNoDOMUI) {
#if defined(OS_CHROMEOS)
// Make sure the thumbnailer is started before starting the render manager.
@@ -1882,7 +1884,7 @@ RenderViewHostDelegate::AutoFill* TabContents::GetAutoFillDelegate() {
return autofill_manager_.get();
}
-RendererPreferences TabContents::GetRendererPrefs() const {
+RendererPreferences TabContents::GetRendererPrefs(Profile* profile) const {
return renderer_preferences_;
}
diff --git a/chrome/browser/tab_contents/tab_contents.h b/chrome/browser/tab_contents/tab_contents.h
index 072e430..18f0d44 100644
--- a/chrome/browser/tab_contents/tab_contents.h
+++ b/chrome/browser/tab_contents/tab_contents.h
@@ -903,7 +903,7 @@ class TabContents : public PageNavigator,
virtual void PageHasOSDD(RenderViewHost* render_view_host,
int32 page_id, const GURL& url, bool autodetected);
virtual GURL GetAlternateErrorPageURL() const;
- virtual RendererPreferences GetRendererPrefs() const;
+ virtual RendererPreferences GetRendererPrefs(Profile* profile) const;
virtual WebPreferences GetWebkitPrefs();
virtual void OnJSOutOfMemory();
virtual void OnCrossSiteResponse(int new_render_process_host_id,
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 805bbfe..c098c5b 100755
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -1330,6 +1330,8 @@
'browser/renderer_host/web_cache_manager.h',
'browser/renderer_host/x509_user_cert_resource_handler.cc',
'browser/renderer_host/x509_user_cert_resource_handler.h',
+ 'browser/renderer_preferences_util.cc',
+ 'browser/renderer_preferences_util.h',
'browser/rlz/rlz.cc',
'browser/rlz/rlz.h',
'browser/safe_browsing/bloom_filter.cc',
diff --git a/chrome/common/gtk_util.cc b/chrome/common/gtk_util.cc
index c6c08e4..5c9f870 100644
--- a/chrome/common/gtk_util.cc
+++ b/chrome/common/gtk_util.cc
@@ -13,6 +13,7 @@
#include "app/resource_bundle.h"
#include "base/linux_util.h"
#include "base/logging.h"
+#include "chrome/browser/gtk/gtk_theme_provider.h"
#include "chrome/common/renderer_preferences.h"
#include "grit/theme_resources.h"
#include "third_party/skia/include/core/SkBitmap.h"
@@ -418,7 +419,8 @@ GtkWidget* IndentWidget(GtkWidget* content) {
return content_alignment;
}
-void InitRendererPrefsFromGtkSettings(RendererPreferences* prefs) {
+void InitRendererPrefsFromGtkSettings(RendererPreferences* prefs,
+ bool use_gtk_theme) {
DCHECK(prefs);
gint antialias = 0;
@@ -475,6 +477,24 @@ void InitRendererPrefsFromGtkSettings(RendererPreferences* prefs) {
prefs->focus_ring_color =
SkColorSetRGB(color.red / 257, color.green / 257, color.blue / 257);
+ GdkColor thumb_active_color, thumb_inactive_color, track_color;
+ GtkThemeProvider::GetScrollbarColors(&thumb_active_color,
+ &thumb_inactive_color,
+ &track_color,
+ use_gtk_theme);
+ prefs->thumb_active_color =
+ SkColorSetRGB(thumb_active_color.red / 257,
+ thumb_active_color.green / 257,
+ thumb_active_color.blue / 257);
+ prefs->thumb_inactive_color =
+ SkColorSetRGB(thumb_inactive_color.red / 257,
+ thumb_inactive_color.green / 257,
+ thumb_inactive_color.blue / 257);
+ prefs->track_color =
+ SkColorSetRGB(track_color.red / 257,
+ track_color.green / 257,
+ track_color.blue / 257);
+
if (hint_style)
g_free(hint_style);
if (rgba_style)
diff --git a/chrome/common/gtk_util.h b/chrome/common/gtk_util.h
index 7c10ce3..087ed72 100644
--- a/chrome/common/gtk_util.h
+++ b/chrome/common/gtk_util.h
@@ -158,7 +158,8 @@ GtkWidget* IndentWidget(GtkWidget* content);
// Initialize the font settings in |prefs| (used when creating new renderers)
// based on GtkSettings (which itself comes from XSETTINGS).
-void InitRendererPrefsFromGtkSettings(RendererPreferences* prefs);
+void InitRendererPrefsFromGtkSettings(RendererPreferences* prefs,
+ bool use_gtk_theme);
// Get the current location of the mouse cursor relative to the screen.
gfx::Point ScreenPoint(GtkWidget* widget);
diff --git a/chrome/common/platform_util.h b/chrome/common/platform_util.h
index fbe1ba6..0a042f2 100644
--- a/chrome/common/platform_util.h
+++ b/chrome/common/platform_util.h
@@ -7,7 +7,6 @@
#include "app/gfx/native_widget_types.h"
#include "base/string16.h"
-#include "chrome/common/renderer_preferences.h"
class FilePath;
class GURL;
@@ -45,8 +44,6 @@ void SimpleErrorBox(gfx::NativeWindow parent,
const string16& title,
const string16& message);
-RendererPreferences GetInitedRendererPreferences();
-
}
#endif // CHROME_COMMON_PLATFORM_UTIL_H_
diff --git a/chrome/common/platform_util_linux.cc b/chrome/common/platform_util_linux.cc
index 021d6a1..b7853c5 100644
--- a/chrome/common/platform_util_linux.cc
+++ b/chrome/common/platform_util_linux.cc
@@ -8,8 +8,8 @@
#include "base/file_util.h"
#include "base/process_util.h"
-#include "base/singleton.h"
#include "base/string_util.h"
+#include "chrome/browser/gtk/gtk_theme_provider.h"
#include "chrome/common/gtk_util.h"
#include "chrome/common/process_watcher.h"
#include "googleurl/src/gurl.h"
@@ -88,14 +88,4 @@ void SimpleErrorBox(gfx::NativeWindow parent,
gtk_widget_show_all(dialog);
}
-RendererPreferences GetInitedRendererPreferences() {
- RendererPreferences* prefs = Singleton<RendererPreferences>::get();
- static bool inited = false;
- if (!inited) {
- gtk_util::InitRendererPrefsFromGtkSettings(prefs);
- inited = true;
- }
- return *prefs;
-}
-
} // namespace platform_util
diff --git a/chrome/common/platform_util_mac.mm b/chrome/common/platform_util_mac.mm
index db474a2..2c9883a 100644
--- a/chrome/common/platform_util_mac.mm
+++ b/chrome/common/platform_util_mac.mm
@@ -84,8 +84,4 @@ void SimpleErrorBox(gfx::NativeWindow parent,
[alert runModal];
}
-RendererPreferences GetInitedRendererPreferences() {
- return RendererPreferences();
-}
-
} // namespace platform_util
diff --git a/chrome/common/platform_util_win.cc b/chrome/common/platform_util_win.cc
index 6ddd47c..1b1b666 100644
--- a/chrome/common/platform_util_win.cc
+++ b/chrome/common/platform_util_win.cc
@@ -157,8 +157,4 @@ void SimpleErrorBox(gfx::NativeWindow parent,
win_util::MessageBox(parent, message, title, MB_OK | MB_SETFOREGROUND);
}
-RendererPreferences GetInitedRendererPreferences() {
- return RendererPreferences();
-}
-
} // namespace platform_util
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index e91a2fe..fce1dfe 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -1559,6 +1559,9 @@ struct ParamTraits<RendererPreferences> {
WriteParam(m, static_cast<int>(p.hinting));
WriteParam(m, static_cast<int>(p.subpixel_rendering));
WriteParam(m, p.focus_ring_color);
+ WriteParam(m, p.thumb_active_color);
+ WriteParam(m, p.thumb_inactive_color);
+ WriteParam(m, p.track_color);
WriteParam(m, p.browser_handles_top_level_requests);
}
static bool Read(const Message* m, void** iter, param_type* p) {
@@ -1584,6 +1587,15 @@ struct ParamTraits<RendererPreferences> {
return false;
p->focus_ring_color = focus_ring_color;
+ int thumb_active_color, thumb_inactive_color, track_color;
+ if (!ReadParam(m, iter, &thumb_active_color) ||
+ !ReadParam(m, iter, &thumb_inactive_color) ||
+ !ReadParam(m, iter, &track_color))
+ return false;
+ p->thumb_active_color = thumb_active_color;
+ p->thumb_inactive_color = thumb_inactive_color;
+ p->track_color = track_color;
+
if (!ReadParam(m, iter, &p->browser_handles_top_level_requests))
return false;
diff --git a/chrome/common/renderer_preferences.h b/chrome/common/renderer_preferences.h
index b08548e..a982d57 100644
--- a/chrome/common/renderer_preferences.h
+++ b/chrome/common/renderer_preferences.h
@@ -51,6 +51,12 @@ struct RendererPreferences {
// The color of the focus ring. Currently only used on Linux.
SkColor focus_ring_color;
+ // The color of different parts of the scrollbar. Currently only used on
+ // Linux.
+ SkColor thumb_active_color;
+ SkColor thumb_inactive_color;
+ SkColor track_color;
+
// Browser wants a look at all top level requests
bool browser_handles_top_level_requests;
@@ -61,6 +67,9 @@ struct RendererPreferences {
subpixel_rendering(
RENDERER_PREFERENCES_SUBPIXEL_RENDERING_SYSTEM_DEFAULT),
focus_ring_color(0),
+ thumb_active_color(0),
+ thumb_inactive_color(0),
+ track_color(0),
browser_handles_top_level_requests(false) {
}
};
diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc
index 4718a5c..bbd4344 100644
--- a/chrome/renderer/render_view.cc
+++ b/chrome/renderer/render_view.cc
@@ -3216,6 +3216,12 @@ void RenderView::OnSetRendererPrefs(const RendererPreferences& renderer_prefs) {
#if defined(OS_LINUX) && !defined(TOOLKIT_VIEWS)
WebColorName name = WebKit::WebColorWebkitFocusRingColor;
WebKit::setNamedColors(&name, &renderer_prefs.focus_ring_color, 1);
+
+ if (webview())
+ webview()->setScrollbarColors(
+ renderer_prefs.thumb_inactive_color,
+ renderer_prefs.thumb_active_color,
+ renderer_prefs.track_color);
#endif
}