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 "chrome/browser/prefs/pref_service.h" | 7 #include "chrome/browser/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 | 12 |
12 #if defined(OS_LINUX) || defined(OS_ANDROID) | 13 #if defined(OS_LINUX) || defined(OS_ANDROID) |
13 #include "ui/gfx/font_render_params_linux.h" | 14 #include "ui/gfx/font_render_params_linux.h" |
14 #endif | 15 #endif |
15 | 16 |
16 #if defined(TOOLKIT_GTK) | 17 #if defined(TOOLKIT_GTK) |
17 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 18 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
18 #include "ui/gfx/gtk_util.h" | 19 #include "ui/gfx/gtk_util.h" |
19 #endif | 20 #endif |
20 | 21 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 prefs->thumb_inactive_color = theme_service->get_thumb_inactive_color(); | 91 prefs->thumb_inactive_color = theme_service->get_thumb_inactive_color(); |
91 prefs->track_color = theme_service->get_track_color(); | 92 prefs->track_color = theme_service->get_track_color(); |
92 prefs->active_selection_bg_color = | 93 prefs->active_selection_bg_color = |
93 theme_service->get_active_selection_bg_color(); | 94 theme_service->get_active_selection_bg_color(); |
94 prefs->active_selection_fg_color = | 95 prefs->active_selection_fg_color = |
95 theme_service->get_active_selection_fg_color(); | 96 theme_service->get_active_selection_fg_color(); |
96 prefs->inactive_selection_bg_color = | 97 prefs->inactive_selection_bg_color = |
97 theme_service->get_inactive_selection_bg_color(); | 98 theme_service->get_inactive_selection_bg_color(); |
98 prefs->inactive_selection_fg_color = | 99 prefs->inactive_selection_fg_color = |
99 theme_service->get_inactive_selection_fg_color(); | 100 theme_service->get_inactive_selection_fg_color(); |
| 101 |
| 102 const base::TimeDelta cursor_blink_time = gfx::GetCursorBlinkCycle(); |
| 103 prefs->caret_blink_interval = |
| 104 cursor_blink_time.InMilliseconds() ? |
| 105 cursor_blink_time.InMilliseconds() / kGtkCursorBlinkCycleFactor : |
| 106 0; |
100 #elif defined(USE_DEFAULT_RENDER_THEME) | 107 #elif defined(USE_DEFAULT_RENDER_THEME) |
| 108 prefs->focus_ring_color = SkColorSetRGB(0x4D, 0x90, 0xFE); |
| 109 |
101 // This color is 0x544d90fe modulated with 0xffffff. | 110 // This color is 0x544d90fe modulated with 0xffffff. |
102 prefs->active_selection_bg_color = SkColorSetRGB(0xCB, 0xE4, 0xFA); | 111 prefs->active_selection_bg_color = SkColorSetRGB(0xCB, 0xE4, 0xFA); |
103 prefs->active_selection_fg_color = SK_ColorBLACK; | 112 prefs->active_selection_fg_color = SK_ColorBLACK; |
104 prefs->inactive_selection_bg_color = SkColorSetRGB(0xEA, 0xEA, 0xEA); | 113 prefs->inactive_selection_bg_color = SkColorSetRGB(0xEA, 0xEA, 0xEA); |
105 prefs->inactive_selection_fg_color = SK_ColorBLACK; | 114 prefs->inactive_selection_fg_color = SK_ColorBLACK; |
106 #endif | |
107 | 115 |
108 #if defined(TOOLKIT_GTK) | |
109 const base::TimeDelta cursor_blink_time = gfx::GetCursorBlinkCycle(); | |
110 prefs->caret_blink_interval = | |
111 cursor_blink_time.InMilliseconds() ? | |
112 cursor_blink_time.InMilliseconds() / kGtkCursorBlinkCycleFactor : | |
113 0; | |
114 #elif defined(USE_AURA) | |
115 // WebKit accepts a single parameter to control the interval over which the | 116 // WebKit accepts a single parameter to control the interval over which the |
116 // cursor is shown or hidden, so divide Views's time for the full cycle by two | 117 // cursor is shown or hidden, so divide Views's time for the full cycle by two |
117 // and then convert to seconds. | 118 // and then convert to seconds. |
118 prefs->caret_blink_interval = | 119 prefs->caret_blink_interval = |
119 views::NativeTextfieldViews::kCursorBlinkCycleMs / 2.0 / 1000; | 120 views::NativeTextfieldViews::kCursorBlinkCycleMs / 2.0 / 1000; |
120 #endif | 121 #endif |
121 | 122 |
122 #if defined(OS_LINUX) || defined(OS_ANDROID) | 123 #if defined(OS_LINUX) || defined(OS_ANDROID) |
123 const gfx::FontRenderParams& params = gfx::GetDefaultWebKitFontRenderParams(); | 124 const gfx::FontRenderParams& params = gfx::GetDefaultWebKitFontRenderParams(); |
124 prefs->should_antialias_text = params.antialiasing; | 125 prefs->should_antialias_text = params.antialiasing; |
125 prefs->use_subpixel_positioning = params.subpixel_positioning; | 126 prefs->use_subpixel_positioning = params.subpixel_positioning; |
126 prefs->hinting = GetRendererPreferencesHintingEnum(params.hinting); | 127 prefs->hinting = GetRendererPreferencesHintingEnum(params.hinting); |
127 prefs->use_autohinter = params.autohinter; | 128 prefs->use_autohinter = params.autohinter; |
128 prefs->use_bitmaps = params.use_bitmaps; | 129 prefs->use_bitmaps = params.use_bitmaps; |
129 prefs->subpixel_rendering = | 130 prefs->subpixel_rendering = |
130 GetRendererPreferencesSubpixelRenderingEnum(params.subpixel_rendering); | 131 GetRendererPreferencesSubpixelRenderingEnum(params.subpixel_rendering); |
131 #endif | 132 #endif |
132 } | 133 } |
133 | 134 |
134 } // renderer_preferences_util | 135 } // renderer_preferences_util |
OLD | NEW |