Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / extensions / extension_webkit_preferences.cc
blob73ce8c33e0536b2379068dc8f6d114693041c393
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
3 // found in the LICENSE file.
5 #include "chrome/browser/extensions/extension_webkit_preferences.h"
7 #include "base/command_line.h"
8 #include "chrome/common/chrome_switches.h"
9 #include "content/public/common/web_preferences.h"
10 #include "extensions/common/extension.h"
11 #include "extensions/common/manifest.h"
13 namespace extension_webkit_preferences {
15 void SetPreferences(const extensions::Extension* extension,
16 extensions::ViewType render_view_type,
17 content::WebPreferences* webkit_prefs) {
18 if (!extension)
19 return;
21 if (!extension->is_hosted_app()) {
22 // Extensions are trusted so we override any user preferences for disabling
23 // javascript or images.
24 webkit_prefs->loads_images_automatically = true;
25 webkit_prefs->javascript_enabled = true;
27 // Tabs aren't typically allowed to close windows. But extensions shouldn't
28 // be subject to that.
29 webkit_prefs->allow_scripts_to_close_windows = true;
32 if (extension->is_platform_app()) {
33 webkit_prefs->databases_enabled = false;
34 webkit_prefs->local_storage_enabled = false;
35 webkit_prefs->sync_xhr_in_documents_enabled = false;
36 webkit_prefs->cookie_enabled = false;
39 // Enable WebGL features that regular pages can't access, since they add
40 // more risk of fingerprinting.
41 webkit_prefs->privileged_webgl_extensions_enabled = true;
44 } // namespace extension_webkit_preferences