| 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 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 838 WebPluginInfo info; | 838 WebPluginInfo info; |
| 839 bool found; | 839 bool found; |
| 840 ContentSetting setting; | 840 ContentSetting setting; |
| 841 std::string mime_type; | 841 std::string mime_type; |
| 842 Send(new ViewHostMsg_GetPluginInfo( | 842 Send(new ViewHostMsg_GetPluginInfo( |
| 843 params.url, frame->top()->url(), params.mimeType.utf8(), &found, | 843 params.url, frame->top()->url(), params.mimeType.utf8(), &found, |
| 844 &info, &setting, &mime_type)); | 844 &info, &setting, &mime_type)); |
| 845 if (!found || !info.enabled) | 845 if (!found || !info.enabled) |
| 846 return NULL; | 846 return NULL; |
| 847 | 847 |
| 848 scoped_refptr<pepper::PluginModule> pepper_module( | 848 scoped_refptr<webkit::ppapi::PluginModule> pepper_module( |
| 849 pepper_delegate_.CreatePepperPlugin(info.path)); | 849 pepper_delegate_.CreatePepperPlugin(info.path)); |
| 850 if (pepper_module) | 850 if (pepper_module) |
| 851 return CreatePepperPlugin(frame, params, info.path, pepper_module.get()); | 851 return CreatePepperPlugin(frame, params, info.path, pepper_module.get()); |
| 852 return CreateNPAPIPlugin(frame, params, info.path, mime_type); | 852 return CreateNPAPIPlugin(frame, params, info.path, mime_type); |
| 853 } | 853 } |
| 854 | 854 |
| 855 void RenderView::CustomMenuListenerInstall(CustomMenuListener* listening) { | 855 void RenderView::CustomMenuListenerInstall(CustomMenuListener* listening) { |
| 856 custom_menu_listener_ = listening; | 856 custom_menu_listener_ = listening; |
| 857 } | 857 } |
| 858 | 858 |
| (...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2121 return external_popup_menu_.get(); | 2121 return external_popup_menu_.get(); |
| 2122 } | 2122 } |
| 2123 | 2123 |
| 2124 WebWidget* RenderView::createFullscreenWindow(WebKit::WebPopupType popup_type) { | 2124 WebWidget* RenderView::createFullscreenWindow(WebKit::WebPopupType popup_type) { |
| 2125 RenderWidget* widget = RenderWidgetFullscreen::Create(routing_id_, | 2125 RenderWidget* widget = RenderWidgetFullscreen::Create(routing_id_, |
| 2126 render_thread_, | 2126 render_thread_, |
| 2127 popup_type); | 2127 popup_type); |
| 2128 return widget->webwidget(); | 2128 return widget->webwidget(); |
| 2129 } | 2129 } |
| 2130 | 2130 |
| 2131 pepper::FullscreenContainer* RenderView::CreatePepperFullscreenContainer( | 2131 webkit::ppapi::FullscreenContainer* |
| 2132 pepper::PluginInstance* plugin) { | 2132 RenderView::CreatePepperFullscreenContainer( |
| 2133 webkit::ppapi::PluginInstance* plugin) { |
| 2133 RenderWidgetFullscreenPepper* widget = | 2134 RenderWidgetFullscreenPepper* widget = |
| 2134 RenderWidgetFullscreenPepper::Create(routing_id_, render_thread_, plugin); | 2135 RenderWidgetFullscreenPepper::Create(routing_id_, render_thread_, plugin); |
| 2135 widget->show(WebKit::WebNavigationPolicyIgnore); | 2136 widget->show(WebKit::WebNavigationPolicyIgnore); |
| 2136 return widget->container(); | 2137 return widget->container(); |
| 2137 } | 2138 } |
| 2138 | 2139 |
| 2139 WebStorageNamespace* RenderView::createSessionStorageNamespace(unsigned quota) { | 2140 WebStorageNamespace* RenderView::createSessionStorageNamespace(unsigned quota) { |
| 2140 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)) | 2141 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)) |
| 2141 return WebStorageNamespace::createSessionStorageNamespace(quota); | 2142 return WebStorageNamespace::createSessionStorageNamespace(quota); |
| 2142 CHECK(session_storage_namespace_id_ != kInvalidSessionStorageNamespaceId); | 2143 CHECK(session_storage_namespace_id_ != kInvalidSessionStorageNamespaceId); |
| (...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2774 return CreateOutdatedPluginPlaceholder(frame, params, *group); | 2775 return CreateOutdatedPluginPlaceholder(frame, params, *group); |
| 2775 } | 2776 } |
| 2776 return NULL; | 2777 return NULL; |
| 2777 } | 2778 } |
| 2778 | 2779 |
| 2779 ContentSetting host_setting = | 2780 ContentSetting host_setting = |
| 2780 current_content_settings_.settings[CONTENT_SETTINGS_TYPE_PLUGINS]; | 2781 current_content_settings_.settings[CONTENT_SETTINGS_TYPE_PLUGINS]; |
| 2781 if (info.path.value() == kDefaultPluginLibraryName || | 2782 if (info.path.value() == kDefaultPluginLibraryName || |
| 2782 plugin_setting == CONTENT_SETTING_ALLOW || | 2783 plugin_setting == CONTENT_SETTING_ALLOW || |
| 2783 host_setting == CONTENT_SETTING_ALLOW) { | 2784 host_setting == CONTENT_SETTING_ALLOW) { |
| 2784 scoped_refptr<pepper::PluginModule> pepper_module( | 2785 scoped_refptr<webkit::ppapi::PluginModule> pepper_module( |
| 2785 pepper_delegate_.CreatePepperPlugin(info.path)); | 2786 pepper_delegate_.CreatePepperPlugin(info.path)); |
| 2786 if (pepper_module) | 2787 if (pepper_module) |
| 2787 return CreatePepperPlugin(frame, params, info.path, pepper_module.get()); | 2788 return CreatePepperPlugin(frame, params, info.path, pepper_module.get()); |
| 2788 return CreateNPAPIPlugin(frame, params, info.path, actual_mime_type); | 2789 return CreateNPAPIPlugin(frame, params, info.path, actual_mime_type); |
| 2789 } | 2790 } |
| 2790 std::string resource; | 2791 std::string resource; |
| 2791 if (cmd->HasSwitch(switches::kEnableResourceContentSettings)) | 2792 if (cmd->HasSwitch(switches::kEnableResourceContentSettings)) |
| 2792 resource = group->identifier(); | 2793 resource = group->identifier(); |
| 2793 DidBlockContentType(CONTENT_SETTINGS_TYPE_PLUGINS, resource); | 2794 DidBlockContentType(CONTENT_SETTINGS_TYPE_PLUGINS, resource); |
| 2794 int resource_id; | 2795 int resource_id; |
| (...skipping 1627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4422 Send(new ViewHostMsg_ContentBlocked(routing_id_, settings_type, | 4423 Send(new ViewHostMsg_ContentBlocked(routing_id_, settings_type, |
| 4423 resource_identifier)); | 4424 resource_identifier)); |
| 4424 } | 4425 } |
| 4425 } | 4426 } |
| 4426 | 4427 |
| 4427 void RenderView::ClearBlockedContentSettings() { | 4428 void RenderView::ClearBlockedContentSettings() { |
| 4428 for (size_t i = 0; i < arraysize(content_blocked_); ++i) | 4429 for (size_t i = 0; i < arraysize(content_blocked_); ++i) |
| 4429 content_blocked_[i] = false; | 4430 content_blocked_[i] = false; |
| 4430 } | 4431 } |
| 4431 | 4432 |
| 4432 WebPlugin* RenderView::CreatePepperPlugin(WebFrame* frame, | 4433 WebPlugin* RenderView::CreatePepperPlugin( |
| 4433 const WebPluginParams& params, | 4434 WebFrame* frame, |
| 4434 const FilePath& path, | 4435 const WebPluginParams& params, |
| 4435 pepper::PluginModule* pepper_module) { | 4436 const FilePath& path, |
| 4436 return new pepper::WebPluginImpl( | 4437 webkit::ppapi::PluginModule* pepper_module) { |
| 4438 return new webkit::ppapi::WebPluginImpl( |
| 4437 pepper_module, params, pepper_delegate_.AsWeakPtr()); | 4439 pepper_module, params, pepper_delegate_.AsWeakPtr()); |
| 4438 } | 4440 } |
| 4439 | 4441 |
| 4440 WebPlugin* RenderView::CreateNPAPIPlugin(WebFrame* frame, | 4442 WebPlugin* RenderView::CreateNPAPIPlugin(WebFrame* frame, |
| 4441 const WebPluginParams& params, | 4443 const WebPluginParams& params, |
| 4442 const FilePath& path, | 4444 const FilePath& path, |
| 4443 const std::string& mime_type) { | 4445 const std::string& mime_type) { |
| 4444 return new webkit_glue::WebPluginImpl( | 4446 return new webkit_glue::WebPluginImpl( |
| 4445 frame, params, path, mime_type, AsWeakPtr()); | 4447 frame, params, path, mime_type, AsWeakPtr()); |
| 4446 } | 4448 } |
| (...skipping 1313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5760 external_popup_menu_.reset(); | 5762 external_popup_menu_.reset(); |
| 5761 } | 5763 } |
| 5762 #endif | 5764 #endif |
| 5763 | 5765 |
| 5764 void RenderView::AddErrorToRootConsole(const string16& message) { | 5766 void RenderView::AddErrorToRootConsole(const string16& message) { |
| 5765 if (webview() && webview()->mainFrame()) { | 5767 if (webview() && webview()->mainFrame()) { |
| 5766 webview()->mainFrame()->addMessageToConsole( | 5768 webview()->mainFrame()->addMessageToConsole( |
| 5767 WebConsoleMessage(WebConsoleMessage::LevelError, message)); | 5769 WebConsoleMessage(WebConsoleMessage::LevelError, message)); |
| 5768 } | 5770 } |
| 5769 } | 5771 } |
| OLD | NEW |