OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/tab_contents/render_view_host_delegate_helper.h" | 5 #include "chrome/browser/tab_contents/render_view_host_delegate_helper.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "chrome/browser/browser.h" | 9 #include "chrome/browser/browser.h" |
10 #include "chrome/browser/character_encoding.h" | 10 #include "chrome/browser/character_encoding.h" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 web_prefs.local_storage_enabled = | 181 web_prefs.local_storage_enabled = |
182 !command_line.HasSwitch(switches::kDisableLocalStorage); | 182 !command_line.HasSwitch(switches::kDisableLocalStorage); |
183 web_prefs.databases_enabled = | 183 web_prefs.databases_enabled = |
184 !command_line.HasSwitch(switches::kDisableDatabases); | 184 !command_line.HasSwitch(switches::kDisableDatabases); |
185 web_prefs.experimental_webgl_enabled = | 185 web_prefs.experimental_webgl_enabled = |
186 command_line.HasSwitch(switches::kEnableExperimentalWebGL); | 186 command_line.HasSwitch(switches::kEnableExperimentalWebGL); |
187 web_prefs.site_specific_quirks_enabled = | 187 web_prefs.site_specific_quirks_enabled = |
188 !command_line.HasSwitch(switches::kDisableSiteSpecificQuirks); | 188 !command_line.HasSwitch(switches::kDisableSiteSpecificQuirks); |
189 web_prefs.geolocation_enabled = | 189 web_prefs.geolocation_enabled = |
190 command_line.HasSwitch(switches::kEnableGeolocation); | 190 command_line.HasSwitch(switches::kEnableGeolocation); |
| 191 web_prefs.allow_file_access_from_file_urls = |
| 192 command_line.HasSwitch(switches::kAllowFileAccessFromFiles); |
191 } | 193 } |
192 | 194 |
193 web_prefs.uses_universal_detector = | 195 web_prefs.uses_universal_detector = |
194 prefs->GetBoolean(prefs::kWebKitUsesUniversalDetector); | 196 prefs->GetBoolean(prefs::kWebKitUsesUniversalDetector); |
195 web_prefs.text_areas_are_resizable = | 197 web_prefs.text_areas_are_resizable = |
196 prefs->GetBoolean(prefs::kWebKitTextAreasAreResizable); | 198 prefs->GetBoolean(prefs::kWebKitTextAreasAreResizable); |
197 | 199 |
198 // User CSS is currently disabled because it crashes chrome. See | 200 // User CSS is currently disabled because it crashes chrome. See |
199 // webkit/glue/webpreferences.h for more details. | 201 // webkit/glue/webpreferences.h for more details. |
200 | 202 |
201 // Make sure we will set the default_encoding with canonical encoding name. | 203 // Make sure we will set the default_encoding with canonical encoding name. |
202 web_prefs.default_encoding = | 204 web_prefs.default_encoding = |
203 CharacterEncoding::GetCanonicalEncodingNameByAliasName( | 205 CharacterEncoding::GetCanonicalEncodingNameByAliasName( |
204 web_prefs.default_encoding); | 206 web_prefs.default_encoding); |
205 if (web_prefs.default_encoding.empty()) { | 207 if (web_prefs.default_encoding.empty()) { |
206 prefs->ClearPref(prefs::kDefaultCharset); | 208 prefs->ClearPref(prefs::kDefaultCharset); |
207 web_prefs.default_encoding = WideToASCII( | 209 web_prefs.default_encoding = WideToASCII( |
208 prefs->GetString(prefs::kDefaultCharset)); | 210 prefs->GetString(prefs::kDefaultCharset)); |
209 } | 211 } |
210 DCHECK(!web_prefs.default_encoding.empty()); | 212 DCHECK(!web_prefs.default_encoding.empty()); |
211 | 213 |
212 if (is_dom_ui) { | 214 if (is_dom_ui) { |
213 web_prefs.loads_images_automatically = true; | 215 web_prefs.loads_images_automatically = true; |
214 web_prefs.javascript_enabled = true; | 216 web_prefs.javascript_enabled = true; |
215 } | 217 } |
216 | 218 |
217 return web_prefs; | 219 return web_prefs; |
218 } | 220 } |
OLD | NEW |