Chromium Code Reviews| 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" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 77 | 77 |
| 78 void UpdateFromSystemSettings( | 78 void UpdateFromSystemSettings( |
| 79 content::RendererPreferences* prefs, Profile* profile) { | 79 content::RendererPreferences* prefs, Profile* profile) { |
| 80 const PrefService* pref_service = profile->GetPrefs(); | 80 const PrefService* pref_service = profile->GetPrefs(); |
| 81 prefs->accept_languages = pref_service->GetString(prefs::kAcceptLanguages); | 81 prefs->accept_languages = pref_service->GetString(prefs::kAcceptLanguages); |
| 82 prefs->enable_referrers = pref_service->GetBoolean(prefs::kEnableReferrers); | 82 prefs->enable_referrers = pref_service->GetBoolean(prefs::kEnableReferrers); |
| 83 prefs->enable_do_not_track = | 83 prefs->enable_do_not_track = |
| 84 pref_service->GetBoolean(prefs::kEnableDoNotTrack); | 84 pref_service->GetBoolean(prefs::kEnableDoNotTrack); |
| 85 prefs->default_zoom_level = pref_service->GetDouble(prefs::kDefaultZoomLevel); | 85 prefs->default_zoom_level = pref_service->GetDouble(prefs::kDefaultZoomLevel); |
| 86 | 86 |
| 87 prefs->deprecated_features_to_enable.clear(); | |
| 88 prefs->deprecated_features_to_enable.resize( | |
| 89 content::RENDERER_PREFERENCES_DEPRECATED_FEATURE_COUNT, false); | |
| 90 const base::ListValue* deprecated_features_list = | |
| 91 pref_service->GetList(prefs::kEnableDeprecatedWebPlatformFeatures); | |
| 92 for (base::ListValue::const_iterator feature( | |
| 93 deprecated_features_list->begin()); | |
| 94 feature != deprecated_features_list->end(); | |
| 95 ++feature) { | |
| 96 int value = -1; | |
| 97 if ((*feature)->GetAsInteger(&value) && value >= 0 && | |
| 98 value < content::RENDERER_PREFERENCES_DEPRECATED_FEATURE_COUNT) { | |
|
Andrew T Wilson (Slow)
2014/05/08 11:32:45
Hmmm. Should the bounds check be a DCHECK instead?
Mattias Nissler (ping if slow)
2014/05/09 16:38:27
Well, pref values are not guaranteed to be totally
| |
| 99 prefs->deprecated_features_to_enable[value] = true; | |
| 100 } | |
| 101 } | |
| 102 | |
| 87 #if defined(TOOLKIT_GTK) | 103 #if defined(TOOLKIT_GTK) |
| 88 GtkThemeService* theme_service = GtkThemeService::GetFrom(profile); | 104 GtkThemeService* theme_service = GtkThemeService::GetFrom(profile); |
| 89 prefs->focus_ring_color = theme_service->get_focus_ring_color(); | 105 prefs->focus_ring_color = theme_service->get_focus_ring_color(); |
| 90 prefs->thumb_active_color = theme_service->get_thumb_active_color(); | 106 prefs->thumb_active_color = theme_service->get_thumb_active_color(); |
| 91 prefs->thumb_inactive_color = theme_service->get_thumb_inactive_color(); | 107 prefs->thumb_inactive_color = theme_service->get_thumb_inactive_color(); |
| 92 prefs->track_color = theme_service->get_track_color(); | 108 prefs->track_color = theme_service->get_track_color(); |
| 93 prefs->active_selection_bg_color = | 109 prefs->active_selection_bg_color = |
| 94 theme_service->get_active_selection_bg_color(); | 110 theme_service->get_active_selection_bg_color(); |
| 95 prefs->active_selection_fg_color = | 111 prefs->active_selection_fg_color = |
| 96 theme_service->get_active_selection_fg_color(); | 112 theme_service->get_active_selection_fg_color(); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 170 GetRendererPreferencesSubpixelRenderingEnum(params.subpixel_rendering); | 186 GetRendererPreferencesSubpixelRenderingEnum(params.subpixel_rendering); |
| 171 #endif | 187 #endif |
| 172 | 188 |
| 173 #if !defined(OS_MACOSX) | 189 #if !defined(OS_MACOSX) |
| 174 prefs->plugin_fullscreen_allowed = | 190 prefs->plugin_fullscreen_allowed = |
| 175 pref_service->GetBoolean(prefs::kFullscreenAllowed); | 191 pref_service->GetBoolean(prefs::kFullscreenAllowed); |
| 176 #endif | 192 #endif |
| 177 } | 193 } |
| 178 | 194 |
| 179 } // namespace renderer_preferences_util | 195 } // namespace renderer_preferences_util |
| OLD | NEW |