| 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 "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 extensions::Extension* extension, |
| 15 content::ViewType render_view_type, | 15 content::ViewType render_view_type, |
| 16 webkit_glue::WebPreferences* webkit_prefs) { | 16 webkit_glue::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; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 44 // more risk of fingerprinting. | 44 // more risk of fingerprinting. |
| 45 webkit_prefs->privileged_webgl_extensions_enabled = true; | 45 webkit_prefs->privileged_webgl_extensions_enabled = true; |
| 46 | 46 |
| 47 // If this is a component extension, then apply the same poliy for | 47 // If this is a component extension, then apply the same poliy for |
| 48 // accelerated compositing as for chrome: URLs (from | 48 // accelerated compositing as for chrome: URLs (from |
| 49 // WebContents::GetWebkitPrefs). This is important for component extensions | 49 // WebContents::GetWebkitPrefs). This is important for component extensions |
| 50 // like the file manager which are sometimes loaded using chrome: URLs and | 50 // like the file manager which are sometimes loaded using chrome: URLs and |
| 51 // sometimes loaded with chrome-extension: URLs - we should expect the | 51 // sometimes loaded with chrome-extension: URLs - we should expect the |
| 52 // performance characteristics to be similar in both cases. | 52 // performance characteristics to be similar in both cases. |
| 53 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 53 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 54 if (extension->location() == Extension::COMPONENT && | 54 if (extension->location() == extensions::Extension::COMPONENT && |
| 55 !command_line.HasSwitch(switches::kAllowWebUICompositing)) { | 55 !command_line.HasSwitch(switches::kAllowWebUICompositing)) { |
| 56 webkit_prefs->accelerated_compositing_enabled = false; | 56 webkit_prefs->accelerated_compositing_enabled = false; |
| 57 webkit_prefs->accelerated_2d_canvas_enabled = false; | 57 webkit_prefs->accelerated_2d_canvas_enabled = false; |
| 58 } | 58 } |
| 59 } | 59 } |
| 60 | 60 |
| 61 } // extension_webkit_preferences | 61 } // extension_webkit_preferences |
| OLD | NEW |