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