| 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 "media/media_features.h" |
| 19 #include "third_party/WebKit/public/public_features.h" | 20 #include "third_party/WebKit/public/public_features.h" |
| 20 #include "third_party/skia/include/core/SkColor.h" | 21 #include "third_party/skia/include/core/SkColor.h" |
| 21 | 22 |
| 22 #if defined(OS_LINUX) || defined(OS_ANDROID) | 23 #if defined(OS_LINUX) || defined(OS_ANDROID) |
| 23 #include "ui/gfx/font_render_params.h" | 24 #include "ui/gfx/font_render_params.h" |
| 24 #endif | 25 #endif |
| 25 | 26 |
| 26 #if defined(TOOLKIT_VIEWS) | 27 #if defined(TOOLKIT_VIEWS) |
| 27 #include "ui/views/controls/textfield/textfield.h" | 28 #include "ui/views/controls/textfield/textfield.h" |
| 28 #endif | 29 #endif |
| 29 | 30 |
| 30 #if defined(OS_MACOSX) | 31 #if defined(OS_MACOSX) |
| 31 #include "ui/base/cocoa/defaults_utils.h" | 32 #include "ui/base/cocoa/defaults_utils.h" |
| 32 #endif | 33 #endif |
| 33 | 34 |
| 34 #if defined(USE_AURA) && defined(OS_LINUX) && !defined(OS_CHROMEOS) | 35 #if defined(USE_AURA) && defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 35 #include "chrome/browser/themes/theme_service.h" | 36 #include "chrome/browser/themes/theme_service.h" |
| 36 #include "chrome/browser/themes/theme_service_factory.h" | 37 #include "chrome/browser/themes/theme_service_factory.h" |
| 37 #include "ui/views/linux_ui/linux_ui.h" | 38 #include "ui/views/linux_ui/linux_ui.h" |
| 38 #endif | 39 #endif |
| 39 | 40 |
| 40 #if defined(ENABLE_WEBRTC) | 41 #if BUILDFLAG(ENABLE_WEBRTC) |
| 41 namespace { | 42 namespace { |
| 42 | 43 |
| 43 // Parses a string |range| with a port range in the form "<min>-<max>". | 44 // Parses a string |range| with a port range in the form "<min>-<max>". |
| 44 // If |range| is not in the correct format or contains an invalid range, zero | 45 // If |range| is not in the correct format or contains an invalid range, zero |
| 45 // is written to |min_port| and |max_port|. | 46 // is written to |min_port| and |max_port|. |
| 46 // TODO(guidou): Consider replacing with remoting/protocol/port_range.cc | 47 // TODO(guidou): Consider replacing with remoting/protocol/port_range.cc |
| 47 void ParsePortRange(const std::string& range, | 48 void ParsePortRange(const std::string& range, |
| 48 uint16_t* min_port, | 49 uint16_t* min_port, |
| 49 uint16_t* max_port) { | 50 uint16_t* max_port) { |
| 50 *min_port = 0; | 51 *min_port = 0; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 namespace renderer_preferences_util { | 83 namespace renderer_preferences_util { |
| 83 | 84 |
| 84 void UpdateFromSystemSettings(content::RendererPreferences* prefs, | 85 void UpdateFromSystemSettings(content::RendererPreferences* prefs, |
| 85 Profile* profile, | 86 Profile* profile, |
| 86 content::WebContents* web_contents) { | 87 content::WebContents* web_contents) { |
| 87 const PrefService* pref_service = profile->GetPrefs(); | 88 const PrefService* pref_service = profile->GetPrefs(); |
| 88 prefs->accept_languages = pref_service->GetString(prefs::kAcceptLanguages); | 89 prefs->accept_languages = pref_service->GetString(prefs::kAcceptLanguages); |
| 89 prefs->enable_referrers = pref_service->GetBoolean(prefs::kEnableReferrers); | 90 prefs->enable_referrers = pref_service->GetBoolean(prefs::kEnableReferrers); |
| 90 prefs->enable_do_not_track = | 91 prefs->enable_do_not_track = |
| 91 pref_service->GetBoolean(prefs::kEnableDoNotTrack); | 92 pref_service->GetBoolean(prefs::kEnableDoNotTrack); |
| 92 #if defined(ENABLE_WEBRTC) | 93 #if BUILDFLAG(ENABLE_WEBRTC) |
| 93 prefs->webrtc_ip_handling_policy = std::string(); | 94 prefs->webrtc_ip_handling_policy = std::string(); |
| 94 // Handling the backward compatibility of previous boolean verions of policy | 95 // Handling the backward compatibility of previous boolean verions of policy |
| 95 // controls. | 96 // controls. |
| 96 if (!pref_service->HasPrefPath(prefs::kWebRTCIPHandlingPolicy)) { | 97 if (!pref_service->HasPrefPath(prefs::kWebRTCIPHandlingPolicy)) { |
| 97 if (!pref_service->GetBoolean(prefs::kWebRTCNonProxiedUdpEnabled)) { | 98 if (!pref_service->GetBoolean(prefs::kWebRTCNonProxiedUdpEnabled)) { |
| 98 prefs->webrtc_ip_handling_policy = | 99 prefs->webrtc_ip_handling_policy = |
| 99 content::kWebRTCIPHandlingDisableNonProxiedUdp; | 100 content::kWebRTCIPHandlingDisableNonProxiedUdp; |
| 100 } else if (!pref_service->GetBoolean(prefs::kWebRTCMultipleRoutesEnabled)) { | 101 } else if (!pref_service->GetBoolean(prefs::kWebRTCMultipleRoutesEnabled)) { |
| 101 prefs->webrtc_ip_handling_policy = | 102 prefs->webrtc_ip_handling_policy = |
| 102 content::kWebRTCIPHandlingDefaultPublicInterfaceOnly; | 103 content::kWebRTCIPHandlingDefaultPublicInterfaceOnly; |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 prefs->subpixel_rendering = params.subpixel_rendering; | 167 prefs->subpixel_rendering = params.subpixel_rendering; |
| 167 #endif | 168 #endif |
| 168 | 169 |
| 169 #if !defined(OS_MACOSX) | 170 #if !defined(OS_MACOSX) |
| 170 prefs->plugin_fullscreen_allowed = | 171 prefs->plugin_fullscreen_allowed = |
| 171 pref_service->GetBoolean(prefs::kFullscreenAllowed); | 172 pref_service->GetBoolean(prefs::kFullscreenAllowed); |
| 172 #endif | 173 #endif |
| 173 } | 174 } |
| 174 | 175 |
| 175 } // namespace renderer_preferences_util | 176 } // namespace renderer_preferences_util |
| OLD | NEW |