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

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

Issue 5998002: Revert "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"
175 #include "webkit/glue/resource_fetcher.h" 181 #include "webkit/glue/resource_fetcher.h"
176 #include "webkit/glue/site_isolation_metrics.h" 182 #include "webkit/glue/site_isolation_metrics.h"
177 #include "webkit/glue/webaccessibility.h" 183 #include "webkit/glue/webaccessibility.h"
178 #include "webkit/glue/webdropdata.h" 184 #include "webkit/glue/webdropdata.h"
179 #include "webkit/glue/webkit_glue.h" 185 #include "webkit/glue/webkit_glue.h"
180 #include "webkit/glue/webmediaplayer_impl.h" 186 #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 webkit::npapi::WebPluginInfo info; 845 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 == webkit::npapi::default_plugin::MISSING_PLUGIN_AVAILABLE) { 2029 if (status == 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 == 2036 if (status == default_plugin::MISSING_PLUGIN_USER_STARTED_DOWNLOAD) {
2037 webkit::npapi::default_plugin::MISSING_PLUGIN_USER_STARTED_DOWNLOAD) {
2038 Send(new ViewHostMsg_MissingPluginStatus(routing_id_, status)); 2037 Send(new ViewHostMsg_MissingPluginStatus(routing_id_, status));
2039 } 2038 }
2040 } 2039 }
2041 #else 2040 #else
2042 // TODO(port): Implement the infobar that accompanies the default plugin. 2041 // TODO(port): Implement the infobar that accompanies the default plugin.
2043 // Linux: http://crbug.com/10952 2042 // Linux: http://crbug.com/10952
2044 // Mac: http://crbug.com/17392 2043 // Mac: http://crbug.com/17392
2045 NOTIMPLEMENTED(); 2044 NOTIMPLEMENTED();
2046 #endif 2045 #endif
2047 } 2046 }
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
2748 SendAndRunNestedMessageLoop(new ViewHostMsg_RunModal(routing_id_)); 2747 SendAndRunNestedMessageLoop(new ViewHostMsg_RunModal(routing_id_));
2749 } 2748 }
2750 2749
2751 // WebKit::WebFrameClient ----------------------------------------------------- 2750 // WebKit::WebFrameClient -----------------------------------------------------
2752 2751
2753 WebPlugin* RenderView::createPlugin(WebFrame* frame, 2752 WebPlugin* RenderView::createPlugin(WebFrame* frame,
2754 const WebPluginParams& params) { 2753 const WebPluginParams& params) {
2755 bool found = false; 2754 bool found = false;
2756 ContentSetting plugin_setting = CONTENT_SETTING_DEFAULT; 2755 ContentSetting plugin_setting = CONTENT_SETTING_DEFAULT;
2757 CommandLine* cmd = CommandLine::ForCurrentProcess(); 2756 CommandLine* cmd = CommandLine::ForCurrentProcess();
2758 webkit::npapi::WebPluginInfo info; 2757 WebPluginInfo info;
2759 GURL url(params.url); 2758 GURL url(params.url);
2760 std::string actual_mime_type; 2759 std::string actual_mime_type;
2761 Send(new ViewHostMsg_GetPluginInfo(url, 2760 Send(new ViewHostMsg_GetPluginInfo(url,
2762 frame->top()->url(), 2761 frame->top()->url(),
2763 params.mimeType.utf8(), 2762 params.mimeType.utf8(),
2764 &found, 2763 &found,
2765 &info, 2764 &info,
2766 &plugin_setting, 2765 &plugin_setting,
2767 &actual_mime_type)); 2766 &actual_mime_type));
2768 2767
2769 if (!found) 2768 if (!found)
2770 return NULL; 2769 return NULL;
2771 DCHECK(plugin_setting != CONTENT_SETTING_DEFAULT); 2770 DCHECK(plugin_setting != CONTENT_SETTING_DEFAULT);
2772 2771
2773 const webkit::npapi::PluginGroup* group = 2772 const PluginGroup* group =
2774 webkit::npapi::PluginList::Singleton()->GetPluginGroup(info); 2773 NPAPI::PluginList::Singleton()->GetPluginGroup(info);
2775 DCHECK(group != NULL); 2774 DCHECK(group != NULL);
2776 2775
2777 if (cmd->HasSwitch(switches::kBlockOutdatedPlugins) && 2776 if (cmd->HasSwitch(switches::kBlockOutdatedPlugins) &&
2778 group->IsVulnerable()) { 2777 group->IsVulnerable()) {
2779 Send(new ViewHostMsg_BlockedOutdatedPlugin(routing_id_, 2778 Send(new ViewHostMsg_BlockedOutdatedPlugin(routing_id_,
2780 group->GetGroupName(), 2779 group->GetGroupName(),
2781 GURL(group->GetUpdateURL()))); 2780 GURL(group->GetUpdateURL())));
2782 return CreatePluginPlaceholder(frame, 2781 return CreatePluginPlaceholder(frame,
2783 params, 2782 params,
2784 *group, 2783 *group,
2785 IDR_BLOCKED_PLUGIN_HTML, 2784 IDR_BLOCKED_PLUGIN_HTML,
2786 IDS_PLUGIN_OUTDATED); 2785 IDS_PLUGIN_OUTDATED);
2787 } 2786 }
2788 if (!info.enabled) 2787 if (!info.enabled)
2789 return NULL; 2788 return NULL;
2790 2789
2791 ContentSetting host_setting = 2790 ContentSetting host_setting =
2792 current_content_settings_.settings[CONTENT_SETTINGS_TYPE_PLUGINS]; 2791 current_content_settings_.settings[CONTENT_SETTINGS_TYPE_PLUGINS];
2793 if (info.path.value() == webkit::npapi::kDefaultPluginLibraryName || 2792 if (info.path.value() == kDefaultPluginLibraryName ||
2794 plugin_setting == CONTENT_SETTING_ALLOW || 2793 plugin_setting == CONTENT_SETTING_ALLOW ||
2795 host_setting == CONTENT_SETTING_ALLOW) { 2794 host_setting == CONTENT_SETTING_ALLOW) {
2796 scoped_refptr<webkit::ppapi::PluginModule> pepper_module( 2795 scoped_refptr<webkit::ppapi::PluginModule> pepper_module(
2797 pepper_delegate_.CreatePepperPlugin(info.path)); 2796 pepper_delegate_.CreatePepperPlugin(info.path));
2798 if (pepper_module) 2797 if (pepper_module)
2799 return CreatePepperPlugin(frame, params, info.path, pepper_module.get()); 2798 return CreatePepperPlugin(frame, params, info.path, pepper_module.get());
2800 return CreateNPAPIPlugin(frame, params, info.path, actual_mime_type); 2799 return CreateNPAPIPlugin(frame, params, info.path, actual_mime_type);
2801 } 2800 }
2802 std::string resource; 2801 std::string resource;
2803 if (cmd->HasSwitch(switches::kEnableResourceContentSettings)) 2802 if (cmd->HasSwitch(switches::kEnableResourceContentSettings))
(...skipping 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after
3933 return; 3932 return;
3934 } 3933 }
3935 3934
3936 ChildThread::current()->file_system_dispatcher()->OpenFileSystem( 3935 ChildThread::current()->file_system_dispatcher()->OpenFileSystem(
3937 GURL(origin.toString()), static_cast<fileapi::FileSystemType>(type), 3936 GURL(origin.toString()), static_cast<fileapi::FileSystemType>(type),
3938 size, create, new WebFileSystemCallbackDispatcher(callbacks)); 3937 size, create, new WebFileSystemCallbackDispatcher(callbacks));
3939 } 3938 }
3940 3939
3941 // webkit_glue::WebPluginPageDelegate ----------------------------------------- 3940 // webkit_glue::WebPluginPageDelegate -----------------------------------------
3942 3941
3943 webkit::npapi::WebPluginDelegate* RenderView::CreatePluginDelegate( 3942 webkit_glue::WebPluginDelegate* RenderView::CreatePluginDelegate(
3944 const FilePath& file_path, 3943 const FilePath& file_path,
3945 const std::string& mime_type) { 3944 const std::string& mime_type) {
3946 if (!PluginChannelHost::IsListening()) 3945 if (!PluginChannelHost::IsListening())
3947 return NULL; 3946 return NULL;
3948 3947
3949 bool use_pepper_host = false; 3948 bool use_pepper_host = false;
3950 bool in_process_plugin = RenderProcess::current()->UseInProcessPlugins(); 3949 bool in_process_plugin = RenderProcess::current()->UseInProcessPlugins();
3951 // Check for trusted Pepper plugins. 3950 // Check for trusted Pepper plugins.
3952 const char kPepperPrefix[] = "pepper-"; 3951 const char kPepperPrefix[] = "pepper-";
3953 if (StartsWithASCII(mime_type, kPepperPrefix, true)) { 3952 if (StartsWithASCII(mime_type, kPepperPrefix, true)) {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
4001 if (use_pepper_host) { 4000 if (use_pepper_host) {
4002 WebPluginDelegatePepper* pepper_plugin = 4001 WebPluginDelegatePepper* pepper_plugin =
4003 WebPluginDelegatePepper::Create(file_path, mime_type, AsWeakPtr()); 4002 WebPluginDelegatePepper::Create(file_path, mime_type, AsWeakPtr());
4004 if (!pepper_plugin) 4003 if (!pepper_plugin)
4005 return NULL; 4004 return NULL;
4006 4005
4007 current_oldstyle_pepper_plugins_.insert(pepper_plugin); 4006 current_oldstyle_pepper_plugins_.insert(pepper_plugin);
4008 return pepper_plugin; 4007 return pepper_plugin;
4009 } else { 4008 } else {
4010 #if defined(OS_WIN) // In-proc plugins aren't supported on Linux or Mac. 4009 #if defined(OS_WIN) // In-proc plugins aren't supported on Linux or Mac.
4011 return webkit::npapi::WebPluginDelegateImpl::Create( 4010 return WebPluginDelegateImpl::Create(
4012 file_path, mime_type, gfx::NativeViewFromId(host_window_)); 4011 file_path, mime_type, gfx::NativeViewFromId(host_window_));
4013 #else 4012 #else
4014 NOTIMPLEMENTED(); 4013 NOTIMPLEMENTED();
4015 return NULL; 4014 return NULL;
4016 #endif 4015 #endif
4017 } 4016 }
4018 } 4017 }
4019 4018
4020 return new WebPluginDelegateProxy(mime_type, AsWeakPtr()); 4019 return new WebPluginDelegateProxy(mime_type, AsWeakPtr());
4021 } 4020 }
4022 4021
4023 void RenderView::CreatedPluginWindow(gfx::PluginWindowHandle window) { 4022 void RenderView::CreatedPluginWindow(gfx::PluginWindowHandle window) {
4024 #if defined(USE_X11) 4023 #if defined(USE_X11)
4025 RenderThread::current()->Send(new ViewHostMsg_CreatePluginContainer( 4024 RenderThread::current()->Send(new ViewHostMsg_CreatePluginContainer(
4026 routing_id(), window)); 4025 routing_id(), window));
4027 #endif 4026 #endif
4028 } 4027 }
4029 4028
4030 void RenderView::WillDestroyPluginWindow(gfx::PluginWindowHandle window) { 4029 void RenderView::WillDestroyPluginWindow(gfx::PluginWindowHandle window) {
4031 #if defined(USE_X11) 4030 #if defined(USE_X11)
4032 RenderThread::current()->Send(new ViewHostMsg_DestroyPluginContainer( 4031 RenderThread::current()->Send(new ViewHostMsg_DestroyPluginContainer(
4033 routing_id(), window)); 4032 routing_id(), window));
4034 #endif 4033 #endif
4035 CleanupWindowInPluginMoves(window); 4034 CleanupWindowInPluginMoves(window);
4036 } 4035 }
4037 4036
4038 void RenderView::DidMovePlugin(const webkit::npapi::WebPluginGeometry& move) { 4037 void RenderView::DidMovePlugin(const webkit_glue::WebPluginGeometry& move) {
4039 SchedulePluginMove(move); 4038 SchedulePluginMove(move);
4040 } 4039 }
4041 4040
4042 void RenderView::DidStartLoadingForPlugin() { 4041 void RenderView::DidStartLoadingForPlugin() {
4043 // TODO(darin): Make is_loading_ be a counter! 4042 // TODO(darin): Make is_loading_ be a counter!
4044 didStartLoading(); 4043 didStartLoading();
4045 } 4044 }
4046 4045
4047 void RenderView::DidStopLoadingForPlugin() { 4046 void RenderView::DidStopLoadingForPlugin() {
4048 // TODO(darin): Make is_loading_ be a counter! 4047 // TODO(darin): Make is_loading_ be a counter!
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
4430 4429
4431 WebPlugin* RenderView::CreatePepperPlugin( 4430 WebPlugin* RenderView::CreatePepperPlugin(
4432 WebFrame* frame, 4431 WebFrame* frame,
4433 const WebPluginParams& params, 4432 const WebPluginParams& params,
4434 const FilePath& path, 4433 const FilePath& path,
4435 webkit::ppapi::PluginModule* pepper_module) { 4434 webkit::ppapi::PluginModule* pepper_module) {
4436 return new webkit::ppapi::WebPluginImpl( 4435 return new webkit::ppapi::WebPluginImpl(
4437 pepper_module, params, pepper_delegate_.AsWeakPtr()); 4436 pepper_module, params, pepper_delegate_.AsWeakPtr());
4438 } 4437 }
4439 4438
4440 WebPlugin* RenderView::CreateNPAPIPlugin( 4439 WebPlugin* RenderView::CreateNPAPIPlugin(WebFrame* frame,
4441 WebFrame* frame, 4440 const WebPluginParams& params,
4442 const WebPluginParams& params, 4441 const FilePath& path,
4443 const FilePath& path, 4442 const std::string& mime_type) {
4444 const std::string& mime_type) { 4443 return new webkit_glue::WebPluginImpl(
4445 return new webkit::npapi::WebPluginImpl(
4446 frame, params, path, mime_type, AsWeakPtr()); 4444 frame, params, path, mime_type, AsWeakPtr());
4447 } 4445 }
4448 4446
4449 WebPlugin* RenderView::CreatePluginPlaceholder( 4447 WebPlugin* RenderView::CreatePluginPlaceholder(
4450 WebFrame* frame, 4448 WebFrame* frame,
4451 const WebPluginParams& params, 4449 const WebPluginParams& params,
4452 const webkit::npapi::PluginGroup& group, 4450 const PluginGroup& group,
4453 int resource_id, 4451 int resource_id,
4454 int message_id) { 4452 int message_id) {
4455 // |blocked_plugin| will delete itself when the WebViewPlugin 4453 // |blocked_plugin| will delete itself when the WebViewPlugin
4456 // is destroyed. 4454 // is destroyed.
4457 BlockedPlugin* blocked_plugin = 4455 BlockedPlugin* blocked_plugin =
4458 new BlockedPlugin(this, 4456 new BlockedPlugin(this,
4459 frame, 4457 frame,
4460 group, 4458 group,
4461 params, 4459 params,
4462 webkit_preferences_, 4460 webkit_preferences_,
(...skipping 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after
5755 external_popup_menu_.reset(); 5753 external_popup_menu_.reset();
5756 } 5754 }
5757 #endif 5755 #endif
5758 5756
5759 void RenderView::AddErrorToRootConsole(const string16& message) { 5757 void RenderView::AddErrorToRootConsole(const string16& message) {
5760 if (webview() && webview()->mainFrame()) { 5758 if (webview() && webview()->mainFrame()) {
5761 webview()->mainFrame()->addMessageToConsole( 5759 webview()->mainFrame()->addMessageToConsole(
5762 WebConsoleMessage(WebConsoleMessage::LevelError, message)); 5760 WebConsoleMessage(WebConsoleMessage::LevelError, message));
5763 } 5761 }
5764 } 5762 }
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