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

Side by Side Diff: components/plugins/renderer/plugin_placeholder.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 "components/plugins/renderer/plugin_placeholder.h" 5 #include "components/plugins/renderer/plugin_placeholder.h"
6 6
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "content/public/common/web_preferences.h" 8 #include "content/public/common/web_preferences.h"
9 #include "content/public/renderer/render_frame.h" 9 #include "content/public/renderer/render_frame.h"
10 #include "content/public/renderer/render_thread.h" 10 #include "content/public/renderer/render_thread.h"
11 #include "gin/object_template_builder.h" 11 #include "gin/object_template_builder.h"
12 #include "third_party/WebKit/public/web/WebElement.h" 12 #include "third_party/WebKit/public/web/WebElement.h"
13 #include "third_party/WebKit/public/web/WebPluginContainer.h" 13 #include "third_party/WebKit/public/web/WebPluginContainer.h"
14 #include "third_party/re2/src/re2/re2.h" 14 #include "third_party/re2/src/re2/re2.h"
15 15
16 namespace plugins { 16 namespace plugins {
17 17
18 // The placeholder is loaded in normal web renderer processes, so it should not 18 // The placeholder is loaded in normal web renderer processes, so it should not
19 // have a chrome:// scheme that might let it be confused with a WebUI page. 19 // have a chrome:// scheme that might let it be confused with a WebUI page.
20 const char kPluginPlaceholderDataURL[] = "data:text/html,pluginplaceholderdata"; 20 const char kPluginPlaceholderDataURL[] = "data:text/html,pluginplaceholderdata";
21 21
22 PluginPlaceholderBase::PluginPlaceholderBase( 22 PluginPlaceholderBase::PluginPlaceholderBase(
23 content::RenderFrame* render_frame, 23 content::RenderFrame* render_frame,
24 blink::WebLocalFrame* frame,
25 const blink::WebPluginParams& params, 24 const blink::WebPluginParams& params,
26 const std::string& html_data) 25 const std::string& html_data)
27 : content::RenderFrameObserver(render_frame), 26 : content::RenderFrameObserver(render_frame),
28 frame_(frame),
29 plugin_params_(params), 27 plugin_params_(params),
30 plugin_(WebViewPlugin::Create(render_frame->GetRenderView(), 28 plugin_(WebViewPlugin::Create(render_frame->GetRenderView(),
31 this, 29 this,
32 render_frame 30 render_frame
33 ? render_frame->GetWebkitPreferences() 31 ? render_frame->GetWebkitPreferences()
34 : content::WebPreferences(), 32 : content::WebPreferences(),
35 html_data, 33 html_data,
36 GURL(kPluginPlaceholderDataURL))), 34 GURL(kPluginPlaceholderDataURL))),
37 hidden_(false) {} 35 hidden_(false) {}
38 36
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 } 104 }
107 } 105 }
108 } 106 }
109 107
110 void PluginPlaceholderBase::HideCallback() { 108 void PluginPlaceholderBase::HideCallback() {
111 content::RenderThread::Get()->RecordAction( 109 content::RenderThread::Get()->RecordAction(
112 base::UserMetricsAction("Plugin_Hide_Click")); 110 base::UserMetricsAction("Plugin_Hide_Click"));
113 HidePlugin(); 111 HidePlugin();
114 } 112 }
115 113
116 void PluginPlaceholderBase::OnDestruct() { 114 void PluginPlaceholderBase::OnDestruct() {}
117 frame_ = NULL;
118 }
119
120 blink::WebLocalFrame* PluginPlaceholderBase::GetFrame() {
121 return frame_;
122 }
123 115
124 // static 116 // static
125 gin::WrapperInfo PluginPlaceholder::kWrapperInfo = {gin::kEmbedderNativeGin}; 117 gin::WrapperInfo PluginPlaceholder::kWrapperInfo = {gin::kEmbedderNativeGin};
126 118
127 PluginPlaceholder::PluginPlaceholder(content::RenderFrame* render_frame, 119 PluginPlaceholder::PluginPlaceholder(content::RenderFrame* render_frame,
128 blink::WebLocalFrame* frame,
129 const blink::WebPluginParams& params, 120 const blink::WebPluginParams& params,
130 const std::string& html_data) 121 const std::string& html_data)
131 : PluginPlaceholderBase(render_frame, frame, params, html_data) { 122 : PluginPlaceholderBase(render_frame, params, html_data) {}
132 }
133 123
134 PluginPlaceholder::~PluginPlaceholder() { 124 PluginPlaceholder::~PluginPlaceholder() {
135 } 125 }
136 126
137 v8::Local<v8::Value> PluginPlaceholder::GetV8Handle(v8::Isolate* isolate) { 127 v8::Local<v8::Value> PluginPlaceholder::GetV8Handle(v8::Isolate* isolate) {
138 return gin::CreateHandle(isolate, this).ToV8(); 128 return gin::CreateHandle(isolate, this).ToV8();
139 } 129 }
140 130
141 bool PluginPlaceholderBase::IsErrorPlaceholder() { 131 bool PluginPlaceholderBase::IsErrorPlaceholder() {
142 return false; 132 return false;
143 } 133 }
144 134
145 gin::ObjectTemplateBuilder PluginPlaceholder::GetObjectTemplateBuilder( 135 gin::ObjectTemplateBuilder PluginPlaceholder::GetObjectTemplateBuilder(
146 v8::Isolate* isolate) { 136 v8::Isolate* isolate) {
147 return gin::Wrappable<PluginPlaceholder>::GetObjectTemplateBuilder(isolate) 137 return gin::Wrappable<PluginPlaceholder>::GetObjectTemplateBuilder(isolate)
148 .SetMethod<void (plugins::PluginPlaceholder::*)()>( 138 .SetMethod<void (plugins::PluginPlaceholder::*)()>(
149 "hide", &PluginPlaceholder::HideCallback); 139 "hide", &PluginPlaceholder::HideCallback);
150 } 140 }
151 141
152 } // namespace plugins 142 } // namespace plugins
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698