OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/plugin/webplugin_delegate_stub.h" | 5 #include "content/plugin/webplugin_delegate_stub.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/string_number_conversions.h" | 11 #include "base/string_number_conversions.h" |
12 #include "content/common/plugin_messages.h" | 12 #include "content/common/plugin_messages.h" |
13 #include "content/plugin/plugin_channel.h" | 13 #include "content/plugin/plugin_channel.h" |
14 #include "content/plugin/plugin_thread.h" | 14 #include "content/plugin/plugin_thread.h" |
15 #include "content/plugin/webplugin_proxy.h" | 15 #include "content/plugin/webplugin_proxy.h" |
16 #include "content/public/common/content_client.h" | 16 #include "content/public/common/content_client.h" |
17 #include "content/public/common/content_constants.h" | 17 #include "content/public/common/content_constants.h" |
18 #include "content/public/common/content_switches.h" | 18 #include "content/public/common/content_switches.h" |
19 #include "third_party/npapi/bindings/npapi.h" | 19 #include "third_party/npapi/bindings/npapi.h" |
20 #include "third_party/npapi/bindings/npruntime.h" | 20 #include "third_party/npapi/bindings/npruntime.h" |
21 #include "skia/ext/platform_device.h" | 21 #include "skia/ext/platform_device.h" |
22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" | 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h" |
23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" | 23 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h" |
| 24 #include "webkit/plugins/npapi/plugin_instance.h" |
24 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" | 25 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" |
25 #include "webkit/glue/webcursor.h" | 26 #include "webkit/glue/webcursor.h" |
26 | 27 |
27 using WebKit::WebBindings; | 28 using WebKit::WebBindings; |
28 using WebKit::WebCursorInfo; | 29 using WebKit::WebCursorInfo; |
29 using webkit::npapi::WebPlugin; | 30 using webkit::npapi::WebPlugin; |
30 using webkit::npapi::WebPluginResourceClient; | 31 using webkit::npapi::WebPluginResourceClient; |
31 | 32 |
32 namespace content { | 33 namespace content { |
33 | 34 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 143 |
143 DCHECK(handled); | 144 DCHECK(handled); |
144 return handled; | 145 return handled; |
145 } | 146 } |
146 | 147 |
147 bool WebPluginDelegateStub::Send(IPC::Message* msg) { | 148 bool WebPluginDelegateStub::Send(IPC::Message* msg) { |
148 return channel_->Send(msg); | 149 return channel_->Send(msg); |
149 } | 150 } |
150 | 151 |
151 void WebPluginDelegateStub::OnInit(const PluginMsg_Init_Params& params, | 152 void WebPluginDelegateStub::OnInit(const PluginMsg_Init_Params& params, |
| 153 bool* transparent, |
152 bool* result) { | 154 bool* result) { |
153 page_url_ = params.page_url; | 155 page_url_ = params.page_url; |
154 GetContentClient()->SetActiveURL(page_url_); | 156 GetContentClient()->SetActiveURL(page_url_); |
155 | 157 |
| 158 *transparent = false; |
156 *result = false; | 159 *result = false; |
157 if (params.arg_names.size() != params.arg_values.size()) { | 160 if (params.arg_names.size() != params.arg_values.size()) { |
158 NOTREACHED(); | 161 NOTREACHED(); |
159 return; | 162 return; |
160 } | 163 } |
161 | 164 |
162 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 165 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
163 base::FilePath path = | 166 base::FilePath path = |
164 command_line.GetSwitchValuePath(switches::kPluginPath); | 167 command_line.GetSwitchValuePath(switches::kPluginPath); |
165 | 168 |
166 webplugin_ = new WebPluginProxy( | 169 webplugin_ = new WebPluginProxy( |
167 channel_, instance_id_, page_url_, params.host_render_view_routing_id); | 170 channel_, instance_id_, page_url_, params.host_render_view_routing_id); |
168 delegate_ = webkit::npapi::WebPluginDelegateImpl::Create(path, mime_type_); | 171 delegate_ = webkit::npapi::WebPluginDelegateImpl::Create(path, mime_type_); |
169 if (delegate_) { | 172 if (delegate_) { |
170 webplugin_->set_delegate(delegate_); | 173 webplugin_->set_delegate(delegate_); |
171 std::vector<std::string> arg_names = params.arg_names; | 174 std::vector<std::string> arg_names = params.arg_names; |
172 std::vector<std::string> arg_values = params.arg_values; | 175 std::vector<std::string> arg_values = params.arg_values; |
173 | 176 |
174 *result = delegate_->Initialize(params.url, | 177 *result = delegate_->Initialize(params.url, |
175 arg_names, | 178 arg_names, |
176 arg_values, | 179 arg_values, |
177 webplugin_, | 180 webplugin_, |
178 params.load_manually); | 181 params.load_manually); |
| 182 *transparent = delegate_->instance()->transparent(); |
179 } | 183 } |
180 } | 184 } |
181 | 185 |
182 void WebPluginDelegateStub::OnWillSendRequest(int id, const GURL& url, | 186 void WebPluginDelegateStub::OnWillSendRequest(int id, const GURL& url, |
183 int http_status_code) { | 187 int http_status_code) { |
184 WebPluginResourceClient* client = webplugin_->GetResourceClient(id); | 188 WebPluginResourceClient* client = webplugin_->GetResourceClient(id); |
185 if (!client) | 189 if (!client) |
186 return; | 190 return; |
187 | 191 |
188 client->WillSendRequest(url, http_status_code); | 192 client->WillSendRequest(url, http_status_code); |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 } | 398 } |
395 | 399 |
396 #if defined(OS_MACOSX) | 400 #if defined(OS_MACOSX) |
397 void WebPluginDelegateStub::OnSetFakeAcceleratedSurfaceWindowHandle( | 401 void WebPluginDelegateStub::OnSetFakeAcceleratedSurfaceWindowHandle( |
398 gfx::PluginWindowHandle window) { | 402 gfx::PluginWindowHandle window) { |
399 delegate_->set_windowed_handle(window); | 403 delegate_->set_windowed_handle(window); |
400 } | 404 } |
401 #endif | 405 #endif |
402 | 406 |
403 } // namespace content | 407 } // namespace content |
OLD | NEW |