| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/background_contents_service.h" | 10 #include "chrome/browser/background/background_contents_service.h" |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 command_line.HasSwitch(switches::kEnableThreadedCompositing); | 450 command_line.HasSwitch(switches::kEnableThreadedCompositing); |
| 451 web_prefs.force_compositing_mode = | 451 web_prefs.force_compositing_mode = |
| 452 command_line.HasSwitch(switches::kForceCompositingMode); | 452 command_line.HasSwitch(switches::kForceCompositingMode); |
| 453 web_prefs.fixed_position_compositing_enabled = | 453 web_prefs.fixed_position_compositing_enabled = |
| 454 command_line.HasSwitch(switches::kEnableCompositingForFixedPosition); | 454 command_line.HasSwitch(switches::kEnableCompositingForFixedPosition); |
| 455 web_prefs.allow_webui_compositing = | 455 web_prefs.allow_webui_compositing = |
| 456 command_line.HasSwitch(switches::kAllowWebUICompositing); | 456 command_line.HasSwitch(switches::kAllowWebUICompositing); |
| 457 web_prefs.accelerated_2d_canvas_enabled = | 457 web_prefs.accelerated_2d_canvas_enabled = |
| 458 GpuProcessHost::gpu_enabled() && | 458 GpuProcessHost::gpu_enabled() && |
| 459 !command_line.HasSwitch(switches::kDisableAccelerated2dCanvas); | 459 !command_line.HasSwitch(switches::kDisableAccelerated2dCanvas); |
| 460 web_prefs.accelerated_drawing_enabled = | 460 web_prefs.accelerated_painting_enabled = |
| 461 GpuProcessHost::gpu_enabled() && | 461 GpuProcessHost::gpu_enabled() && |
| 462 command_line.HasSwitch(switches::kEnableAcceleratedDrawing); | 462 command_line.HasSwitch(switches::kEnableAcceleratedPainting); |
| 463 web_prefs.accelerated_filters_enabled = | 463 web_prefs.accelerated_filters_enabled = |
| 464 GpuProcessHost::gpu_enabled() && | 464 GpuProcessHost::gpu_enabled() && |
| 465 command_line.HasSwitch(switches::kEnableAcceleratedFilters); | 465 command_line.HasSwitch(switches::kEnableAcceleratedFilters); |
| 466 web_prefs.accelerated_layers_enabled = | 466 web_prefs.accelerated_layers_enabled = |
| 467 !command_line.HasSwitch(switches::kDisableAcceleratedLayers); | 467 !command_line.HasSwitch(switches::kDisableAcceleratedLayers); |
| 468 web_prefs.composite_to_texture_enabled = | 468 web_prefs.composite_to_texture_enabled = |
| 469 command_line.HasSwitch(switches::kEnableCompositeToTexture); | 469 command_line.HasSwitch(switches::kEnableCompositeToTexture); |
| 470 web_prefs.accelerated_plugins_enabled = | 470 web_prefs.accelerated_plugins_enabled = |
| 471 !command_line.HasSwitch(switches::kDisableAcceleratedPlugins); | 471 !command_line.HasSwitch(switches::kDisableAcceleratedPlugins); |
| 472 web_prefs.accelerated_video_enabled = | 472 web_prefs.accelerated_video_enabled = |
| (...skipping 25 matching lines...) Expand all Loading... |
| 498 if (profile->GetUserStyleSheetWatcher()) { | 498 if (profile->GetUserStyleSheetWatcher()) { |
| 499 web_prefs.user_style_sheet_enabled = true; | 499 web_prefs.user_style_sheet_enabled = true; |
| 500 web_prefs.user_style_sheet_location = | 500 web_prefs.user_style_sheet_location = |
| 501 profile->GetUserStyleSheetWatcher()->user_style_sheet(); | 501 profile->GetUserStyleSheetWatcher()->user_style_sheet(); |
| 502 } else { | 502 } else { |
| 503 web_prefs.user_style_sheet_enabled = false; | 503 web_prefs.user_style_sheet_enabled = false; |
| 504 } | 504 } |
| 505 | 505 |
| 506 web_prefs.visual_word_movement_enabled = | 506 web_prefs.visual_word_movement_enabled = |
| 507 command_line.HasSwitch(switches::kEnableVisualWordMovement); | 507 command_line.HasSwitch(switches::kEnableVisualWordMovement); |
| 508 | |
| 509 web_prefs.unified_textchecker_enabled = | 508 web_prefs.unified_textchecker_enabled = |
| 510 command_line.HasSwitch(switches::kExperimentalSpellcheckerFeatures); | 509 command_line.HasSwitch(switches::kExperimentalSpellcheckerFeatures); |
| 510 web_prefs.per_tile_painting_enabled = |
| 511 command_line.HasSwitch(switches::kEnablePerTilePainting); |
| 511 } | 512 } |
| 512 | 513 |
| 513 { // Certain GPU features might have been blacklisted. | 514 { // Certain GPU features might have been blacklisted. |
| 514 GpuDataManager* gpu_data_manager = GpuDataManager::GetInstance(); | 515 GpuDataManager* gpu_data_manager = GpuDataManager::GetInstance(); |
| 515 DCHECK(gpu_data_manager); | 516 DCHECK(gpu_data_manager); |
| 516 uint32 blacklist_flags = gpu_data_manager->GetGpuFeatureFlags().flags(); | 517 uint32 blacklist_flags = gpu_data_manager->GetGpuFeatureFlags().flags(); |
| 517 if (blacklist_flags & GpuFeatureFlags::kGpuFeatureAcceleratedCompositing) | 518 if (blacklist_flags & GpuFeatureFlags::kGpuFeatureAcceleratedCompositing) |
| 518 web_prefs.accelerated_compositing_enabled = false; | 519 web_prefs.accelerated_compositing_enabled = false; |
| 519 if (blacklist_flags & GpuFeatureFlags::kGpuFeatureWebgl) | 520 if (blacklist_flags & GpuFeatureFlags::kGpuFeatureWebgl) |
| 520 web_prefs.experimental_webgl_enabled = false; | 521 web_prefs.experimental_webgl_enabled = false; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 if (rvh->delegate()->GetRenderViewType() == chrome::VIEW_TYPE_NOTIFICATION) { | 561 if (rvh->delegate()->GetRenderViewType() == chrome::VIEW_TYPE_NOTIFICATION) { |
| 561 web_prefs.allow_scripts_to_close_windows = true; | 562 web_prefs.allow_scripts_to_close_windows = true; |
| 562 } else if (rvh->delegate()->GetRenderViewType() == | 563 } else if (rvh->delegate()->GetRenderViewType() == |
| 563 chrome::VIEW_TYPE_BACKGROUND_CONTENTS) { | 564 chrome::VIEW_TYPE_BACKGROUND_CONTENTS) { |
| 564 // Disable all kinds of acceleration for background pages. | 565 // Disable all kinds of acceleration for background pages. |
| 565 // See http://crbug.com/96005 and http://crbug.com/96006 | 566 // See http://crbug.com/96005 and http://crbug.com/96006 |
| 566 web_prefs.force_compositing_mode = false; | 567 web_prefs.force_compositing_mode = false; |
| 567 web_prefs.accelerated_compositing_enabled = false; | 568 web_prefs.accelerated_compositing_enabled = false; |
| 568 web_prefs.accelerated_2d_canvas_enabled = false; | 569 web_prefs.accelerated_2d_canvas_enabled = false; |
| 569 web_prefs.accelerated_video_enabled = false; | 570 web_prefs.accelerated_video_enabled = false; |
| 570 web_prefs.accelerated_drawing_enabled = false; | 571 web_prefs.accelerated_painting_enabled = false; |
| 571 web_prefs.accelerated_plugins_enabled = false; | 572 web_prefs.accelerated_plugins_enabled = false; |
| 572 } | 573 } |
| 573 | 574 |
| 574 return web_prefs; | 575 return web_prefs; |
| 575 } | 576 } |
| 576 | 577 |
| 577 void RenderViewHostDelegateHelper::UpdateInspectorSetting( | 578 void RenderViewHostDelegateHelper::UpdateInspectorSetting( |
| 578 content::BrowserContext* browser_context, | 579 content::BrowserContext* browser_context, |
| 579 const std::string& key, | 580 const std::string& key, |
| 580 const std::string& value) { | 581 const std::string& value) { |
| 581 DictionaryPrefUpdate update( | 582 DictionaryPrefUpdate update( |
| 582 Profile::FromBrowserContext(browser_context)->GetPrefs(), | 583 Profile::FromBrowserContext(browser_context)->GetPrefs(), |
| 583 prefs::kWebKitInspectorSettings); | 584 prefs::kWebKitInspectorSettings); |
| 584 DictionaryValue* inspector_settings = update.Get(); | 585 DictionaryValue* inspector_settings = update.Get(); |
| 585 inspector_settings->SetWithoutPathExpansion(key, | 586 inspector_settings->SetWithoutPathExpansion(key, |
| 586 Value::CreateStringValue(value)); | 587 Value::CreateStringValue(value)); |
| 587 } | 588 } |
| 588 | 589 |
| 589 void RenderViewHostDelegateHelper::ClearInspectorSettings( | 590 void RenderViewHostDelegateHelper::ClearInspectorSettings( |
| 590 content::BrowserContext* browser_context) { | 591 content::BrowserContext* browser_context) { |
| 591 Profile::FromBrowserContext(browser_context)->GetPrefs()-> | 592 Profile::FromBrowserContext(browser_context)->GetPrefs()-> |
| 592 ClearPref(prefs::kWebKitInspectorSettings); | 593 ClearPref(prefs::kWebKitInspectorSettings); |
| 593 } | 594 } |
| OLD | NEW |