| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 #include "webkit/glue/form_data.h" | 168 #include "webkit/glue/form_data.h" |
| 169 #include "webkit/glue/form_field.h" | 169 #include "webkit/glue/form_field.h" |
| 170 #include "webkit/glue/glue_serialize.h" | 170 #include "webkit/glue/glue_serialize.h" |
| 171 #include "webkit/glue/image_decoder.h" | 171 #include "webkit/glue/image_decoder.h" |
| 172 #include "webkit/glue/image_resource_fetcher.h" | 172 #include "webkit/glue/image_resource_fetcher.h" |
| 173 #include "webkit/glue/media/buffered_data_source.h" | 173 #include "webkit/glue/media/buffered_data_source.h" |
| 174 #include "webkit/glue/media/simple_data_source.h" | 174 #include "webkit/glue/media/simple_data_source.h" |
| 175 #include "webkit/glue/media/video_renderer_impl.h" | 175 #include "webkit/glue/media/video_renderer_impl.h" |
| 176 #include "webkit/glue/password_form_dom_manager.h" | 176 #include "webkit/glue/password_form_dom_manager.h" |
| 177 #include "webkit/glue/plugins/default_plugin_shared.h" | 177 #include "webkit/glue/plugins/default_plugin_shared.h" |
| 178 #include "webkit/glue/plugins/pepper_webplugin_impl.h" | |
| 179 #include "webkit/glue/plugins/plugin_list.h" | 178 #include "webkit/glue/plugins/plugin_list.h" |
| 180 #include "webkit/glue/plugins/webplugin_delegate.h" | 179 #include "webkit/glue/plugins/webplugin_delegate.h" |
| 181 #include "webkit/glue/plugins/webplugin_delegate_impl.h" | 180 #include "webkit/glue/plugins/webplugin_delegate_impl.h" |
| 182 #include "webkit/glue/plugins/webplugin_impl.h" | 181 #include "webkit/glue/plugins/webplugin_impl.h" |
| 183 #include "webkit/glue/plugins/webview_plugin.h" | 182 #include "webkit/glue/plugins/webview_plugin.h" |
| 184 #include "webkit/glue/resource_fetcher.h" | 183 #include "webkit/glue/resource_fetcher.h" |
| 185 #include "webkit/glue/site_isolation_metrics.h" | 184 #include "webkit/glue/site_isolation_metrics.h" |
| 186 #include "webkit/glue/webaccessibility.h" | 185 #include "webkit/glue/webaccessibility.h" |
| 187 #include "webkit/glue/webdropdata.h" | 186 #include "webkit/glue/webdropdata.h" |
| 188 #include "webkit/glue/webkit_glue.h" | 187 #include "webkit/glue/webkit_glue.h" |
| 189 #include "webkit/glue/webmediaplayer_impl.h" | 188 #include "webkit/glue/webmediaplayer_impl.h" |
| 189 #include "webkit/plugins/ppapi/webplugin_impl.h" |
| 190 | 190 |
| 191 #if defined(OS_WIN) | 191 #if defined(OS_WIN) |
| 192 // TODO(port): these files are currently Windows only because they concern: | 192 // TODO(port): these files are currently Windows only because they concern: |
| 193 // * theming | 193 // * theming |
| 194 #include "gfx/native_theme_win.h" | 194 #include "gfx/native_theme_win.h" |
| 195 #elif defined(USE_X11) | 195 #elif defined(USE_X11) |
| 196 #include "gfx/native_theme_linux.h" | 196 #include "gfx/native_theme_linux.h" |
| 197 #include "third_party/WebKit/WebKit/chromium/public/linux/WebRenderTheme.h" | 197 #include "third_party/WebKit/WebKit/chromium/public/linux/WebRenderTheme.h" |
| 198 #elif defined(OS_MACOSX) | 198 #elif defined(OS_MACOSX) |
| 199 #include "skia/ext/skia_utils_mac.h" | 199 #include "skia/ext/skia_utils_mac.h" |
| (...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 836 WebPluginInfo info; | 836 WebPluginInfo info; |
| 837 bool found; | 837 bool found; |
| 838 ContentSetting setting; | 838 ContentSetting setting; |
| 839 std::string mime_type; | 839 std::string mime_type; |
| 840 Send(new ViewHostMsg_GetPluginInfo( | 840 Send(new ViewHostMsg_GetPluginInfo( |
| 841 params.url, frame->top()->url(), params.mimeType.utf8(), &found, | 841 params.url, frame->top()->url(), params.mimeType.utf8(), &found, |
| 842 &info, &setting, &mime_type)); | 842 &info, &setting, &mime_type)); |
| 843 if (!found || !info.enabled) | 843 if (!found || !info.enabled) |
| 844 return NULL; | 844 return NULL; |
| 845 | 845 |
| 846 scoped_refptr<pepper::PluginModule> pepper_module( | 846 scoped_refptr<webkit::plugins::ppapi::PluginModule> pepper_module( |
| 847 pepper_delegate_.CreatePepperPlugin(info.path)); | 847 pepper_delegate_.CreatePepperPlugin(info.path)); |
| 848 if (pepper_module) | 848 if (pepper_module) |
| 849 return CreatePepperPlugin(frame, params, info.path, pepper_module.get()); | 849 return CreatePepperPlugin(frame, params, info.path, pepper_module.get()); |
| 850 return CreateNPAPIPlugin(frame, params, info.path, mime_type); | 850 return CreateNPAPIPlugin(frame, params, info.path, mime_type); |
| 851 } | 851 } |
| 852 | 852 |
| 853 void RenderView::CustomMenuListenerInstall(CustomMenuListener* listening) { | 853 void RenderView::CustomMenuListenerInstall(CustomMenuListener* listening) { |
| 854 custom_menu_listener_ = listening; | 854 custom_menu_listener_ = listening; |
| 855 } | 855 } |
| 856 | 856 |
| (...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2119 return external_popup_menu_.get(); | 2119 return external_popup_menu_.get(); |
| 2120 } | 2120 } |
| 2121 | 2121 |
| 2122 WebWidget* RenderView::createFullscreenWindow(WebKit::WebPopupType popup_type) { | 2122 WebWidget* RenderView::createFullscreenWindow(WebKit::WebPopupType popup_type) { |
| 2123 RenderWidget* widget = RenderWidgetFullscreen::Create(routing_id_, | 2123 RenderWidget* widget = RenderWidgetFullscreen::Create(routing_id_, |
| 2124 render_thread_, | 2124 render_thread_, |
| 2125 popup_type); | 2125 popup_type); |
| 2126 return widget->webwidget(); | 2126 return widget->webwidget(); |
| 2127 } | 2127 } |
| 2128 | 2128 |
| 2129 pepper::FullscreenContainer* RenderView::CreatePepperFullscreenContainer( | 2129 webkit::plugins::ppapi::FullscreenContainer* |
| 2130 pepper::PluginInstance* plugin) { | 2130 RenderView::CreatePepperFullscreenContainer( |
| 2131 webkit::plugins::ppapi::PluginInstance* plugin) { |
| 2131 RenderWidgetFullscreenPepper* widget = | 2132 RenderWidgetFullscreenPepper* widget = |
| 2132 RenderWidgetFullscreenPepper::Create(routing_id_, render_thread_, plugin); | 2133 RenderWidgetFullscreenPepper::Create(routing_id_, render_thread_, plugin); |
| 2133 widget->show(WebKit::WebNavigationPolicyIgnore); | 2134 widget->show(WebKit::WebNavigationPolicyIgnore); |
| 2134 return widget->container(); | 2135 return widget->container(); |
| 2135 } | 2136 } |
| 2136 | 2137 |
| 2137 WebStorageNamespace* RenderView::createSessionStorageNamespace(unsigned quota) { | 2138 WebStorageNamespace* RenderView::createSessionStorageNamespace(unsigned quota) { |
| 2138 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)) | 2139 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)) |
| 2139 return WebStorageNamespace::createSessionStorageNamespace(quota); | 2140 return WebStorageNamespace::createSessionStorageNamespace(quota); |
| 2140 CHECK(session_storage_namespace_id_ != kInvalidSessionStorageNamespaceId); | 2141 CHECK(session_storage_namespace_id_ != kInvalidSessionStorageNamespaceId); |
| (...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2772 return CreateOutdatedPluginPlaceholder(frame, params, *group); | 2773 return CreateOutdatedPluginPlaceholder(frame, params, *group); |
| 2773 } | 2774 } |
| 2774 return NULL; | 2775 return NULL; |
| 2775 } | 2776 } |
| 2776 | 2777 |
| 2777 ContentSetting host_setting = | 2778 ContentSetting host_setting = |
| 2778 current_content_settings_.settings[CONTENT_SETTINGS_TYPE_PLUGINS]; | 2779 current_content_settings_.settings[CONTENT_SETTINGS_TYPE_PLUGINS]; |
| 2779 if (info.path.value() == kDefaultPluginLibraryName || | 2780 if (info.path.value() == kDefaultPluginLibraryName || |
| 2780 plugin_setting == CONTENT_SETTING_ALLOW || | 2781 plugin_setting == CONTENT_SETTING_ALLOW || |
| 2781 host_setting == CONTENT_SETTING_ALLOW) { | 2782 host_setting == CONTENT_SETTING_ALLOW) { |
| 2782 scoped_refptr<pepper::PluginModule> pepper_module( | 2783 scoped_refptr<webkit::plugins::ppapi::PluginModule> pepper_module( |
| 2783 pepper_delegate_.CreatePepperPlugin(info.path)); | 2784 pepper_delegate_.CreatePepperPlugin(info.path)); |
| 2784 if (pepper_module) | 2785 if (pepper_module) |
| 2785 return CreatePepperPlugin(frame, params, info.path, pepper_module.get()); | 2786 return CreatePepperPlugin(frame, params, info.path, pepper_module.get()); |
| 2786 return CreateNPAPIPlugin(frame, params, info.path, actual_mime_type); | 2787 return CreateNPAPIPlugin(frame, params, info.path, actual_mime_type); |
| 2787 } | 2788 } |
| 2788 std::string resource; | 2789 std::string resource; |
| 2789 if (cmd->HasSwitch(switches::kEnableResourceContentSettings)) | 2790 if (cmd->HasSwitch(switches::kEnableResourceContentSettings)) |
| 2790 resource = group->identifier(); | 2791 resource = group->identifier(); |
| 2791 DidBlockContentType(CONTENT_SETTINGS_TYPE_PLUGINS, resource); | 2792 DidBlockContentType(CONTENT_SETTINGS_TYPE_PLUGINS, resource); |
| 2792 int resource_id; | 2793 int resource_id; |
| (...skipping 1624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4417 Send(new ViewHostMsg_ContentBlocked(routing_id_, settings_type, | 4418 Send(new ViewHostMsg_ContentBlocked(routing_id_, settings_type, |
| 4418 resource_identifier)); | 4419 resource_identifier)); |
| 4419 } | 4420 } |
| 4420 } | 4421 } |
| 4421 | 4422 |
| 4422 void RenderView::ClearBlockedContentSettings() { | 4423 void RenderView::ClearBlockedContentSettings() { |
| 4423 for (size_t i = 0; i < arraysize(content_blocked_); ++i) | 4424 for (size_t i = 0; i < arraysize(content_blocked_); ++i) |
| 4424 content_blocked_[i] = false; | 4425 content_blocked_[i] = false; |
| 4425 } | 4426 } |
| 4426 | 4427 |
| 4427 WebPlugin* RenderView::CreatePepperPlugin(WebFrame* frame, | 4428 WebPlugin* RenderView::CreatePepperPlugin( |
| 4428 const WebPluginParams& params, | 4429 WebFrame* frame, |
| 4429 const FilePath& path, | 4430 const WebPluginParams& params, |
| 4430 pepper::PluginModule* pepper_module) { | 4431 const FilePath& path, |
| 4431 return new pepper::WebPluginImpl( | 4432 webkit::plugins::ppapi::PluginModule* pepper_module) { |
| 4433 return new webkit::plugins::ppapi::WebPluginImpl( |
| 4432 pepper_module, params, pepper_delegate_.AsWeakPtr()); | 4434 pepper_module, params, pepper_delegate_.AsWeakPtr()); |
| 4433 } | 4435 } |
| 4434 | 4436 |
| 4435 WebPlugin* RenderView::CreateNPAPIPlugin(WebFrame* frame, | 4437 WebPlugin* RenderView::CreateNPAPIPlugin(WebFrame* frame, |
| 4436 const WebPluginParams& params, | 4438 const WebPluginParams& params, |
| 4437 const FilePath& path, | 4439 const FilePath& path, |
| 4438 const std::string& mime_type) { | 4440 const std::string& mime_type) { |
| 4439 return new webkit_glue::WebPluginImpl( | 4441 return new webkit_glue::WebPluginImpl( |
| 4440 frame, params, path, mime_type, AsWeakPtr()); | 4442 frame, params, path, mime_type, AsWeakPtr()); |
| 4441 } | 4443 } |
| (...skipping 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5755 external_popup_menu_.reset(); | 5757 external_popup_menu_.reset(); |
| 5756 } | 5758 } |
| 5757 #endif | 5759 #endif |
| 5758 | 5760 |
| 5759 void RenderView::AddErrorToRootConsole(const string16& message) { | 5761 void RenderView::AddErrorToRootConsole(const string16& message) { |
| 5760 if (webview() && webview()->mainFrame()) { | 5762 if (webview() && webview()->mainFrame()) { |
| 5761 webview()->mainFrame()->addMessageToConsole( | 5763 webview()->mainFrame()->addMessageToConsole( |
| 5762 WebConsoleMessage(WebConsoleMessage::LevelError, message)); | 5764 WebConsoleMessage(WebConsoleMessage::LevelError, message)); |
| 5763 } | 5765 } |
| 5764 } | 5766 } |
| OLD | NEW |