Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Side by Side Diff: chrome/renderer/render_view.cc

Issue 5996003: Revert "Revert 69755 - Move the NPAPI files from webkit/glue/plugins to webkit/plugins/npapi" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/renderer/render_view.h ('k') | chrome/renderer/render_widget.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 #include "webkit/glue/alt_error_page_resource_fetcher.h" 165 #include "webkit/glue/alt_error_page_resource_fetcher.h"
166 #include "webkit/glue/context_menu.h" 166 #include "webkit/glue/context_menu.h"
167 #include "webkit/glue/dom_operations.h" 167 #include "webkit/glue/dom_operations.h"
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/video_renderer_impl.h" 173 #include "webkit/glue/media/video_renderer_impl.h"
174 #include "webkit/glue/password_form_dom_manager.h" 174 #include "webkit/glue/password_form_dom_manager.h"
175 #include "webkit/glue/plugins/default_plugin_shared.h"
176 #include "webkit/glue/plugins/plugin_list.h"
177 #include "webkit/glue/plugins/webplugin_delegate.h"
178 #include "webkit/glue/plugins/webplugin_delegate_impl.h"
179 #include "webkit/glue/plugins/webplugin_impl.h"
180 #include "webkit/glue/plugins/webview_plugin.h"
181 #include "webkit/glue/resource_fetcher.h" 175 #include "webkit/glue/resource_fetcher.h"
182 #include "webkit/glue/site_isolation_metrics.h" 176 #include "webkit/glue/site_isolation_metrics.h"
183 #include "webkit/glue/webaccessibility.h" 177 #include "webkit/glue/webaccessibility.h"
184 #include "webkit/glue/webdropdata.h" 178 #include "webkit/glue/webdropdata.h"
185 #include "webkit/glue/webkit_glue.h" 179 #include "webkit/glue/webkit_glue.h"
186 #include "webkit/glue/webmediaplayer_impl.h" 180 #include "webkit/glue/webmediaplayer_impl.h"
181 #include "webkit/plugins/npapi/default_plugin_shared.h"
182 #include "webkit/plugins/npapi/plugin_list.h"
183 #include "webkit/plugins/npapi/webplugin_delegate.h"
184 #include "webkit/plugins/npapi/webplugin_delegate_impl.h"
185 #include "webkit/plugins/npapi/webplugin_impl.h"
186 #include "webkit/plugins/npapi/webview_plugin.h"
187 #include "webkit/plugins/ppapi/ppapi_webplugin_impl.h" 187 #include "webkit/plugins/ppapi/ppapi_webplugin_impl.h"
188 188
189 #if defined(OS_WIN) 189 #if defined(OS_WIN)
190 // TODO(port): these files are currently Windows only because they concern: 190 // TODO(port): these files are currently Windows only because they concern:
191 // * theming 191 // * theming
192 #include "gfx/native_theme_win.h" 192 #include "gfx/native_theme_win.h"
193 #elif defined(USE_X11) 193 #elif defined(USE_X11)
194 #include "gfx/native_theme_linux.h" 194 #include "gfx/native_theme_linux.h"
195 #include "third_party/WebKit/WebKit/chromium/public/linux/WebRenderTheme.h" 195 #include "third_party/WebKit/WebKit/chromium/public/linux/WebRenderTheme.h"
196 #elif defined(OS_MACOSX) 196 #elif defined(OS_MACOSX)
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 Send(new ViewHostMsg_InstallApplication(routing_id_, *pending_app_info_)); 835 Send(new ViewHostMsg_InstallApplication(routing_id_, *pending_app_info_));
836 pending_app_info_.reset(NULL); 836 pending_app_info_.reset(NULL);
837 } 837 }
838 838
839 void RenderView::PluginCrashed(const FilePath& plugin_path) { 839 void RenderView::PluginCrashed(const FilePath& plugin_path) {
840 Send(new ViewHostMsg_CrashedPlugin(routing_id_, plugin_path)); 840 Send(new ViewHostMsg_CrashedPlugin(routing_id_, plugin_path));
841 } 841 }
842 842
843 WebPlugin* RenderView::CreatePluginNoCheck(WebFrame* frame, 843 WebPlugin* RenderView::CreatePluginNoCheck(WebFrame* frame,
844 const WebPluginParams& params) { 844 const WebPluginParams& params) {
845 WebPluginInfo info; 845 webkit::npapi::WebPluginInfo info;
846 bool found; 846 bool found;
847 ContentSetting setting; 847 ContentSetting setting;
848 std::string mime_type; 848 std::string mime_type;
849 Send(new ViewHostMsg_GetPluginInfo( 849 Send(new ViewHostMsg_GetPluginInfo(
850 params.url, frame->top()->url(), params.mimeType.utf8(), &found, 850 params.url, frame->top()->url(), params.mimeType.utf8(), &found,
851 &info, &setting, &mime_type)); 851 &info, &setting, &mime_type));
852 if (!found || !info.enabled) 852 if (!found || !info.enabled)
853 return NULL; 853 return NULL;
854 854
855 scoped_refptr<webkit::ppapi::PluginModule> pepper_module( 855 scoped_refptr<webkit::ppapi::PluginModule> pepper_module(
(...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after
2019 &install)); 2019 &install));
2020 return install; 2020 return install;
2021 } 2021 }
2022 2022
2023 void RenderView::OnMissingPluginStatus( 2023 void RenderView::OnMissingPluginStatus(
2024 WebPluginDelegateProxy* delegate, 2024 WebPluginDelegateProxy* delegate,
2025 int status) { 2025 int status) {
2026 #if defined(OS_WIN) 2026 #if defined(OS_WIN)
2027 if (!first_default_plugin_) { 2027 if (!first_default_plugin_) {
2028 // Show the InfoBar for the first available plugin. 2028 // Show the InfoBar for the first available plugin.
2029 if (status == default_plugin::MISSING_PLUGIN_AVAILABLE) { 2029 if (status == webkit::npapi::default_plugin::MISSING_PLUGIN_AVAILABLE) {
2030 first_default_plugin_ = delegate->AsWeakPtr(); 2030 first_default_plugin_ = delegate->AsWeakPtr();
2031 Send(new ViewHostMsg_MissingPluginStatus(routing_id_, status)); 2031 Send(new ViewHostMsg_MissingPluginStatus(routing_id_, status));
2032 } 2032 }
2033 } else { 2033 } else {
2034 // Closes the InfoBar if user clicks on the plugin (instead of the InfoBar) 2034 // Closes the InfoBar if user clicks on the plugin (instead of the InfoBar)
2035 // to start the download/install. 2035 // to start the download/install.
2036 if (status == default_plugin::MISSING_PLUGIN_USER_STARTED_DOWNLOAD) { 2036 if (status ==
2037 webkit::npapi::default_plugin::MISSING_PLUGIN_USER_STARTED_DOWNLOAD) {
2037 Send(new ViewHostMsg_MissingPluginStatus(routing_id_, status)); 2038 Send(new ViewHostMsg_MissingPluginStatus(routing_id_, status));
2038 } 2039 }
2039 } 2040 }
2040 #else 2041 #else
2041 // TODO(port): Implement the infobar that accompanies the default plugin. 2042 // TODO(port): Implement the infobar that accompanies the default plugin.
2042 // Linux: http://crbug.com/10952 2043 // Linux: http://crbug.com/10952
2043 // Mac: http://crbug.com/17392 2044 // Mac: http://crbug.com/17392
2044 NOTIMPLEMENTED(); 2045 NOTIMPLEMENTED();
2045 #endif 2046 #endif
2046 } 2047 }
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
2747 SendAndRunNestedMessageLoop(new ViewHostMsg_RunModal(routing_id_)); 2748 SendAndRunNestedMessageLoop(new ViewHostMsg_RunModal(routing_id_));
2748 } 2749 }
2749 2750
2750 // WebKit::WebFrameClient ----------------------------------------------------- 2751 // WebKit::WebFrameClient -----------------------------------------------------
2751 2752
2752 WebPlugin* RenderView::createPlugin(WebFrame* frame, 2753 WebPlugin* RenderView::createPlugin(WebFrame* frame,
2753 const WebPluginParams& params) { 2754 const WebPluginParams& params) {
2754 bool found = false; 2755 bool found = false;
2755 ContentSetting plugin_setting = CONTENT_SETTING_DEFAULT; 2756 ContentSetting plugin_setting = CONTENT_SETTING_DEFAULT;
2756 CommandLine* cmd = CommandLine::ForCurrentProcess(); 2757 CommandLine* cmd = CommandLine::ForCurrentProcess();
2757 WebPluginInfo info; 2758 webkit::npapi::WebPluginInfo info;
2758 GURL url(params.url); 2759 GURL url(params.url);
2759 std::string actual_mime_type; 2760 std::string actual_mime_type;
2760 Send(new ViewHostMsg_GetPluginInfo(url, 2761 Send(new ViewHostMsg_GetPluginInfo(url,
2761 frame->top()->url(), 2762 frame->top()->url(),
2762 params.mimeType.utf8(), 2763 params.mimeType.utf8(),
2763 &found, 2764 &found,
2764 &info, 2765 &info,
2765 &plugin_setting, 2766 &plugin_setting,
2766 &actual_mime_type)); 2767 &actual_mime_type));
2767 2768
2768 if (!found) 2769 if (!found)
2769 return NULL; 2770 return NULL;
2770 DCHECK(plugin_setting != CONTENT_SETTING_DEFAULT); 2771 DCHECK(plugin_setting != CONTENT_SETTING_DEFAULT);
2771 2772
2772 const PluginGroup* group = 2773 const webkit::npapi::PluginGroup* group =
2773 NPAPI::PluginList::Singleton()->GetPluginGroup(info); 2774 webkit::npapi::PluginList::Singleton()->GetPluginGroup(info);
2774 DCHECK(group != NULL); 2775 DCHECK(group != NULL);
2775 2776
2776 if (cmd->HasSwitch(switches::kBlockOutdatedPlugins) && 2777 if (cmd->HasSwitch(switches::kBlockOutdatedPlugins) &&
2777 group->IsVulnerable()) { 2778 group->IsVulnerable()) {
2778 Send(new ViewHostMsg_BlockedOutdatedPlugin(routing_id_, 2779 Send(new ViewHostMsg_BlockedOutdatedPlugin(routing_id_,
2779 group->GetGroupName(), 2780 group->GetGroupName(),
2780 GURL(group->GetUpdateURL()))); 2781 GURL(group->GetUpdateURL())));
2781 return CreatePluginPlaceholder(frame, 2782 return CreatePluginPlaceholder(frame,
2782 params, 2783 params,
2783 *group, 2784 *group,
2784 IDR_BLOCKED_PLUGIN_HTML, 2785 IDR_BLOCKED_PLUGIN_HTML,
2785 IDS_PLUGIN_OUTDATED); 2786 IDS_PLUGIN_OUTDATED);
2786 } 2787 }
2787 if (!info.enabled) 2788 if (!info.enabled)
2788 return NULL; 2789 return NULL;
2789 2790
2790 ContentSetting host_setting = 2791 ContentSetting host_setting =
2791 current_content_settings_.settings[CONTENT_SETTINGS_TYPE_PLUGINS]; 2792 current_content_settings_.settings[CONTENT_SETTINGS_TYPE_PLUGINS];
2792 if (info.path.value() == kDefaultPluginLibraryName || 2793 if (info.path.value() == webkit::npapi::kDefaultPluginLibraryName ||
2793 plugin_setting == CONTENT_SETTING_ALLOW || 2794 plugin_setting == CONTENT_SETTING_ALLOW ||
2794 host_setting == CONTENT_SETTING_ALLOW) { 2795 host_setting == CONTENT_SETTING_ALLOW) {
2795 scoped_refptr<webkit::ppapi::PluginModule> pepper_module( 2796 scoped_refptr<webkit::ppapi::PluginModule> pepper_module(
2796 pepper_delegate_.CreatePepperPlugin(info.path)); 2797 pepper_delegate_.CreatePepperPlugin(info.path));
2797 if (pepper_module) 2798 if (pepper_module)
2798 return CreatePepperPlugin(frame, params, info.path, pepper_module.get()); 2799 return CreatePepperPlugin(frame, params, info.path, pepper_module.get());
2799 return CreateNPAPIPlugin(frame, params, info.path, actual_mime_type); 2800 return CreateNPAPIPlugin(frame, params, info.path, actual_mime_type);
2800 } 2801 }
2801 std::string resource; 2802 std::string resource;
2802 if (cmd->HasSwitch(switches::kEnableResourceContentSettings)) 2803 if (cmd->HasSwitch(switches::kEnableResourceContentSettings))
(...skipping 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after
3932 return; 3933 return;
3933 } 3934 }
3934 3935
3935 ChildThread::current()->file_system_dispatcher()->OpenFileSystem( 3936 ChildThread::current()->file_system_dispatcher()->OpenFileSystem(
3936 GURL(origin.toString()), static_cast<fileapi::FileSystemType>(type), 3937 GURL(origin.toString()), static_cast<fileapi::FileSystemType>(type),
3937 size, create, new WebFileSystemCallbackDispatcher(callbacks)); 3938 size, create, new WebFileSystemCallbackDispatcher(callbacks));
3938 } 3939 }
3939 3940
3940 // webkit_glue::WebPluginPageDelegate ----------------------------------------- 3941 // webkit_glue::WebPluginPageDelegate -----------------------------------------
3941 3942
3942 webkit_glue::WebPluginDelegate* RenderView::CreatePluginDelegate( 3943 webkit::npapi::WebPluginDelegate* RenderView::CreatePluginDelegate(
3943 const FilePath& file_path, 3944 const FilePath& file_path,
3944 const std::string& mime_type) { 3945 const std::string& mime_type) {
3945 if (!PluginChannelHost::IsListening()) 3946 if (!PluginChannelHost::IsListening())
3946 return NULL; 3947 return NULL;
3947 3948
3948 bool use_pepper_host = false; 3949 bool use_pepper_host = false;
3949 bool in_process_plugin = RenderProcess::current()->UseInProcessPlugins(); 3950 bool in_process_plugin = RenderProcess::current()->UseInProcessPlugins();
3950 // Check for trusted Pepper plugins. 3951 // Check for trusted Pepper plugins.
3951 const char kPepperPrefix[] = "pepper-"; 3952 const char kPepperPrefix[] = "pepper-";
3952 if (StartsWithASCII(mime_type, kPepperPrefix, true)) { 3953 if (StartsWithASCII(mime_type, kPepperPrefix, true)) {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
4000 if (use_pepper_host) { 4001 if (use_pepper_host) {
4001 WebPluginDelegatePepper* pepper_plugin = 4002 WebPluginDelegatePepper* pepper_plugin =
4002 WebPluginDelegatePepper::Create(file_path, mime_type, AsWeakPtr()); 4003 WebPluginDelegatePepper::Create(file_path, mime_type, AsWeakPtr());
4003 if (!pepper_plugin) 4004 if (!pepper_plugin)
4004 return NULL; 4005 return NULL;
4005 4006
4006 current_oldstyle_pepper_plugins_.insert(pepper_plugin); 4007 current_oldstyle_pepper_plugins_.insert(pepper_plugin);
4007 return pepper_plugin; 4008 return pepper_plugin;
4008 } else { 4009 } else {
4009 #if defined(OS_WIN) // In-proc plugins aren't supported on Linux or Mac. 4010 #if defined(OS_WIN) // In-proc plugins aren't supported on Linux or Mac.
4010 return WebPluginDelegateImpl::Create( 4011 return webkit::npapi::WebPluginDelegateImpl::Create(
4011 file_path, mime_type, gfx::NativeViewFromId(host_window_)); 4012 file_path, mime_type, gfx::NativeViewFromId(host_window_));
4012 #else 4013 #else
4013 NOTIMPLEMENTED(); 4014 NOTIMPLEMENTED();
4014 return NULL; 4015 return NULL;
4015 #endif 4016 #endif
4016 } 4017 }
4017 } 4018 }
4018 4019
4019 return new WebPluginDelegateProxy(mime_type, AsWeakPtr()); 4020 return new WebPluginDelegateProxy(mime_type, AsWeakPtr());
4020 } 4021 }
4021 4022
4022 void RenderView::CreatedPluginWindow(gfx::PluginWindowHandle window) { 4023 void RenderView::CreatedPluginWindow(gfx::PluginWindowHandle window) {
4023 #if defined(USE_X11) 4024 #if defined(USE_X11)
4024 RenderThread::current()->Send(new ViewHostMsg_CreatePluginContainer( 4025 RenderThread::current()->Send(new ViewHostMsg_CreatePluginContainer(
4025 routing_id(), window)); 4026 routing_id(), window));
4026 #endif 4027 #endif
4027 } 4028 }
4028 4029
4029 void RenderView::WillDestroyPluginWindow(gfx::PluginWindowHandle window) { 4030 void RenderView::WillDestroyPluginWindow(gfx::PluginWindowHandle window) {
4030 #if defined(USE_X11) 4031 #if defined(USE_X11)
4031 RenderThread::current()->Send(new ViewHostMsg_DestroyPluginContainer( 4032 RenderThread::current()->Send(new ViewHostMsg_DestroyPluginContainer(
4032 routing_id(), window)); 4033 routing_id(), window));
4033 #endif 4034 #endif
4034 CleanupWindowInPluginMoves(window); 4035 CleanupWindowInPluginMoves(window);
4035 } 4036 }
4036 4037
4037 void RenderView::DidMovePlugin(const webkit_glue::WebPluginGeometry& move) { 4038 void RenderView::DidMovePlugin(const webkit::npapi::WebPluginGeometry& move) {
4038 SchedulePluginMove(move); 4039 SchedulePluginMove(move);
4039 } 4040 }
4040 4041
4041 void RenderView::DidStartLoadingForPlugin() { 4042 void RenderView::DidStartLoadingForPlugin() {
4042 // TODO(darin): Make is_loading_ be a counter! 4043 // TODO(darin): Make is_loading_ be a counter!
4043 didStartLoading(); 4044 didStartLoading();
4044 } 4045 }
4045 4046
4046 void RenderView::DidStopLoadingForPlugin() { 4047 void RenderView::DidStopLoadingForPlugin() {
4047 // TODO(darin): Make is_loading_ be a counter! 4048 // TODO(darin): Make is_loading_ be a counter!
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
4429 4430
4430 WebPlugin* RenderView::CreatePepperPlugin( 4431 WebPlugin* RenderView::CreatePepperPlugin(
4431 WebFrame* frame, 4432 WebFrame* frame,
4432 const WebPluginParams& params, 4433 const WebPluginParams& params,
4433 const FilePath& path, 4434 const FilePath& path,
4434 webkit::ppapi::PluginModule* pepper_module) { 4435 webkit::ppapi::PluginModule* pepper_module) {
4435 return new webkit::ppapi::WebPluginImpl( 4436 return new webkit::ppapi::WebPluginImpl(
4436 pepper_module, params, pepper_delegate_.AsWeakPtr()); 4437 pepper_module, params, pepper_delegate_.AsWeakPtr());
4437 } 4438 }
4438 4439
4439 WebPlugin* RenderView::CreateNPAPIPlugin(WebFrame* frame, 4440 WebPlugin* RenderView::CreateNPAPIPlugin(
4440 const WebPluginParams& params, 4441 WebFrame* frame,
4441 const FilePath& path, 4442 const WebPluginParams& params,
4442 const std::string& mime_type) { 4443 const FilePath& path,
4443 return new webkit_glue::WebPluginImpl( 4444 const std::string& mime_type) {
4445 return new webkit::npapi::WebPluginImpl(
4444 frame, params, path, mime_type, AsWeakPtr()); 4446 frame, params, path, mime_type, AsWeakPtr());
4445 } 4447 }
4446 4448
4447 WebPlugin* RenderView::CreatePluginPlaceholder( 4449 WebPlugin* RenderView::CreatePluginPlaceholder(
4448 WebFrame* frame, 4450 WebFrame* frame,
4449 const WebPluginParams& params, 4451 const WebPluginParams& params,
4450 const PluginGroup& group, 4452 const webkit::npapi::PluginGroup& group,
4451 int resource_id, 4453 int resource_id,
4452 int message_id) { 4454 int message_id) {
4453 // |blocked_plugin| will delete itself when the WebViewPlugin 4455 // |blocked_plugin| will delete itself when the WebViewPlugin
4454 // is destroyed. 4456 // is destroyed.
4455 BlockedPlugin* blocked_plugin = 4457 BlockedPlugin* blocked_plugin =
4456 new BlockedPlugin(this, 4458 new BlockedPlugin(this,
4457 frame, 4459 frame,
4458 group, 4460 group,
4459 params, 4461 params,
4460 webkit_preferences_, 4462 webkit_preferences_,
(...skipping 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after
5753 external_popup_menu_.reset(); 5755 external_popup_menu_.reset();
5754 } 5756 }
5755 #endif 5757 #endif
5756 5758
5757 void RenderView::AddErrorToRootConsole(const string16& message) { 5759 void RenderView::AddErrorToRootConsole(const string16& message) {
5758 if (webview() && webview()->mainFrame()) { 5760 if (webview() && webview()->mainFrame()) {
5759 webview()->mainFrame()->addMessageToConsole( 5761 webview()->mainFrame()->addMessageToConsole(
5760 WebConsoleMessage(WebConsoleMessage::LevelError, message)); 5762 WebConsoleMessage(WebConsoleMessage::LevelError, message));
5761 } 5763 }
5762 } 5764 }
OLDNEW
« no previous file with comments | « chrome/renderer/render_view.h ('k') | chrome/renderer/render_widget.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698