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

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

Issue 6012002: Move the NPAPI files from webkit/glue/plugins to webkit/plugins/npapi and put... (Closed) Base URL: svn://chrome-svn/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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
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/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"
178 #include "webkit/glue/plugins/plugin_list.h"
179 #include "webkit/glue/plugins/webplugin_delegate.h"
180 #include "webkit/glue/plugins/webplugin_delegate_impl.h"
181 #include "webkit/glue/plugins/webplugin_impl.h"
182 #include "webkit/glue/plugins/webview_plugin.h"
183 #include "webkit/glue/resource_fetcher.h" 177 #include "webkit/glue/resource_fetcher.h"
184 #include "webkit/glue/site_isolation_metrics.h" 178 #include "webkit/glue/site_isolation_metrics.h"
185 #include "webkit/glue/webaccessibility.h" 179 #include "webkit/glue/webaccessibility.h"
186 #include "webkit/glue/webdropdata.h" 180 #include "webkit/glue/webdropdata.h"
187 #include "webkit/glue/webkit_glue.h" 181 #include "webkit/glue/webkit_glue.h"
188 #include "webkit/glue/webmediaplayer_impl.h" 182 #include "webkit/glue/webmediaplayer_impl.h"
183 #include "webkit/plugins/npapi/default_plugin_shared.h"
184 #include "webkit/plugins/npapi/plugin_list.h"
185 #include "webkit/plugins/npapi/webplugin_delegate.h"
186 #include "webkit/plugins/npapi/webplugin_delegate_impl.h"
187 #include "webkit/plugins/npapi/webplugin_impl.h"
188 #include "webkit/plugins/npapi/webview_plugin.h"
189 #include "webkit/plugins/ppapi/ppapi_webplugin_impl.h" 189 #include "webkit/plugins/ppapi/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)
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 Send(new ViewHostMsg_InstallApplication(routing_id_, *pending_app_info_)); 828 Send(new ViewHostMsg_InstallApplication(routing_id_, *pending_app_info_));
829 pending_app_info_.reset(NULL); 829 pending_app_info_.reset(NULL);
830 } 830 }
831 831
832 void RenderView::PluginCrashed(const FilePath& plugin_path) { 832 void RenderView::PluginCrashed(const FilePath& plugin_path) {
833 Send(new ViewHostMsg_CrashedPlugin(routing_id_, plugin_path)); 833 Send(new ViewHostMsg_CrashedPlugin(routing_id_, plugin_path));
834 } 834 }
835 835
836 WebPlugin* RenderView::CreatePluginNoCheck(WebFrame* frame, 836 WebPlugin* RenderView::CreatePluginNoCheck(WebFrame* frame,
837 const WebPluginParams& params) { 837 const WebPluginParams& params) {
838 WebPluginInfo info; 838 webkit::npapi::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<webkit::ppapi::PluginModule> pepper_module( 848 scoped_refptr<webkit::ppapi::PluginModule> pepper_module(
(...skipping 1891 matching lines...) Expand 10 before | Expand all | Expand 10 after
2740 SendAndRunNestedMessageLoop(new ViewHostMsg_RunModal(routing_id_)); 2740 SendAndRunNestedMessageLoop(new ViewHostMsg_RunModal(routing_id_));
2741 } 2741 }
2742 2742
2743 // WebKit::WebFrameClient ----------------------------------------------------- 2743 // WebKit::WebFrameClient -----------------------------------------------------
2744 2744
2745 WebPlugin* RenderView::createPlugin(WebFrame* frame, 2745 WebPlugin* RenderView::createPlugin(WebFrame* frame,
2746 const WebPluginParams& params) { 2746 const WebPluginParams& params) {
2747 bool found = false; 2747 bool found = false;
2748 ContentSetting plugin_setting = CONTENT_SETTING_DEFAULT; 2748 ContentSetting plugin_setting = CONTENT_SETTING_DEFAULT;
2749 CommandLine* cmd = CommandLine::ForCurrentProcess(); 2749 CommandLine* cmd = CommandLine::ForCurrentProcess();
2750 WebPluginInfo info; 2750 webkit::npapi::WebPluginInfo info;
2751 GURL url(params.url); 2751 GURL url(params.url);
2752 std::string actual_mime_type; 2752 std::string actual_mime_type;
2753 Send(new ViewHostMsg_GetPluginInfo(url, 2753 Send(new ViewHostMsg_GetPluginInfo(url,
2754 frame->top()->url(), 2754 frame->top()->url(),
2755 params.mimeType.utf8(), 2755 params.mimeType.utf8(),
2756 &found, 2756 &found,
2757 &info, 2757 &info,
2758 &plugin_setting, 2758 &plugin_setting,
2759 &actual_mime_type)); 2759 &actual_mime_type));
2760 2760
2761 if (!found) 2761 if (!found)
2762 return NULL; 2762 return NULL;
2763 DCHECK(plugin_setting != CONTENT_SETTING_DEFAULT); 2763 DCHECK(plugin_setting != CONTENT_SETTING_DEFAULT);
2764 2764
2765 const PluginGroup* group = 2765 const webkit::npapi::PluginGroup* group =
2766 NPAPI::PluginList::Singleton()->GetPluginGroup(info); 2766 webkit::npapi::PluginList::Singleton()->GetPluginGroup(info);
2767 DCHECK(group != NULL); 2767 DCHECK(group != NULL);
2768 2768
2769 if (!info.enabled) { 2769 if (!info.enabled) {
2770 if (cmd->HasSwitch(switches::kDisableOutdatedPlugins) && 2770 if (cmd->HasSwitch(switches::kDisableOutdatedPlugins) &&
2771 group->IsVulnerable()) { 2771 group->IsVulnerable()) {
2772 Send(new ViewHostMsg_DisabledOutdatedPlugin(routing_id_, 2772 Send(new ViewHostMsg_DisabledOutdatedPlugin(routing_id_,
2773 group->GetGroupName(), 2773 group->GetGroupName(),
2774 GURL(group->GetUpdateURL()))); 2774 GURL(group->GetUpdateURL())));
2775 return CreateOutdatedPluginPlaceholder(frame, params, *group); 2775 return CreateOutdatedPluginPlaceholder(frame, params, *group);
2776 } 2776 }
2777 return NULL; 2777 return NULL;
2778 } 2778 }
2779 2779
2780 ContentSetting host_setting = 2780 ContentSetting host_setting =
2781 current_content_settings_.settings[CONTENT_SETTINGS_TYPE_PLUGINS]; 2781 current_content_settings_.settings[CONTENT_SETTINGS_TYPE_PLUGINS];
2782 if (info.path.value() == kDefaultPluginLibraryName || 2782 if (info.path.value() == webkit::npapi::kDefaultPluginLibraryName ||
2783 plugin_setting == CONTENT_SETTING_ALLOW || 2783 plugin_setting == CONTENT_SETTING_ALLOW ||
2784 host_setting == CONTENT_SETTING_ALLOW) { 2784 host_setting == CONTENT_SETTING_ALLOW) {
2785 scoped_refptr<webkit::ppapi::PluginModule> pepper_module( 2785 scoped_refptr<webkit::ppapi::PluginModule> pepper_module(
2786 pepper_delegate_.CreatePepperPlugin(info.path)); 2786 pepper_delegate_.CreatePepperPlugin(info.path));
2787 if (pepper_module) 2787 if (pepper_module)
2788 return CreatePepperPlugin(frame, params, info.path, pepper_module.get()); 2788 return CreatePepperPlugin(frame, params, info.path, pepper_module.get());
2789 return CreateNPAPIPlugin(frame, params, info.path, actual_mime_type); 2789 return CreateNPAPIPlugin(frame, params, info.path, actual_mime_type);
2790 } 2790 }
2791 std::string resource; 2791 std::string resource;
2792 if (cmd->HasSwitch(switches::kEnableResourceContentSettings)) 2792 if (cmd->HasSwitch(switches::kEnableResourceContentSettings))
(...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after
3935 return; 3935 return;
3936 } 3936 }
3937 3937
3938 ChildThread::current()->file_system_dispatcher()->OpenFileSystem( 3938 ChildThread::current()->file_system_dispatcher()->OpenFileSystem(
3939 GURL(origin.toString()), static_cast<fileapi::FileSystemType>(type), 3939 GURL(origin.toString()), static_cast<fileapi::FileSystemType>(type),
3940 size, create, new WebFileSystemCallbackDispatcher(callbacks)); 3940 size, create, new WebFileSystemCallbackDispatcher(callbacks));
3941 } 3941 }
3942 3942
3943 // webkit_glue::WebPluginPageDelegate ----------------------------------------- 3943 // webkit_glue::WebPluginPageDelegate -----------------------------------------
3944 3944
3945 webkit_glue::WebPluginDelegate* RenderView::CreatePluginDelegate( 3945 webkit::npapi::WebPluginDelegate* RenderView::CreatePluginDelegate(
3946 const FilePath& file_path, 3946 const FilePath& file_path,
3947 const std::string& mime_type) { 3947 const std::string& mime_type) {
3948 if (!PluginChannelHost::IsListening()) 3948 if (!PluginChannelHost::IsListening())
3949 return NULL; 3949 return NULL;
3950 3950
3951 bool use_pepper_host = false; 3951 bool use_pepper_host = false;
3952 bool in_process_plugin = RenderProcess::current()->UseInProcessPlugins(); 3952 bool in_process_plugin = RenderProcess::current()->UseInProcessPlugins();
3953 // Check for trusted Pepper plugins. 3953 // Check for trusted Pepper plugins.
3954 const char kPepperPrefix[] = "pepper-"; 3954 const char kPepperPrefix[] = "pepper-";
3955 if (StartsWithASCII(mime_type, kPepperPrefix, true)) { 3955 if (StartsWithASCII(mime_type, kPepperPrefix, true)) {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
4030 } 4030 }
4031 4031
4032 void RenderView::WillDestroyPluginWindow(gfx::PluginWindowHandle window) { 4032 void RenderView::WillDestroyPluginWindow(gfx::PluginWindowHandle window) {
4033 #if defined(USE_X11) 4033 #if defined(USE_X11)
4034 RenderThread::current()->Send(new ViewHostMsg_DestroyPluginContainer( 4034 RenderThread::current()->Send(new ViewHostMsg_DestroyPluginContainer(
4035 routing_id(), window)); 4035 routing_id(), window));
4036 #endif 4036 #endif
4037 CleanupWindowInPluginMoves(window); 4037 CleanupWindowInPluginMoves(window);
4038 } 4038 }
4039 4039
4040 void RenderView::DidMovePlugin(const webkit_glue::WebPluginGeometry& move) { 4040 void RenderView::DidMovePlugin(const webkit::npapi::WebPluginGeometry& move) {
4041 SchedulePluginMove(move); 4041 SchedulePluginMove(move);
4042 } 4042 }
4043 4043
4044 void RenderView::DidStartLoadingForPlugin() { 4044 void RenderView::DidStartLoadingForPlugin() {
4045 // TODO(darin): Make is_loading_ be a counter! 4045 // TODO(darin): Make is_loading_ be a counter!
4046 didStartLoading(); 4046 didStartLoading();
4047 } 4047 }
4048 4048
4049 void RenderView::DidStopLoadingForPlugin() { 4049 void RenderView::DidStopLoadingForPlugin() {
4050 // TODO(darin): Make is_loading_ be a counter! 4050 // TODO(darin): Make is_loading_ be a counter!
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
4432 4432
4433 WebPlugin* RenderView::CreatePepperPlugin( 4433 WebPlugin* RenderView::CreatePepperPlugin(
4434 WebFrame* frame, 4434 WebFrame* frame,
4435 const WebPluginParams& params, 4435 const WebPluginParams& params,
4436 const FilePath& path, 4436 const FilePath& path,
4437 webkit::ppapi::PluginModule* pepper_module) { 4437 webkit::ppapi::PluginModule* pepper_module) {
4438 return new webkit::ppapi::WebPluginImpl( 4438 return new webkit::ppapi::WebPluginImpl(
4439 pepper_module, params, pepper_delegate_.AsWeakPtr()); 4439 pepper_module, params, pepper_delegate_.AsWeakPtr());
4440 } 4440 }
4441 4441
4442 WebPlugin* RenderView::CreateNPAPIPlugin(WebFrame* frame, 4442 WebPlugin* RenderView::CreateNPAPIPlugin(
4443 const WebPluginParams& params, 4443 WebFrame* frame,
4444 const FilePath& path, 4444 const WebPluginParams& params,
4445 const std::string& mime_type) { 4445 const FilePath& path,
4446 return new webkit_glue::WebPluginImpl( 4446 const std::string& mime_type) {
4447 return new webkit::npapi::WebPluginImpl(
4447 frame, params, path, mime_type, AsWeakPtr()); 4448 frame, params, path, mime_type, AsWeakPtr());
4448 } 4449 }
4449 4450
4450 WebPlugin* RenderView::CreateOutdatedPluginPlaceholder( 4451 WebPlugin* RenderView::CreateOutdatedPluginPlaceholder(
4451 WebFrame* frame, 4452 WebFrame* frame,
4452 const WebPluginParams& params, 4453 const WebPluginParams& params,
4453 const PluginGroup& group) { 4454 const webkit::npapi::PluginGroup& group) {
4454 int resource_id = IDR_OUTDATED_PLUGIN_HTML; 4455 int resource_id = IDR_OUTDATED_PLUGIN_HTML;
4455 const base::StringPiece template_html( 4456 const base::StringPiece template_html(
4456 ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id)); 4457 ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id));
4457 4458
4458 DCHECK(!template_html.empty()) << "unable to load template. ID: " 4459 DCHECK(!template_html.empty()) << "unable to load template. ID: "
4459 << resource_id; 4460 << resource_id;
4460 4461
4461 DictionaryValue values; 4462 DictionaryValue values;
4462 values.SetString("message", 4463 values.SetString("message",
4463 l10n_util::GetStringFUTF8(IDS_PLUGIN_OUTDATED, group.GetGroupName())); 4464 l10n_util::GetStringFUTF8(IDS_PLUGIN_OUTDATED, group.GetGroupName()));
4464 values.Set("pluginGroup", group.GetDataForUI()); 4465 values.Set("pluginGroup", group.GetDataForUI());
4465 4466
4466 // "t" is the id of the templates root node. 4467 // "t" is the id of the templates root node.
4467 std::string htmlData = jstemplate_builder::GetTemplatesHtml( 4468 std::string htmlData = jstemplate_builder::GetTemplatesHtml(
4468 template_html, &values, "t"); 4469 template_html, &values, "t");
4469 4470
4470 return WebViewPlugin::Create(NULL, 4471 return webkit::npapi::WebViewPlugin::Create(NULL,
4471 webkit_preferences_, 4472 webkit_preferences_,
4472 htmlData, 4473 htmlData,
4473 GURL("chrome://outdatedplugin/")); 4474 GURL("chrome://outdatedplugin/"));
4474 } 4475 }
4475 4476
4476 void RenderView::OnZoom(PageZoom::Function function) { 4477 void RenderView::OnZoom(PageZoom::Function function) {
4477 if (!webview()) // Not sure if this can happen, but no harm in being safe. 4478 if (!webview()) // Not sure if this can happen, but no harm in being safe.
4478 return; 4479 return;
4479 4480
4480 webview()->hidePopups(); 4481 webview()->hidePopups();
(...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after
5762 external_popup_menu_.reset(); 5763 external_popup_menu_.reset();
5763 } 5764 }
5764 #endif 5765 #endif
5765 5766
5766 void RenderView::AddErrorToRootConsole(const string16& message) { 5767 void RenderView::AddErrorToRootConsole(const string16& message) {
5767 if (webview() && webview()->mainFrame()) { 5768 if (webview() && webview()->mainFrame()) {
5768 webview()->mainFrame()->addMessageToConsole( 5769 webview()->mainFrame()->addMessageToConsole(
5769 WebConsoleMessage(WebConsoleMessage::LevelError, message)); 5770 WebConsoleMessage(WebConsoleMessage::LevelError, message));
5770 } 5771 }
5771 } 5772 }
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