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); | |
193 } | 191 } |
194 | 192 |
195 web_prefs.uses_universal_detector = | 193 web_prefs.uses_universal_detector = |
196 prefs->GetBoolean(prefs::kWebKitUsesUniversalDetector); | 194 prefs->GetBoolean(prefs::kWebKitUsesUniversalDetector); |
197 web_prefs.text_areas_are_resizable = | 195 web_prefs.text_areas_are_resizable = |
198 prefs->GetBoolean(prefs::kWebKitTextAreasAreResizable); | 196 prefs->GetBoolean(prefs::kWebKitTextAreasAreResizable); |
199 | 197 |
200 // User CSS is currently disabled because it crashes chrome. See | 198 // User CSS is currently disabled because it crashes chrome. See |
201 // webkit/glue/webpreferences.h for more details. | 199 // webkit/glue/webpreferences.h for more details. |
202 | 200 |
203 // Make sure we will set the default_encoding with canonical encoding name. | 201 // Make sure we will set the default_encoding with canonical encoding name. |
204 web_prefs.default_encoding = | 202 web_prefs.default_encoding = |
205 CharacterEncoding::GetCanonicalEncodingNameByAliasName( | 203 CharacterEncoding::GetCanonicalEncodingNameByAliasName( |
206 web_prefs.default_encoding); | 204 web_prefs.default_encoding); |
207 if (web_prefs.default_encoding.empty()) { | 205 if (web_prefs.default_encoding.empty()) { |
208 prefs->ClearPref(prefs::kDefaultCharset); | 206 prefs->ClearPref(prefs::kDefaultCharset); |
209 web_prefs.default_encoding = WideToASCII( | 207 web_prefs.default_encoding = WideToASCII( |
210 prefs->GetString(prefs::kDefaultCharset)); | 208 prefs->GetString(prefs::kDefaultCharset)); |
211 } | 209 } |
212 DCHECK(!web_prefs.default_encoding.empty()); | 210 DCHECK(!web_prefs.default_encoding.empty()); |
213 | 211 |
214 if (is_dom_ui) { | 212 if (is_dom_ui) { |
215 web_prefs.loads_images_automatically = true; | 213 web_prefs.loads_images_automatically = true; |
216 web_prefs.javascript_enabled = true; | 214 web_prefs.javascript_enabled = true; |
217 } | 215 } |
218 | 216 |
219 return web_prefs; | 217 return web_prefs; |
220 } | 218 } |
OLD | NEW |