| 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 "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/background_contents_service.h" | 10 #include "chrome/browser/background_contents_service.h" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 RenderWidgetHost* host) { | 181 RenderWidgetHost* host) { |
| 182 for (PendingWidgetViews::iterator i = pending_widget_views_.begin(); | 182 for (PendingWidgetViews::iterator i = pending_widget_views_.begin(); |
| 183 i != pending_widget_views_.end(); ++i) { | 183 i != pending_widget_views_.end(); ++i) { |
| 184 if (host->view() == i->second) { | 184 if (host->view() == i->second) { |
| 185 pending_widget_views_.erase(i); | 185 pending_widget_views_.erase(i); |
| 186 return; | 186 return; |
| 187 } | 187 } |
| 188 } | 188 } |
| 189 } | 189 } |
| 190 | 190 |
| 191 bool RenderViewHostDelegateHelper::gpu_enabled_ = true; |
| 192 |
| 191 // static | 193 // static |
| 192 WebPreferences RenderViewHostDelegateHelper::GetWebkitPrefs( | 194 WebPreferences RenderViewHostDelegateHelper::GetWebkitPrefs( |
| 193 Profile* profile, bool is_dom_ui) { | 195 Profile* profile, bool is_dom_ui) { |
| 194 PrefService* prefs = profile->GetPrefs(); | 196 PrefService* prefs = profile->GetPrefs(); |
| 195 WebPreferences web_prefs; | 197 WebPreferences web_prefs; |
| 196 | 198 |
| 197 web_prefs.fixed_font_family = | 199 web_prefs.fixed_font_family = |
| 198 UTF8ToWide(prefs->GetString(prefs::kWebKitFixedFontFamily)); | 200 UTF8ToWide(prefs->GetString(prefs::kWebKitFixedFontFamily)); |
| 199 web_prefs.serif_font_family = | 201 web_prefs.serif_font_family = |
| 200 UTF8ToWide(prefs->GetString(prefs::kWebKitSerifFontFamily)); | 202 UTF8ToWide(prefs->GetString(prefs::kWebKitSerifFontFamily)); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 web_prefs.xss_auditor_enabled = | 266 web_prefs.xss_auditor_enabled = |
| 265 command_line.HasSwitch(switches::kEnableXSSAuditor); | 267 command_line.HasSwitch(switches::kEnableXSSAuditor); |
| 266 web_prefs.application_cache_enabled = | 268 web_prefs.application_cache_enabled = |
| 267 !command_line.HasSwitch(switches::kDisableApplicationCache); | 269 !command_line.HasSwitch(switches::kDisableApplicationCache); |
| 268 | 270 |
| 269 web_prefs.local_storage_enabled = | 271 web_prefs.local_storage_enabled = |
| 270 !command_line.HasSwitch(switches::kDisableLocalStorage); | 272 !command_line.HasSwitch(switches::kDisableLocalStorage); |
| 271 web_prefs.databases_enabled = | 273 web_prefs.databases_enabled = |
| 272 !command_line.HasSwitch(switches::kDisableDatabases); | 274 !command_line.HasSwitch(switches::kDisableDatabases); |
| 273 web_prefs.experimental_webgl_enabled = | 275 web_prefs.experimental_webgl_enabled = |
| 276 gpu_enabled() && |
| 274 !command_line.HasSwitch(switches::kDisableExperimentalWebGL); | 277 !command_line.HasSwitch(switches::kDisableExperimentalWebGL); |
| 275 web_prefs.site_specific_quirks_enabled = | 278 web_prefs.site_specific_quirks_enabled = |
| 276 !command_line.HasSwitch(switches::kDisableSiteSpecificQuirks); | 279 !command_line.HasSwitch(switches::kDisableSiteSpecificQuirks); |
| 277 web_prefs.allow_file_access_from_file_urls = | 280 web_prefs.allow_file_access_from_file_urls = |
| 278 command_line.HasSwitch(switches::kAllowFileAccessFromFiles); | 281 command_line.HasSwitch(switches::kAllowFileAccessFromFiles); |
| 279 web_prefs.show_composited_layer_borders = | 282 web_prefs.show_composited_layer_borders = |
| 280 command_line.HasSwitch(switches::kShowCompositedLayerBorders); | 283 command_line.HasSwitch(switches::kShowCompositedLayerBorders); |
| 281 web_prefs.accelerated_compositing_enabled = | 284 web_prefs.accelerated_compositing_enabled = |
| 285 gpu_enabled() && |
| 282 !command_line.HasSwitch(switches::kDisableAcceleratedCompositing); | 286 !command_line.HasSwitch(switches::kDisableAcceleratedCompositing); |
| 283 web_prefs.accelerated_2d_canvas_enabled = | 287 web_prefs.accelerated_2d_canvas_enabled = |
| 288 gpu_enabled() && |
| 284 command_line.HasSwitch(switches::kEnableAccelerated2dCanvas); | 289 command_line.HasSwitch(switches::kEnableAccelerated2dCanvas); |
| 285 web_prefs.memory_info_enabled = | 290 web_prefs.memory_info_enabled = |
| 286 command_line.HasSwitch(switches::kEnableMemoryInfo); | 291 command_line.HasSwitch(switches::kEnableMemoryInfo); |
| 287 web_prefs.hyperlink_auditing_enabled = | 292 web_prefs.hyperlink_auditing_enabled = |
| 288 !command_line.HasSwitch(switches::kNoPings); | 293 !command_line.HasSwitch(switches::kNoPings); |
| 289 // The user stylesheet watcher may not exist in a testing profile. | 294 // The user stylesheet watcher may not exist in a testing profile. |
| 290 if (profile->GetUserStyleSheetWatcher()) { | 295 if (profile->GetUserStyleSheetWatcher()) { |
| 291 web_prefs.user_style_sheet_enabled = true; | 296 web_prefs.user_style_sheet_enabled = true; |
| 292 web_prefs.user_style_sheet_location = | 297 web_prefs.user_style_sheet_location = |
| 293 profile->GetUserStyleSheetWatcher()->user_style_sheet(); | 298 profile->GetUserStyleSheetWatcher()->user_style_sheet(); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 inspector_settings->SetWithoutPathExpansion(key, | 332 inspector_settings->SetWithoutPathExpansion(key, |
| 328 Value::CreateStringValue(value)); | 333 Value::CreateStringValue(value)); |
| 329 } | 334 } |
| 330 | 335 |
| 331 void RenderViewHostDelegateHelper::ClearInspectorSettings(Profile* profile) { | 336 void RenderViewHostDelegateHelper::ClearInspectorSettings(Profile* profile) { |
| 332 DictionaryValue* inspector_settings = | 337 DictionaryValue* inspector_settings = |
| 333 profile->GetPrefs()->GetMutableDictionary( | 338 profile->GetPrefs()->GetMutableDictionary( |
| 334 prefs::kWebKitInspectorSettings); | 339 prefs::kWebKitInspectorSettings); |
| 335 inspector_settings->Clear(); | 340 inspector_settings->Clear(); |
| 336 } | 341 } |
| OLD | NEW |