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 "webkit/glue/webpreferences.h" | 5 #include "chrome/browser/extensions/extension_webkit_preferences.h" |
6 | 6 |
7 #include "chrome/common/extensions/extension.h" | 7 #include "chrome/common/extensions/extension.h" |
| 8 #include "webkit/glue/webpreferences.h" |
8 | 9 |
9 namespace extension_webkit_preferences { | 10 namespace extension_webkit_preferences { |
10 | 11 |
11 void SetPreferences(WebPreferences* webkit_prefs, const Extension* extension) { | 12 void SetPreferences(const Extension* extension, |
| 13 content::ViewType render_view_type, |
| 14 WebPreferences* webkit_prefs) { |
12 if (extension && !extension->is_hosted_app()) { | 15 if (extension && !extension->is_hosted_app()) { |
13 // Extensions are trusted so we override any user preferences for disabling | 16 // Extensions are trusted so we override any user preferences for disabling |
14 // javascript or images. | 17 // javascript or images. |
15 webkit_prefs->loads_images_automatically = true; | 18 webkit_prefs->loads_images_automatically = true; |
16 webkit_prefs->javascript_enabled = true; | 19 webkit_prefs->javascript_enabled = true; |
17 | 20 |
18 // Tabs aren't typically allowed to close windows. But extensions shouldn't | 21 // Tabs aren't typically allowed to close windows. But extensions shouldn't |
19 // be subject to that. | 22 // be subject to that. |
20 webkit_prefs->allow_scripts_to_close_windows = true; | 23 webkit_prefs->allow_scripts_to_close_windows = true; |
21 | 24 |
22 // Enable privileged WebGL extensions. | 25 // Enable privileged WebGL extensions. |
23 webkit_prefs->privileged_webgl_extensions_enabled = true; | 26 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 } |
24 } | 35 } |
25 } | 36 } |
26 | 37 |
27 } // extension_webkit_preferences | 38 } // extension_webkit_preferences |
OLD | NEW |