OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/renderer/render_view.h" | 5 #include "chrome/renderer/render_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 2754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2765 DCHECK(group != NULL); | 2765 DCHECK(group != NULL); |
2766 | 2766 |
2767 if (cmd->HasSwitch(switches::kBlockOutdatedPlugins) && | 2767 if (cmd->HasSwitch(switches::kBlockOutdatedPlugins) && |
2768 group->IsVulnerable()) { | 2768 group->IsVulnerable()) { |
2769 Send(new ViewHostMsg_BlockedOutdatedPlugin(routing_id_, | 2769 Send(new ViewHostMsg_BlockedOutdatedPlugin(routing_id_, |
2770 group->GetGroupName(), | 2770 group->GetGroupName(), |
2771 GURL(group->GetUpdateURL()))); | 2771 GURL(group->GetUpdateURL()))); |
2772 return CreatePluginPlaceholder(frame, | 2772 return CreatePluginPlaceholder(frame, |
2773 params, | 2773 params, |
2774 *group, | 2774 *group, |
2775 IDR_OUTDATED_PLUGIN_HTML, | 2775 IDR_BLOCKED_PLUGIN_HTML, |
2776 IDS_PLUGIN_OUTDATED); | 2776 IDS_PLUGIN_OUTDATED); |
2777 } | 2777 } |
2778 if (!info.enabled) | 2778 if (!info.enabled) |
2779 return NULL; | 2779 return NULL; |
2780 | 2780 |
2781 ContentSetting host_setting = | 2781 ContentSetting host_setting = |
2782 current_content_settings_.settings[CONTENT_SETTINGS_TYPE_PLUGINS]; | 2782 current_content_settings_.settings[CONTENT_SETTINGS_TYPE_PLUGINS]; |
2783 if (info.path.value() == kDefaultPluginLibraryName || | 2783 if (info.path.value() == kDefaultPluginLibraryName || |
2784 plugin_setting == CONTENT_SETTING_ALLOW || | 2784 plugin_setting == CONTENT_SETTING_ALLOW || |
2785 host_setting == CONTENT_SETTING_ALLOW) { | 2785 host_setting == CONTENT_SETTING_ALLOW) { |
2786 scoped_refptr<webkit::ppapi::PluginModule> pepper_module( | 2786 scoped_refptr<webkit::ppapi::PluginModule> pepper_module( |
2787 pepper_delegate_.CreatePepperPlugin(info.path)); | 2787 pepper_delegate_.CreatePepperPlugin(info.path)); |
2788 if (pepper_module) | 2788 if (pepper_module) |
2789 return CreatePepperPlugin(frame, params, info.path, pepper_module.get()); | 2789 return CreatePepperPlugin(frame, params, info.path, pepper_module.get()); |
2790 return CreateNPAPIPlugin(frame, params, info.path, actual_mime_type); | 2790 return CreateNPAPIPlugin(frame, params, info.path, actual_mime_type); |
2791 } | 2791 } |
2792 std::string resource; | 2792 std::string resource; |
2793 if (cmd->HasSwitch(switches::kEnableResourceContentSettings)) | 2793 if (cmd->HasSwitch(switches::kEnableResourceContentSettings)) |
2794 resource = group->identifier(); | 2794 resource = group->identifier(); |
2795 DidBlockContentType(CONTENT_SETTINGS_TYPE_PLUGINS, resource); | 2795 DidBlockContentType(CONTENT_SETTINGS_TYPE_PLUGINS, resource); |
2796 if (plugin_setting == CONTENT_SETTING_ASK) { | 2796 if (plugin_setting == CONTENT_SETTING_ASK) { |
2797 return CreatePluginPlaceholder(frame, | 2797 return CreatePluginPlaceholder(frame, |
2798 params, | 2798 params, |
2799 *group, | 2799 *group, |
2800 IDR_BLOCKED_PLUGIN_HTML, | 2800 IDR_CLICK_TO_PLAY_PLUGIN_HTML, |
2801 IDS_PLUGIN_LOAD); | 2801 IDS_PLUGIN_LOAD); |
2802 } else { | 2802 } else { |
2803 return CreatePluginPlaceholder(frame, | 2803 return CreatePluginPlaceholder(frame, |
2804 params, | 2804 params, |
2805 *group, | 2805 *group, |
2806 IDR_OUTDATED_PLUGIN_HTML, | 2806 IDR_BLOCKED_PLUGIN_HTML, |
2807 IDS_PLUGIN_BLOCKED); | 2807 IDS_PLUGIN_BLOCKED); |
2808 } | 2808 } |
2809 } | 2809 } |
2810 | 2810 |
2811 WebWorker* RenderView::createWorker(WebFrame* frame, WebWorkerClient* client) { | 2811 WebWorker* RenderView::createWorker(WebFrame* frame, WebWorkerClient* client) { |
2812 WebApplicationCacheHostImpl* appcache_host = | 2812 WebApplicationCacheHostImpl* appcache_host = |
2813 WebApplicationCacheHostImpl::FromFrame(frame); | 2813 WebApplicationCacheHostImpl::FromFrame(frame); |
2814 int appcache_host_id = appcache_host ? appcache_host->host_id() : 0; | 2814 int appcache_host_id = appcache_host ? appcache_host->host_id() : 0; |
2815 return new WebWorkerProxy(client, RenderThread::current(), routing_id_, | 2815 return new WebWorkerProxy(client, RenderThread::current(), routing_id_, |
2816 appcache_host_id); | 2816 appcache_host_id); |
(...skipping 1628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4445 int message_id) { | 4445 int message_id) { |
4446 // |blocked_plugin| will delete itself when the WebViewPlugin | 4446 // |blocked_plugin| will delete itself when the WebViewPlugin |
4447 // is destroyed. | 4447 // is destroyed. |
4448 BlockedPlugin* blocked_plugin = | 4448 BlockedPlugin* blocked_plugin = |
4449 new BlockedPlugin(this, | 4449 new BlockedPlugin(this, |
4450 frame, | 4450 frame, |
4451 group, | 4451 group, |
4452 params, | 4452 params, |
4453 webkit_preferences_, | 4453 webkit_preferences_, |
4454 resource_id, | 4454 resource_id, |
4455 l10n_util::GetStringUTF16(message_id)); | 4455 l10n_util::GetStringFUTF16(message_id, |
| 4456 group.GetGroupName())); |
4456 return blocked_plugin->plugin(); | 4457 return blocked_plugin->plugin(); |
4457 } | 4458 } |
4458 | 4459 |
4459 void RenderView::OnZoom(PageZoom::Function function) { | 4460 void RenderView::OnZoom(PageZoom::Function function) { |
4460 if (!webview()) // Not sure if this can happen, but no harm in being safe. | 4461 if (!webview()) // Not sure if this can happen, but no harm in being safe. |
4461 return; | 4462 return; |
4462 | 4463 |
4463 webview()->hidePopups(); | 4464 webview()->hidePopups(); |
4464 | 4465 |
4465 double old_zoom_level = webview()->zoomLevel(); | 4466 double old_zoom_level = webview()->zoomLevel(); |
(...skipping 1279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5745 external_popup_menu_.reset(); | 5746 external_popup_menu_.reset(); |
5746 } | 5747 } |
5747 #endif | 5748 #endif |
5748 | 5749 |
5749 void RenderView::AddErrorToRootConsole(const string16& message) { | 5750 void RenderView::AddErrorToRootConsole(const string16& message) { |
5750 if (webview() && webview()->mainFrame()) { | 5751 if (webview() && webview()->mainFrame()) { |
5751 webview()->mainFrame()->addMessageToConsole( | 5752 webview()->mainFrame()->addMessageToConsole( |
5752 WebConsoleMessage(WebConsoleMessage::LevelError, message)); | 5753 WebConsoleMessage(WebConsoleMessage::LevelError, message)); |
5753 } | 5754 } |
5754 } | 5755 } |
OLD | NEW |