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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
15 #include "components/prefs/pref_service.h" | 15 #include "components/prefs/pref_service.h" |
16 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
17 #include "content/public/common/renderer_preferences.h" | 17 #include "content/public/common/renderer_preferences.h" |
18 #include "content/public/common/webrtc_ip_handling_policy.h" | 18 #include "content/public/common/webrtc_ip_handling_policy.h" |
19 #include "third_party/skia/include/core/SkColor.h" | 19 #include "third_party/skia/include/core/SkColor.h" |
20 | 20 |
21 #if defined(OS_LINUX) || defined(OS_ANDROID) | 21 #if defined(OS_LINUX) || defined(OS_ANDROID) |
22 #include "ui/gfx/font_render_params.h" | 22 #include "ui/gfx/font_render_params.h" |
23 #endif | 23 #endif |
24 | 24 |
25 #if defined(TOOLKIT_VIEWS) | 25 #if defined(TOOLKIT_VIEWS) |
26 #include "ui/views/controls/textfield/textfield.h" | 26 #include "ui/views/controls/textfield/textfield.h" |
27 #endif | 27 #endif |
28 | 28 |
| 29 #if defined(OS_MACOSX) |
| 30 #include "ui/base/cocoa/defaults_utils.h" |
| 31 #endif |
| 32 |
29 #if defined(USE_AURA) && defined(OS_LINUX) && !defined(OS_CHROMEOS) | 33 #if defined(USE_AURA) && defined(OS_LINUX) && !defined(OS_CHROMEOS) |
30 #include "chrome/browser/themes/theme_service.h" | 34 #include "chrome/browser/themes/theme_service.h" |
31 #include "chrome/browser/themes/theme_service_factory.h" | 35 #include "chrome/browser/themes/theme_service_factory.h" |
32 #include "ui/views/linux_ui/linux_ui.h" | 36 #include "ui/views/linux_ui/linux_ui.h" |
33 #endif | 37 #endif |
34 | 38 |
35 namespace { | 39 namespace { |
36 | 40 |
37 // Parses a string |range| with a port range in the form "<min>-<max>". | 41 // Parses a string |range| with a port range in the form "<min>-<max>". |
38 // If |range| is not in the correct format or contains an invalid range, zero | 42 // If |range| is not in the correct format or contains an invalid range, zero |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 prefs->active_selection_fg_color = SK_ColorBLACK; | 117 prefs->active_selection_fg_color = SK_ColorBLACK; |
114 prefs->inactive_selection_bg_color = SkColorSetRGB(0xEA, 0xEA, 0xEA); | 118 prefs->inactive_selection_bg_color = SkColorSetRGB(0xEA, 0xEA, 0xEA); |
115 prefs->inactive_selection_fg_color = SK_ColorBLACK; | 119 prefs->inactive_selection_fg_color = SK_ColorBLACK; |
116 #endif | 120 #endif |
117 #endif | 121 #endif |
118 | 122 |
119 #if defined(TOOLKIT_VIEWS) | 123 #if defined(TOOLKIT_VIEWS) |
120 prefs->caret_blink_interval = views::Textfield::GetCaretBlinkMs() / 1000.0; | 124 prefs->caret_blink_interval = views::Textfield::GetCaretBlinkMs() / 1000.0; |
121 #endif | 125 #endif |
122 | 126 |
| 127 #if defined(OS_MACOSX) |
| 128 base::TimeDelta interval; |
| 129 if (ui::TextInsertionCaretBlinkPeriod(&interval)) |
| 130 prefs->caret_blink_interval = interval.InSecondsF(); |
| 131 #endif |
| 132 |
123 #if defined(USE_AURA) && defined(OS_LINUX) && !defined(OS_CHROMEOS) | 133 #if defined(USE_AURA) && defined(OS_LINUX) && !defined(OS_CHROMEOS) |
124 views::LinuxUI* linux_ui = views::LinuxUI::instance(); | 134 views::LinuxUI* linux_ui = views::LinuxUI::instance(); |
125 if (linux_ui) { | 135 if (linux_ui) { |
126 if (ThemeServiceFactory::GetForProfile(profile)->UsingSystemTheme()) { | 136 if (ThemeServiceFactory::GetForProfile(profile)->UsingSystemTheme()) { |
127 prefs->focus_ring_color = linux_ui->GetFocusRingColor(); | 137 prefs->focus_ring_color = linux_ui->GetFocusRingColor(); |
128 prefs->thumb_active_color = linux_ui->GetThumbActiveColor(); | 138 prefs->thumb_active_color = linux_ui->GetThumbActiveColor(); |
129 prefs->thumb_inactive_color = linux_ui->GetThumbInactiveColor(); | 139 prefs->thumb_inactive_color = linux_ui->GetThumbInactiveColor(); |
130 prefs->track_color = linux_ui->GetTrackColor(); | 140 prefs->track_color = linux_ui->GetTrackColor(); |
131 prefs->active_selection_bg_color = linux_ui->GetActiveSelectionBgColor(); | 141 prefs->active_selection_bg_color = linux_ui->GetActiveSelectionBgColor(); |
132 prefs->active_selection_fg_color = linux_ui->GetActiveSelectionFgColor(); | 142 prefs->active_selection_fg_color = linux_ui->GetActiveSelectionFgColor(); |
(...skipping 20 matching lines...) Expand all Loading... |
153 prefs->subpixel_rendering = params.subpixel_rendering; | 163 prefs->subpixel_rendering = params.subpixel_rendering; |
154 #endif | 164 #endif |
155 | 165 |
156 #if !defined(OS_MACOSX) | 166 #if !defined(OS_MACOSX) |
157 prefs->plugin_fullscreen_allowed = | 167 prefs->plugin_fullscreen_allowed = |
158 pref_service->GetBoolean(prefs::kFullscreenAllowed); | 168 pref_service->GetBoolean(prefs::kFullscreenAllowed); |
159 #endif | 169 #endif |
160 } | 170 } |
161 | 171 |
162 } // namespace renderer_preferences_util | 172 } // namespace renderer_preferences_util |
OLD | NEW |