OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/renderer_preferences_util.h" | 5 #include "chrome/browser/renderer_preferences_util.h" |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/common/pref_names.h" | 9 #include "chrome/common/pref_names.h" |
10 #include "content/public/common/renderer_preferences.h" | 10 #include "content/public/common/renderer_preferences.h" |
11 #include "third_party/skia/include/core/SkColor.h" | 11 #include "third_party/skia/include/core/SkColor.h" |
12 | 12 |
13 #if defined(OS_LINUX) || defined(OS_ANDROID) | 13 #if defined(OS_LINUX) || defined(OS_ANDROID) |
14 #include "ui/gfx/font_render_params_linux.h" | 14 #include "ui/gfx/font_render_params_linux.h" |
15 #endif | 15 #endif |
16 | 16 |
17 #if defined(TOOLKIT_GTK) | |
18 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | |
19 #include "ui/gfx/gtk_util.h" | |
20 #endif | |
21 | |
22 #if defined(TOOLKIT_VIEWS) | 17 #if defined(TOOLKIT_VIEWS) |
23 #include "ui/views/controls/textfield/textfield.h" | 18 #include "ui/views/controls/textfield/textfield.h" |
24 #endif | 19 #endif |
25 | 20 |
26 #if defined(USE_AURA) && defined(OS_LINUX) && !defined(OS_CHROMEOS) | 21 #if defined(USE_AURA) && defined(OS_LINUX) && !defined(OS_CHROMEOS) |
27 #include "chrome/browser/themes/theme_service.h" | 22 #include "chrome/browser/themes/theme_service.h" |
28 #include "chrome/browser/themes/theme_service_factory.h" | 23 #include "chrome/browser/themes/theme_service_factory.h" |
29 #include "ui/views/linux_ui/linux_ui.h" | 24 #include "ui/views/linux_ui/linux_ui.h" |
30 #endif | 25 #endif |
31 | 26 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 72 |
78 void UpdateFromSystemSettings( | 73 void UpdateFromSystemSettings( |
79 content::RendererPreferences* prefs, Profile* profile) { | 74 content::RendererPreferences* prefs, Profile* profile) { |
80 const PrefService* pref_service = profile->GetPrefs(); | 75 const PrefService* pref_service = profile->GetPrefs(); |
81 prefs->accept_languages = pref_service->GetString(prefs::kAcceptLanguages); | 76 prefs->accept_languages = pref_service->GetString(prefs::kAcceptLanguages); |
82 prefs->enable_referrers = pref_service->GetBoolean(prefs::kEnableReferrers); | 77 prefs->enable_referrers = pref_service->GetBoolean(prefs::kEnableReferrers); |
83 prefs->enable_do_not_track = | 78 prefs->enable_do_not_track = |
84 pref_service->GetBoolean(prefs::kEnableDoNotTrack); | 79 pref_service->GetBoolean(prefs::kEnableDoNotTrack); |
85 prefs->default_zoom_level = pref_service->GetDouble(prefs::kDefaultZoomLevel); | 80 prefs->default_zoom_level = pref_service->GetDouble(prefs::kDefaultZoomLevel); |
86 | 81 |
87 #if defined(TOOLKIT_GTK) | 82 #if defined(USE_DEFAULT_RENDER_THEME) |
88 GtkThemeService* theme_service = GtkThemeService::GetFrom(profile); | |
89 prefs->focus_ring_color = theme_service->get_focus_ring_color(); | |
90 prefs->thumb_active_color = theme_service->get_thumb_active_color(); | |
91 prefs->thumb_inactive_color = theme_service->get_thumb_inactive_color(); | |
92 prefs->track_color = theme_service->get_track_color(); | |
93 prefs->active_selection_bg_color = | |
94 theme_service->get_active_selection_bg_color(); | |
95 prefs->active_selection_fg_color = | |
96 theme_service->get_active_selection_fg_color(); | |
97 prefs->inactive_selection_bg_color = | |
98 theme_service->get_inactive_selection_bg_color(); | |
99 prefs->inactive_selection_fg_color = | |
100 theme_service->get_inactive_selection_fg_color(); | |
101 | |
102 // Dividing GTK's cursor blink cycle time (in milliseconds) by this value | |
103 // yields an appropriate value for RendererPreferences::caret_blink_interval. | |
104 // This matches the logic in the WebKit GTK port. | |
105 const double kGtkCursorBlinkCycleFactor = 2000.0; | |
106 const base::TimeDelta cursor_blink_time = gfx::GetCursorBlinkCycle(); | |
107 prefs->caret_blink_interval = | |
108 cursor_blink_time.InMilliseconds() ? | |
109 cursor_blink_time.InMilliseconds() / kGtkCursorBlinkCycleFactor : | |
110 0; | |
111 #elif defined(USE_DEFAULT_RENDER_THEME) | |
112 prefs->focus_ring_color = SkColorSetRGB(0x4D, 0x90, 0xFE); | 83 prefs->focus_ring_color = SkColorSetRGB(0x4D, 0x90, 0xFE); |
113 | 84 |
114 #if defined(OS_CHROMEOS) | 85 #if defined(OS_CHROMEOS) |
115 // This color is 0x544d90fe modulated with 0xffffff. | 86 // This color is 0x544d90fe modulated with 0xffffff. |
116 prefs->active_selection_bg_color = SkColorSetRGB(0xCB, 0xE4, 0xFA); | 87 prefs->active_selection_bg_color = SkColorSetRGB(0xCB, 0xE4, 0xFA); |
117 prefs->active_selection_fg_color = SK_ColorBLACK; | 88 prefs->active_selection_fg_color = SK_ColorBLACK; |
118 prefs->inactive_selection_bg_color = SkColorSetRGB(0xEA, 0xEA, 0xEA); | 89 prefs->inactive_selection_bg_color = SkColorSetRGB(0xEA, 0xEA, 0xEA); |
119 prefs->inactive_selection_fg_color = SK_ColorBLACK; | 90 prefs->inactive_selection_fg_color = SK_ColorBLACK; |
120 #endif | 91 #endif |
121 | 92 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 GetRendererPreferencesSubpixelRenderingEnum(params.subpixel_rendering); | 141 GetRendererPreferencesSubpixelRenderingEnum(params.subpixel_rendering); |
171 #endif | 142 #endif |
172 | 143 |
173 #if !defined(OS_MACOSX) | 144 #if !defined(OS_MACOSX) |
174 prefs->plugin_fullscreen_allowed = | 145 prefs->plugin_fullscreen_allowed = |
175 pref_service->GetBoolean(prefs::kFullscreenAllowed); | 146 pref_service->GetBoolean(prefs::kFullscreenAllowed); |
176 #endif | 147 #endif |
177 } | 148 } |
178 | 149 |
179 } // namespace renderer_preferences_util | 150 } // namespace renderer_preferences_util |
OLD | NEW |