Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Side by Side Diff: chrome/browser/extensions/extension_webkit_preferences.cc

Issue 9624013: Re-enable extension GPU features (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove old Canvas2D test Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/extensions/extension_webkit_preferences.h" 5 #include "chrome/browser/extensions/extension_webkit_preferences.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/common/chrome_switches.h" 8 #include "chrome/common/chrome_switches.h"
9 #include "chrome/common/extensions/extension.h" 9 #include "chrome/common/extensions/extension.h"
10 #include "webkit/glue/webpreferences.h" 10 #include "webkit/glue/webpreferences.h"
11 11
12 namespace extension_webkit_preferences { 12 namespace extension_webkit_preferences {
13 13
14 void SetPreferences(const Extension* extension, 14 void SetPreferences(const Extension* extension,
15 content::ViewType render_view_type, 15 content::ViewType render_view_type,
16 WebPreferences* webkit_prefs) { 16 WebPreferences* webkit_prefs) {
17 if (!extension) 17 if (!extension)
18 return; 18 return;
19 19
20 if (!extension->is_hosted_app()) { 20 if (!extension->is_hosted_app()) {
21 // Extensions are trusted so we override any user preferences for disabling 21 // Extensions are trusted so we override any user preferences for disabling
22 // javascript or images. 22 // javascript or images.
23 webkit_prefs->loads_images_automatically = true; 23 webkit_prefs->loads_images_automatically = true;
24 webkit_prefs->javascript_enabled = true; 24 webkit_prefs->javascript_enabled = true;
25 25
26 // Tabs aren't typically allowed to close windows. But extensions shouldn't 26 // Tabs aren't typically allowed to close windows. But extensions shouldn't
27 // be subject to that. 27 // be subject to that.
28 webkit_prefs->allow_scripts_to_close_windows = true; 28 webkit_prefs->allow_scripts_to_close_windows = true;
29
30 // Disable anything that requires the GPU process for background pages.
31 // See http://crbug.com/64512 and http://crbug.com/64841.
32 if (render_view_type == chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) {
33 webkit_prefs->experimental_webgl_enabled = false;
34 webkit_prefs->accelerated_compositing_enabled = false;
35 webkit_prefs->accelerated_2d_canvas_enabled = false;
36 }
37 } 29 }
38 30
39 if (extension->is_platform_app()) { 31 if (extension->is_platform_app()) {
40 webkit_prefs->databases_enabled = false; 32 webkit_prefs->databases_enabled = false;
41 webkit_prefs->local_storage_enabled = false; 33 webkit_prefs->local_storage_enabled = false;
42 } 34 }
43 35
44 // Enable WebGL features that regular pages can't access, since they add 36 // Enable WebGL features that regular pages can't access, since they add
45 // more risk of fingerprinting. 37 // more risk of fingerprinting.
46 webkit_prefs->privileged_webgl_extensions_enabled = true; 38 webkit_prefs->privileged_webgl_extensions_enabled = true;
47 39
48 // If this is a component extension, then apply the same poliy for 40 // If this is a component extension, then apply the same poliy for
49 // accelerated compositing as for chrome: URLs (from 41 // accelerated compositing as for chrome: URLs (from
50 // TabContents::GetWebkitPrefs). This is important for component extensions 42 // TabContents::GetWebkitPrefs). This is important for component extensions
51 // like the file manager which are sometimes loaded using chrome: URLs and 43 // like the file manager which are sometimes loaded using chrome: URLs and
52 // sometimes loaded with chrome-extension: URLs - we should expect the 44 // sometimes loaded with chrome-extension: URLs - we should expect the
53 // performance characteristics to be similar in both cases. 45 // performance characteristics to be similar in both cases.
54 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 46 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
55 if (extension->location() == Extension::COMPONENT && 47 if (extension->location() == Extension::COMPONENT &&
56 !command_line.HasSwitch(switches::kAllowWebUICompositing)) { 48 !command_line.HasSwitch(switches::kAllowWebUICompositing)) {
57 webkit_prefs->accelerated_compositing_enabled = false; 49 webkit_prefs->accelerated_compositing_enabled = false;
58 webkit_prefs->accelerated_2d_canvas_enabled = false; 50 webkit_prefs->accelerated_2d_canvas_enabled = false;
59 } 51 }
60 } 52 }
61 53
62 } // extension_webkit_preferences 54 } // extension_webkit_preferences
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_webglbackground_apitest.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698