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/chrome_content_browser_client.h" | 5 #include "chrome/browser/chrome_content_browser_client.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 2251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2262 web_prefs->default_encoding = prefs->GetString(prefs::kDefaultCharset); | 2262 web_prefs->default_encoding = prefs->GetString(prefs::kDefaultCharset); |
2263 | 2263 |
2264 web_prefs->javascript_can_open_windows_automatically = | 2264 web_prefs->javascript_can_open_windows_automatically = |
2265 prefs->GetBoolean(prefs::kWebKitJavascriptCanOpenWindowsAutomatically); | 2265 prefs->GetBoolean(prefs::kWebKitJavascriptCanOpenWindowsAutomatically); |
2266 web_prefs->dom_paste_enabled = | 2266 web_prefs->dom_paste_enabled = |
2267 prefs->GetBoolean(prefs::kWebKitDomPasteEnabled); | 2267 prefs->GetBoolean(prefs::kWebKitDomPasteEnabled); |
2268 web_prefs->tabs_to_links = prefs->GetBoolean(prefs::kWebkitTabsToLinks); | 2268 web_prefs->tabs_to_links = prefs->GetBoolean(prefs::kWebkitTabsToLinks); |
2269 | 2269 |
2270 if (!prefs->GetBoolean(prefs::kWebKitJavascriptEnabled)) | 2270 if (!prefs->GetBoolean(prefs::kWebKitJavascriptEnabled)) |
2271 web_prefs->javascript_enabled = false; | 2271 web_prefs->javascript_enabled = false; |
2272 if (!prefs->GetBoolean(prefs::kWebKitWebSecurityEnabled)) | 2272 |
| 2273 // Only allow disabling web security via the command-line flag if the user |
| 2274 // has specified a distinct profile directory. This still enables tests to |
| 2275 // disable web security by setting the pref directly. |
| 2276 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 2277 if (!prefs->GetBoolean(prefs::kWebKitWebSecurityEnabled)) { |
2273 web_prefs->web_security_enabled = false; | 2278 web_prefs->web_security_enabled = false; |
| 2279 } else if (!web_prefs->web_security_enabled && |
| 2280 command_line->HasSwitch(switches::kDisableWebSecurity) && |
| 2281 !command_line->HasSwitch(switches::kUserDataDir)) { |
| 2282 LOG(ERROR) << "Web security may only be disabled if '--user-data-dir' is " |
| 2283 "also specified."; |
| 2284 web_prefs->web_security_enabled = true; |
| 2285 } |
| 2286 |
2274 if (!prefs->GetBoolean(prefs::kWebKitPluginsEnabled)) | 2287 if (!prefs->GetBoolean(prefs::kWebKitPluginsEnabled)) |
2275 web_prefs->plugins_enabled = false; | 2288 web_prefs->plugins_enabled = false; |
2276 web_prefs->loads_images_automatically = | 2289 web_prefs->loads_images_automatically = |
2277 prefs->GetBoolean(prefs::kWebKitLoadsImagesAutomatically); | 2290 prefs->GetBoolean(prefs::kWebKitLoadsImagesAutomatically); |
2278 | 2291 |
2279 if (prefs->GetBoolean(prefs::kDisable3DAPIs)) | 2292 if (prefs->GetBoolean(prefs::kDisable3DAPIs)) |
2280 web_prefs->experimental_webgl_enabled = false; | 2293 web_prefs->experimental_webgl_enabled = false; |
2281 | 2294 |
2282 web_prefs->allow_displaying_insecure_content = | 2295 web_prefs->allow_displaying_insecure_content = |
2283 prefs->GetBoolean(prefs::kWebKitAllowDisplayingInsecureContent); | 2296 prefs->GetBoolean(prefs::kWebKitAllowDisplayingInsecureContent); |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2798 if (channel <= kMaxDisableEncryptionChannel) { | 2811 if (channel <= kMaxDisableEncryptionChannel) { |
2799 static const char* const kWebRtcDevSwitchNames[] = { | 2812 static const char* const kWebRtcDevSwitchNames[] = { |
2800 switches::kDisableWebRtcEncryption, | 2813 switches::kDisableWebRtcEncryption, |
2801 }; | 2814 }; |
2802 to_command_line->CopySwitchesFrom(from_command_line, | 2815 to_command_line->CopySwitchesFrom(from_command_line, |
2803 kWebRtcDevSwitchNames, | 2816 kWebRtcDevSwitchNames, |
2804 arraysize(kWebRtcDevSwitchNames)); | 2817 arraysize(kWebRtcDevSwitchNames)); |
2805 } | 2818 } |
2806 } | 2819 } |
2807 #endif // defined(ENABLE_WEBRTC) | 2820 #endif // defined(ENABLE_WEBRTC) |
OLD | NEW |