| 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_host.h" | 5 #include "chrome/browser/extensions/extension_host.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 if (associated_contents) | 519 if (associated_contents) |
| 520 preferences = | 520 preferences = |
| 521 static_cast<RenderViewHostDelegate*>(associated_contents)-> | 521 static_cast<RenderViewHostDelegate*>(associated_contents)-> |
| 522 GetRendererPrefs(profile); | 522 GetRendererPrefs(profile); |
| 523 | 523 |
| 524 renderer_preferences_util::UpdateFromSystemSettings(&preferences, profile); | 524 renderer_preferences_util::UpdateFromSystemSettings(&preferences, profile); |
| 525 return preferences; | 525 return preferences; |
| 526 } | 526 } |
| 527 | 527 |
| 528 WebPreferences ExtensionHost::GetWebkitPrefs() { | 528 WebPreferences ExtensionHost::GetWebkitPrefs() { |
| 529 Profile* profile = Profile::FromBrowserContext( | |
| 530 render_view_host()->process()->browser_context()); | |
| 531 WebPreferences webkit_prefs = | 529 WebPreferences webkit_prefs = |
| 532 RenderViewHostDelegateHelper::GetWebkitPrefs(profile, | 530 RenderViewHostDelegateHelper::GetWebkitPrefs(render_view_host(), |
| 533 false); // is_web_ui | 531 false); // is_web_ui |
| 534 // Extensions are trusted so we override any user preferences for disabling | |
| 535 // javascript or images. | |
| 536 webkit_prefs.loads_images_automatically = true; | |
| 537 webkit_prefs.javascript_enabled = true; | |
| 538 | |
| 539 // Enable privileged WebGL extensions. | |
| 540 webkit_prefs.privileged_webgl_extensions_enabled = true; | |
| 541 | |
| 542 if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_POPUP || | |
| 543 extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_DIALOG || | |
| 544 extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE || | |
| 545 extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_INFOBAR) | |
| 546 webkit_prefs.allow_scripts_to_close_windows = true; | |
| 547 | 532 |
| 548 // Disable anything that requires the GPU process for background pages. | 533 // Disable anything that requires the GPU process for background pages. |
| 549 // See http://crbug.com/64512 and http://crbug.com/64841. | 534 // See http://crbug.com/64512 and http://crbug.com/64841. |
| 550 if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) { | 535 if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_BACKGROUND_PAGE) { |
| 551 webkit_prefs.experimental_webgl_enabled = false; | 536 webkit_prefs.experimental_webgl_enabled = false; |
| 552 webkit_prefs.accelerated_compositing_enabled = false; | 537 webkit_prefs.accelerated_compositing_enabled = false; |
| 553 webkit_prefs.accelerated_2d_canvas_enabled = false; | 538 webkit_prefs.accelerated_2d_canvas_enabled = false; |
| 554 } | 539 } |
| 555 | 540 |
| 556 return webkit_prefs; | 541 return webkit_prefs; |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 void ExtensionHost::RenderViewCreated(RenderViewHost* render_view_host) { | 803 void ExtensionHost::RenderViewCreated(RenderViewHost* render_view_host) { |
| 819 if (view_.get()) | 804 if (view_.get()) |
| 820 view_->RenderViewCreated(); | 805 view_->RenderViewCreated(); |
| 821 | 806 |
| 822 if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_POPUP || | 807 if (extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_POPUP || |
| 823 extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_INFOBAR) { | 808 extension_host_type_ == chrome::VIEW_TYPE_EXTENSION_INFOBAR) { |
| 824 render_view_host->EnablePreferredSizeMode( | 809 render_view_host->EnablePreferredSizeMode( |
| 825 kPreferredSizeWidth | kPreferredSizeHeightThisIsSlow); | 810 kPreferredSizeWidth | kPreferredSizeHeightThisIsSlow); |
| 826 } | 811 } |
| 827 } | 812 } |
| OLD | NEW |