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/extensions/extension_webkit_preferences.h" | 5 #include "webkit/glue/webpreferences.h" |
6 | 6 |
7 #include "chrome/common/extensions/extension.h" | 7 #include "chrome/common/extensions/extension.h" |
8 #include "webkit/glue/webpreferences.h" | |
9 | 8 |
10 namespace extension_webkit_preferences { | 9 namespace extension_webkit_preferences { |
11 | 10 |
12 void SetPreferences(const Extension* extension, | 11 void SetPreferences(WebPreferences* webkit_prefs, const Extension* extension) { |
13 content::ViewType render_view_type, | |
14 WebPreferences* webkit_prefs) { | |
15 if (extension && !extension->is_hosted_app()) { | 12 if (extension && !extension->is_hosted_app()) { |
16 // Extensions are trusted so we override any user preferences for disabling | 13 // Extensions are trusted so we override any user preferences for disabling |
17 // javascript or images. | 14 // javascript or images. |
18 webkit_prefs->loads_images_automatically = true; | 15 webkit_prefs->loads_images_automatically = true; |
19 webkit_prefs->javascript_enabled = true; | 16 webkit_prefs->javascript_enabled = true; |
20 | 17 |
21 // Tabs aren't typically allowed to close windows. But extensions shouldn't | 18 // Tabs aren't typically allowed to close windows. But extensions shouldn't |
22 // be subject to that. | 19 // be subject to that. |
23 webkit_prefs->allow_scripts_to_close_windows = true; | 20 webkit_prefs->allow_scripts_to_close_windows = true; |
24 | 21 |
25 // Enable privileged WebGL extensions. | 22 // Enable privileged WebGL extensions. |
26 webkit_prefs->privileged_webgl_extensions_enabled = true; | 23 webkit_prefs->privileged_webgl_extensions_enabled = true; |
27 | |
28 // Disable anything that requires the GPU process for background pages. | |
29 // See http://crbug.com/64512 and http://crbug.com/64841. | |
30 if (render_view_type == chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) { | |
31 webkit_prefs->experimental_webgl_enabled = false; | |
32 webkit_prefs->accelerated_compositing_enabled = false; | |
33 webkit_prefs->accelerated_2d_canvas_enabled = false; | |
34 } | |
35 } | 24 } |
36 } | 25 } |
37 | 26 |
38 } // extension_webkit_preferences | 27 } // extension_webkit_preferences |
OLD | NEW |