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

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

Issue 6646025: Deleted WebPluginDelegatePepper. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 months 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/webplugin_delegate_pepper.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 #include "chrome/renderer/searchbox.h" 90 #include "chrome/renderer/searchbox.h"
91 #include "chrome/renderer/speech_input_dispatcher.h" 91 #include "chrome/renderer/speech_input_dispatcher.h"
92 #include "chrome/renderer/spellchecker/spellcheck.h" 92 #include "chrome/renderer/spellchecker/spellcheck.h"
93 #include "chrome/renderer/spellchecker/spellcheck_provider.h" 93 #include "chrome/renderer/spellchecker/spellcheck_provider.h"
94 #include "chrome/renderer/translate_helper.h" 94 #include "chrome/renderer/translate_helper.h"
95 #include "chrome/renderer/user_script_idle_scheduler.h" 95 #include "chrome/renderer/user_script_idle_scheduler.h"
96 #include "chrome/renderer/user_script_slave.h" 96 #include "chrome/renderer/user_script_slave.h"
97 #include "chrome/renderer/visitedlink_slave.h" 97 #include "chrome/renderer/visitedlink_slave.h"
98 #include "chrome/renderer/web_ui_bindings.h" 98 #include "chrome/renderer/web_ui_bindings.h"
99 #include "chrome/renderer/webgraphicscontext3d_command_buffer_impl.h" 99 #include "chrome/renderer/webgraphicscontext3d_command_buffer_impl.h"
100 #include "chrome/renderer/webplugin_delegate_pepper.h"
101 #include "chrome/renderer/webplugin_delegate_proxy.h" 100 #include "chrome/renderer/webplugin_delegate_proxy.h"
102 #include "chrome/renderer/websharedworker_proxy.h" 101 #include "chrome/renderer/websharedworker_proxy.h"
103 #include "chrome/renderer/webworker_proxy.h" 102 #include "chrome/renderer/webworker_proxy.h"
104 #include "content/common/content_constants.h" 103 #include "content/common/content_constants.h"
105 #include "content/common/file_system/file_system_dispatcher.h" 104 #include "content/common/file_system/file_system_dispatcher.h"
106 #include "content/common/file_system/webfilesystem_callback_dispatcher.h" 105 #include "content/common/file_system/webfilesystem_callback_dispatcher.h"
107 #include "content/common/notification_service.h" 106 #include "content/common/notification_service.h"
108 #include "grit/generated_resources.h" 107 #include "grit/generated_resources.h"
109 #include "grit/renderer_resources.h" 108 #include "grit/renderer_resources.h"
110 #include "media/base/filter_collection.h" 109 #include "media/base/filter_collection.h"
(...skipping 3818 matching lines...) Expand 10 before | Expand all | Expand 10 after
3929 } 3928 }
3930 3929
3931 // webkit_glue::WebPluginPageDelegate ----------------------------------------- 3930 // webkit_glue::WebPluginPageDelegate -----------------------------------------
3932 3931
3933 webkit::npapi::WebPluginDelegate* RenderView::CreatePluginDelegate( 3932 webkit::npapi::WebPluginDelegate* RenderView::CreatePluginDelegate(
3934 const FilePath& file_path, 3933 const FilePath& file_path,
3935 const std::string& mime_type) { 3934 const std::string& mime_type) {
3936 if (!PluginChannelHost::IsListening()) 3935 if (!PluginChannelHost::IsListening())
3937 return NULL; 3936 return NULL;
3938 3937
3939 bool use_pepper_host = false;
3940 bool in_process_plugin = RenderProcess::current()->UseInProcessPlugins(); 3938 bool in_process_plugin = RenderProcess::current()->UseInProcessPlugins();
3941 // Check for trusted Pepper plugins.
3942 const char kPepperPrefix[] = "pepper-";
3943 if (StartsWithASCII(mime_type, kPepperPrefix, true)) {
3944 if (CommandLine::ForCurrentProcess()->
3945 HasSwitch(switches::kInternalPepper)) {
3946 in_process_plugin = true;
3947 use_pepper_host = true;
3948 } else {
3949 // In process Pepper plugins must be explicitly enabled.
3950 return NULL;
3951 }
3952 } else {
3953 FilePath internal_pdf_path;
3954 PathService::Get(chrome::FILE_PDF_PLUGIN, &internal_pdf_path);
3955 if (file_path == internal_pdf_path) {
3956 in_process_plugin = true;
3957 use_pepper_host = true;
3958 }
3959 }
3960
3961 if (in_process_plugin) { 3939 if (in_process_plugin) {
3962 if (use_pepper_host) {
3963 WebPluginDelegatePepper* pepper_plugin =
3964 WebPluginDelegatePepper::Create(file_path, mime_type, AsWeakPtr());
3965 if (!pepper_plugin)
3966 return NULL;
3967
3968 current_oldstyle_pepper_plugins_.insert(pepper_plugin);
3969 return pepper_plugin;
3970 } else {
3971 #if defined(OS_WIN) // In-proc plugins aren't supported on Linux or Mac. 3940 #if defined(OS_WIN) // In-proc plugins aren't supported on Linux or Mac.
3972 return webkit::npapi::WebPluginDelegateImpl::Create( 3941 return webkit::npapi::WebPluginDelegateImpl::Create(
3973 file_path, mime_type, gfx::NativeViewFromId(host_window_)); 3942 file_path, mime_type, gfx::NativeViewFromId(host_window_));
3974 #else 3943 #else
3975 NOTIMPLEMENTED(); 3944 NOTIMPLEMENTED();
3976 return NULL; 3945 return NULL;
3977 #endif 3946 #endif
3978 }
3979 } 3947 }
3980 3948
3981 return new WebPluginDelegateProxy(mime_type, AsWeakPtr()); 3949 return new WebPluginDelegateProxy(mime_type, AsWeakPtr());
3982 } 3950 }
3983 3951
3984 void RenderView::CreatedPluginWindow(gfx::PluginWindowHandle window) { 3952 void RenderView::CreatedPluginWindow(gfx::PluginWindowHandle window) {
3985 #if defined(USE_X11) 3953 #if defined(USE_X11)
3986 RenderThread::current()->Send(new ViewHostMsg_CreatePluginContainer( 3954 RenderThread::current()->Send(new ViewHostMsg_CreatePluginContainer(
3987 routing_id(), window)); 3955 routing_id(), window));
3988 #endif 3956 #endif
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
4570 void RenderView::InsertCSS(const std::wstring& frame_xpath, 4538 void RenderView::InsertCSS(const std::wstring& frame_xpath,
4571 const std::string& css, 4539 const std::string& css,
4572 const std::string& id) { 4540 const std::string& id) {
4573 WebFrame* web_frame = GetChildFrame(frame_xpath); 4541 WebFrame* web_frame = GetChildFrame(frame_xpath);
4574 if (!web_frame) 4542 if (!web_frame)
4575 return; 4543 return;
4576 4544
4577 web_frame->insertStyleText(WebString::fromUTF8(css), WebString::fromUTF8(id)); 4545 web_frame->insertStyleText(WebString::fromUTF8(css), WebString::fromUTF8(id));
4578 } 4546 }
4579 4547
4580 void RenderView::OnPepperPluginDestroy(
4581 WebPluginDelegatePepper* pepper_plugin) {
4582 std::set<WebPluginDelegatePepper*>::iterator found_pepper =
4583 current_oldstyle_pepper_plugins_.find(pepper_plugin);
4584 if (found_pepper == current_oldstyle_pepper_plugins_.end()) {
4585 NOTREACHED();
4586 return;
4587 }
4588 current_oldstyle_pepper_plugins_.erase(found_pepper);
4589
4590 // The plugin could have been destroyed while it was waiting for a file
4591 // choose callback, so check all pending completion callbacks and NULL them.
4592 for (std::deque< linked_ptr<PendingFileChooser> >::iterator i =
4593 file_chooser_completions_.begin();
4594 i != file_chooser_completions_.end(); /* nothing */) {
4595 if ((*i)->completion == pepper_plugin) {
4596 // We NULL the first one instead of deleting it because the plugin might
4597 // be the one waiting for a file choose callback. If the callback later
4598 // comes, we don't want to send the result to the next callback in line.
4599 if (i == file_chooser_completions_.begin())
4600 (*i)->completion = NULL;
4601 else
4602 i = file_chooser_completions_.erase(i);
4603 } else {
4604 ++i;
4605 }
4606 }
4607 }
4608
4609 void RenderView::OnScriptEvalRequest(const string16& frame_xpath, 4548 void RenderView::OnScriptEvalRequest(const string16& frame_xpath,
4610 const string16& jscript, 4549 const string16& jscript,
4611 int id, 4550 int id,
4612 bool notify_result) { 4551 bool notify_result) {
4613 EvaluateScript(frame_xpath, jscript, id, notify_result); 4552 EvaluateScript(frame_xpath, jscript, id, notify_result);
4614 } 4553 }
4615 4554
4616 void RenderView::OnCSSInsertRequest(const std::wstring& frame_xpath, 4555 void RenderView::OnCSSInsertRequest(const std::wstring& frame_xpath,
4617 const std::string& css, 4556 const std::string& css,
4618 const std::string& id) { 4557 const std::string& id) {
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
5077 should_display_scrollbars(new_size.width(), new_size.height())); 5016 should_display_scrollbars(new_size.width(), new_size.height()));
5078 } 5017 }
5079 } 5018 }
5080 5019
5081 RenderWidget::OnResize(new_size, resizer_rect); 5020 RenderWidget::OnResize(new_size, resizer_rect);
5082 } 5021 }
5083 5022
5084 void RenderView::DidInitiatePaint() { 5023 void RenderView::DidInitiatePaint() {
5085 // Notify the pepper plugins that we started painting. 5024 // Notify the pepper plugins that we started painting.
5086 pepper_delegate_.ViewInitiatedPaint(); 5025 pepper_delegate_.ViewInitiatedPaint();
5087
5088 // Notify any "old-style" pepper plugins that we started painting. This is
5089 // used for internal bookkeeping only, so we know that the set can not change
5090 // under us.
5091 for (std::set<WebPluginDelegatePepper*>::iterator i =
5092 current_oldstyle_pepper_plugins_.begin();
5093 i != current_oldstyle_pepper_plugins_.end(); ++i)
5094 (*i)->RenderViewInitiatedPaint();
5095 } 5026 }
5096 5027
5097 void RenderView::DidFlushPaint() { 5028 void RenderView::DidFlushPaint() {
5098 // Notify any pepper plugins that we painted. This will call into the plugin, 5029 // Notify any pepper plugins that we painted. This will call into the plugin,
5099 // and we it may ask to close itself as a result. This will, in turn, modify 5030 // and we it may ask to close itself as a result. This will, in turn, modify
5100 // our set, possibly invalidating the iterator. So we iterate on a copy that 5031 // our set, possibly invalidating the iterator. So we iterate on a copy that
5101 // won't change out from under us. 5032 // won't change out from under us.
5102 pepper_delegate_.ViewFlushedPaint(); 5033 pepper_delegate_.ViewFlushedPaint();
5103 5034
5104 // Notify any old-style pepper plugins that we painted. This will call into
5105 // the plugin, and we it may ask to close itself as a result. This will, in
5106 // turn, modify our set, possibly invalidating the iterator. So we iterate on
5107 // a copy that won't change out from under us.
5108 // This should be deleted when we don't support old Pepper anymore.
5109 std::set<WebPluginDelegatePepper*> plugins = current_oldstyle_pepper_plugins_;
5110 for (std::set<WebPluginDelegatePepper*>::iterator i = plugins.begin();
5111 i != plugins.end(); ++i) {
5112 // The copy above makes sure our iterator is never invalid if some plugins
5113 // are destroyed. But some plugin may decide to close all of its views in
5114 // response to a paint in one of them, so we need to make sure each one is
5115 // still "current" before using it.
5116 if (current_oldstyle_pepper_plugins_.find(*i) !=
5117 current_oldstyle_pepper_plugins_.end())
5118 (*i)->RenderViewFlushedPaint();
5119 }
5120
5121 WebFrame* main_frame = webview()->mainFrame(); 5035 WebFrame* main_frame = webview()->mainFrame();
5122 5036
5123 // If we have a provisional frame we are between the start and commit stages 5037 // If we have a provisional frame we are between the start and commit stages
5124 // of loading and we don't want to save stats. 5038 // of loading and we don't want to save stats.
5125 if (!main_frame->provisionalDataSource()) { 5039 if (!main_frame->provisionalDataSource()) {
5126 WebDataSource* ds = main_frame->dataSource(); 5040 WebDataSource* ds = main_frame->dataSource();
5127 NavigationState* navigation_state = NavigationState::FromDataSource(ds); 5041 NavigationState* navigation_state = NavigationState::FromDataSource(ds);
5128 DCHECK(navigation_state); 5042 DCHECK(navigation_state);
5129 5043
5130 // TODO(jar): The following code should all be inside a method, probably in 5044 // TODO(jar): The following code should all be inside a method, probably in
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
5711 const webkit_glue::CustomContextMenuContext& custom_context) { 5625 const webkit_glue::CustomContextMenuContext& custom_context) {
5712 if (custom_context.is_pepper_menu) 5626 if (custom_context.is_pepper_menu)
5713 pepper_delegate_.OnContextMenuClosed(custom_context); 5627 pepper_delegate_.OnContextMenuClosed(custom_context);
5714 else 5628 else
5715 context_menu_node_.reset(); 5629 context_menu_node_.reset();
5716 } 5630 }
5717 5631
5718 void RenderView::OnNetworkStateChanged(bool online) { 5632 void RenderView::OnNetworkStateChanged(bool online) {
5719 WebNetworkStateNotifier::setOnLine(online); 5633 WebNetworkStateNotifier::setOnLine(online);
5720 } 5634 }
OLDNEW
« no previous file with comments | « chrome/renderer/render_view.h ('k') | chrome/renderer/webplugin_delegate_pepper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698