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

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 2855123003: Remove rendundant WebLocalFrame parameter in various plugin code. (Closed)
Patch Set: Fix Android Created 3 years, 7 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 2494 matching lines...) Expand 10 before | Expand all | Expand 10 after
2505 Send(new FrameHostMsg_ContextMenu(routing_id_, our_params)); 2505 Send(new FrameHostMsg_ContextMenu(routing_id_, our_params));
2506 return our_params.custom_context.request_id; 2506 return our_params.custom_context.request_id;
2507 } 2507 }
2508 2508
2509 void RenderFrameImpl::CancelContextMenu(int request_id) { 2509 void RenderFrameImpl::CancelContextMenu(int request_id) {
2510 DCHECK(pending_context_menus_.Lookup(request_id)); 2510 DCHECK(pending_context_menus_.Lookup(request_id));
2511 pending_context_menus_.Remove(request_id); 2511 pending_context_menus_.Remove(request_id);
2512 } 2512 }
2513 2513
2514 blink::WebPlugin* RenderFrameImpl::CreatePlugin( 2514 blink::WebPlugin* RenderFrameImpl::CreatePlugin(
2515 blink::WebFrame* frame,
2516 const WebPluginInfo& info, 2515 const WebPluginInfo& info,
2517 const blink::WebPluginParams& params, 2516 const blink::WebPluginParams& params,
2518 std::unique_ptr<content::PluginInstanceThrottler> throttler) { 2517 std::unique_ptr<content::PluginInstanceThrottler> throttler) {
2519 DCHECK_EQ(frame_, frame);
2520 #if BUILDFLAG(ENABLE_PLUGINS) 2518 #if BUILDFLAG(ENABLE_PLUGINS)
2521 if (info.type == WebPluginInfo::PLUGIN_TYPE_BROWSER_PLUGIN) { 2519 if (info.type == WebPluginInfo::PLUGIN_TYPE_BROWSER_PLUGIN) {
2520 // |delegate| deletes itself.
2521 BrowserPluginDelegate* delegate =
2522 GetContentClient()->renderer()->CreateBrowserPluginDelegate(
2523 this, params.mime_type.Utf8(), GURL(params.url));
2522 return BrowserPluginManager::Get()->CreateBrowserPlugin( 2524 return BrowserPluginManager::Get()->CreateBrowserPlugin(
2523 this, GetContentClient() 2525 this, delegate->GetWeakPtr());
2524 ->renderer()
2525 ->CreateBrowserPluginDelegate(this, params.mime_type.Utf8(),
2526 GURL(params.url))
2527 ->GetWeakPtr());
2528 } 2526 }
2529 2527
2530 bool pepper_plugin_was_registered = false; 2528 bool pepper_plugin_was_registered = false;
2531 scoped_refptr<PluginModule> pepper_module(PluginModule::Create( 2529 scoped_refptr<PluginModule> pepper_module(PluginModule::Create(
2532 this, info, &pepper_plugin_was_registered)); 2530 this, info, &pepper_plugin_was_registered));
2533 if (pepper_plugin_was_registered) { 2531 if (pepper_plugin_was_registered) {
2534 if (pepper_module.get()) { 2532 if (pepper_module.get()) {
2535 return new PepperWebPluginImpl( 2533 return new PepperWebPluginImpl(
2536 pepper_module.get(), params, this, 2534 pepper_module.get(), params, this,
2537 base::WrapUnique( 2535 base::WrapUnique(
2538 static_cast<PluginInstanceThrottlerImpl*>(throttler.release()))); 2536 static_cast<PluginInstanceThrottlerImpl*>(throttler.release())));
2539 } 2537 }
2540 } 2538 }
2541 #if defined(OS_CHROMEOS) 2539 #if defined(OS_CHROMEOS)
2542 LOG(WARNING) << "Pepper module/plugin creation failed."; 2540 LOG(WARNING) << "Pepper module/plugin creation failed.";
2543 #endif 2541 #endif
2544 #endif 2542 #endif // BUILDFLAG(ENABLE_PLUGINS)
2545 return NULL; 2543 return nullptr;
2546 } 2544 }
2547 2545
2548 void RenderFrameImpl::LoadURLExternally(const blink::WebURLRequest& request, 2546 void RenderFrameImpl::LoadURLExternally(const blink::WebURLRequest& request,
2549 blink::WebNavigationPolicy policy) { 2547 blink::WebNavigationPolicy policy) {
2550 LoadURLExternally(request, policy, WebString(), false); 2548 LoadURLExternally(request, policy, WebString(), false);
2551 } 2549 }
2552 2550
2553 void RenderFrameImpl::LoadErrorPage(int reason) { 2551 void RenderFrameImpl::LoadErrorPage(int reason) {
2554 blink::WebURLError error; 2552 blink::WebURLError error;
2555 error.unreachable_url = frame_->GetDocument().Url(); 2553 error.unreachable_url = frame_->GetDocument().Url();
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
2775 // On Android, page zoom isn't used, and in case of WebView, text zoom is used 2773 // On Android, page zoom isn't used, and in case of WebView, text zoom is used
2776 // for legacy WebView text scaling emulation. Thus, the code that resets 2774 // for legacy WebView text scaling emulation. Thus, the code that resets
2777 // the zoom level from this map will be effectively resetting text zoom level. 2775 // the zoom level from this map will be effectively resetting text zoom level.
2778 host_zoom_levels_[url] = zoom_level; 2776 host_zoom_levels_[url] = zoom_level;
2779 #endif 2777 #endif
2780 } 2778 }
2781 2779
2782 // blink::WebFrameClient implementation ---------------------------------------- 2780 // blink::WebFrameClient implementation ----------------------------------------
2783 2781
2784 blink::WebPlugin* RenderFrameImpl::CreatePlugin( 2782 blink::WebPlugin* RenderFrameImpl::CreatePlugin(
2785 blink::WebLocalFrame* frame,
2786 const blink::WebPluginParams& params) { 2783 const blink::WebPluginParams& params) {
2787 DCHECK_EQ(frame_, frame); 2784 blink::WebPlugin* plugin = nullptr;
2788 blink::WebPlugin* plugin = NULL; 2785 if (GetContentClient()->renderer()->OverrideCreatePlugin(this, params,
2789 if (GetContentClient()->renderer()->OverrideCreatePlugin( 2786 &plugin)) {
2790 this, frame, params, &plugin)) {
2791 return plugin; 2787 return plugin;
2792 } 2788 }
2793 2789
2794 if (params.mime_type.ContainsOnlyASCII() && 2790 if (params.mime_type.ContainsOnlyASCII() &&
2795 params.mime_type.Ascii() == kBrowserPluginMimeType) { 2791 params.mime_type.Ascii() == kBrowserPluginMimeType) {
2792 // |delegate| deletes itself.
2793 BrowserPluginDelegate* delegate =
2794 GetContentClient()->renderer()->CreateBrowserPluginDelegate(
2795 this, kBrowserPluginMimeType, GURL(params.url));
2796 return BrowserPluginManager::Get()->CreateBrowserPlugin( 2796 return BrowserPluginManager::Get()->CreateBrowserPlugin(
2797 this, GetContentClient() 2797 this, delegate->GetWeakPtr());
2798 ->renderer()
2799 ->CreateBrowserPluginDelegate(this, kBrowserPluginMimeType,
2800 GURL(params.url))
2801 ->GetWeakPtr());
2802 } 2798 }
2803 2799
2804 #if BUILDFLAG(ENABLE_PLUGINS) 2800 #if BUILDFLAG(ENABLE_PLUGINS)
2805 WebPluginInfo info; 2801 WebPluginInfo info;
2806 std::string mime_type; 2802 std::string mime_type;
2807 bool found = false; 2803 bool found = false;
2808 Send(new FrameHostMsg_GetPluginInfo( 2804 Send(new FrameHostMsg_GetPluginInfo(
2809 routing_id_, params.url, frame->Top()->GetSecurityOrigin(), 2805 routing_id_, params.url, frame_->Top()->GetSecurityOrigin(),
2810 params.mime_type.Utf8(), &found, &info, &mime_type)); 2806 params.mime_type.Utf8(), &found, &info, &mime_type));
2811 if (!found) 2807 if (!found)
2812 return NULL; 2808 return nullptr;
2813 2809
2814 WebPluginParams params_to_use = params; 2810 WebPluginParams params_to_use = params;
2815 params_to_use.mime_type = WebString::FromUTF8(mime_type); 2811 params_to_use.mime_type = WebString::FromUTF8(mime_type);
2816 return CreatePlugin(frame, info, params_to_use, nullptr /* throttler */); 2812 return CreatePlugin(info, params_to_use, nullptr /* throttler */);
2817 #else 2813 #else
2818 return NULL; 2814 return nullptr;
2819 #endif // BUILDFLAG(ENABLE_PLUGINS) 2815 #endif // BUILDFLAG(ENABLE_PLUGINS)
2820 } 2816 }
2821 2817
2822 blink::WebMediaPlayer* RenderFrameImpl::CreateMediaPlayer( 2818 blink::WebMediaPlayer* RenderFrameImpl::CreateMediaPlayer(
2823 const blink::WebMediaPlayerSource& source, 2819 const blink::WebMediaPlayerSource& source,
2824 WebMediaPlayerClient* client, 2820 WebMediaPlayerClient* client,
2825 WebMediaPlayerEncryptedMediaClient* encrypted_client, 2821 WebMediaPlayerEncryptedMediaClient* encrypted_client,
2826 WebContentDecryptionModule* initial_cdm, 2822 WebContentDecryptionModule* initial_cdm,
2827 const blink::WebString& sink_id) { 2823 const blink::WebString& sink_id) {
2828 blink::WebSecurityOrigin security_origin = frame_->GetSecurityOrigin(); 2824 blink::WebSecurityOrigin security_origin = frame_->GetSecurityOrigin();
(...skipping 4267 matching lines...) Expand 10 before | Expand all | Expand 10 after
7096 policy(info.default_policy), 7092 policy(info.default_policy),
7097 replaces_current_history_item(info.replaces_current_history_item), 7093 replaces_current_history_item(info.replaces_current_history_item),
7098 history_navigation_in_new_child_frame( 7094 history_navigation_in_new_child_frame(
7099 info.is_history_navigation_in_new_child_frame), 7095 info.is_history_navigation_in_new_child_frame),
7100 client_redirect(info.is_client_redirect), 7096 client_redirect(info.is_client_redirect),
7101 cache_disabled(info.is_cache_disabled), 7097 cache_disabled(info.is_cache_disabled),
7102 form(info.form), 7098 form(info.form),
7103 source_location(info.source_location) {} 7099 source_location(info.source_location) {}
7104 7100
7105 } // namespace content 7101 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698