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