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/renderer/webplugin_delegate_proxy.h" | 5 #include "content/renderer/webplugin_delegate_proxy.h" |
6 | 6 |
7 #if defined(TOOLKIT_GTK) | 7 #if defined(TOOLKIT_GTK) |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #elif defined(USE_X11) | 9 #elif defined(USE_X11) |
10 #include <cairo/cairo.h> | 10 #include <cairo/cairo.h> |
11 #endif | 11 #endif |
12 | 12 |
13 #include <algorithm> | 13 #include <algorithm> |
14 | 14 |
15 #include "base/auto_reset.h" | |
15 #include "base/basictypes.h" | 16 #include "base/basictypes.h" |
16 #include "base/command_line.h" | 17 #include "base/command_line.h" |
17 #include "base/file_util.h" | 18 #include "base/file_util.h" |
18 #include "base/logging.h" | 19 #include "base/logging.h" |
19 #include "base/memory/ref_counted.h" | 20 #include "base/memory/ref_counted.h" |
20 #include "base/memory/scoped_ptr.h" | 21 #include "base/memory/scoped_ptr.h" |
21 #include "base/process.h" | 22 #include "base/process.h" |
22 #include "base/string_split.h" | 23 #include "base/string_split.h" |
23 #include "base/string_util.h" | 24 #include "base/string_util.h" |
24 #include "base/utf_string_conversions.h" | 25 #include "base/utf_string_conversions.h" |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
269 // Anything else is a named, opaque color or an RGB form with no alpha. | 270 // Anything else is a named, opaque color or an RGB form with no alpha. |
270 return false; | 271 return false; |
271 } | 272 } |
272 | 273 |
273 bool WebPluginDelegateProxy::Initialize( | 274 bool WebPluginDelegateProxy::Initialize( |
274 const GURL& url, | 275 const GURL& url, |
275 const std::vector<std::string>& arg_names, | 276 const std::vector<std::string>& arg_names, |
276 const std::vector<std::string>& arg_values, | 277 const std::vector<std::string>& arg_values, |
277 webkit::npapi::WebPlugin* plugin, | 278 webkit::npapi::WebPlugin* plugin, |
278 bool load_manually) { | 279 bool load_manually) { |
280 #if defined(OS_MACOSX) | |
281 // TODO(shess): Debugging for http://crbug.com/97285 . See comment | |
282 // in plugin_channel_host.cc. | |
283 AutoReset<bool> track_nested_removes( | |
284 PluginChannelHost::GetRemoveTrackingFlag(), true); | |
285 #endif | |
286 | |
279 IPC::ChannelHandle channel_handle; | 287 IPC::ChannelHandle channel_handle; |
280 if (!RenderThreadImpl::current()->Send(new ViewHostMsg_OpenChannelToPlugin( | 288 if (!RenderThreadImpl::current()->Send(new ViewHostMsg_OpenChannelToPlugin( |
281 render_view_->routing_id(), url, page_url_, mime_type_, | 289 render_view_->routing_id(), url, page_url_, mime_type_, |
282 &channel_handle, &info_))) { | 290 &channel_handle, &info_))) { |
283 return false; | 291 return false; |
284 } | 292 } |
285 | 293 |
286 if (channel_handle.name.empty()) { | 294 if (channel_handle.name.empty()) { |
287 // We got an invalid handle. Either the plugin couldn't be found (which | 295 // We got an invalid handle. Either the plugin couldn't be found (which |
288 // shouldn't happen, since if we got here the plugin should exist) or the | 296 // shouldn't happen, since if we got here the plugin should exist) or the |
289 // plugin crashed on initialization. | 297 // plugin crashed on initialization. |
290 if (!info_.path.empty()) { | 298 if (!info_.path.empty()) { |
291 render_view_->PluginCrashed(info_.path); | 299 render_view_->PluginCrashed(info_.path); |
292 LOG(ERROR) << "Plug-in crashed on start"; | 300 LOG(ERROR) << "Plug-in crashed on start"; |
293 | 301 |
294 // Return true so that the plugin widget is created and we can paint the | 302 // Return true so that the plugin widget is created and we can paint the |
295 // crashed plugin there. | 303 // crashed plugin there. |
296 return true; | 304 return true; |
297 } | 305 } |
298 LOG(ERROR) << "Plug-in couldn't be found"; | 306 LOG(ERROR) << "Plug-in couldn't be found"; |
299 return false; | 307 return false; |
300 } | 308 } |
301 | 309 |
302 scoped_refptr<PluginChannelHost> channel_host( | 310 scoped_refptr<PluginChannelHost> channel_host( |
303 PluginChannelHost::GetPluginChannelHost( | 311 PluginChannelHost::GetPluginChannelHost( |
304 channel_handle, ChildProcess::current()->io_message_loop_proxy())); | 312 channel_handle, ChildProcess::current()->io_message_loop_proxy())); |
305 if (!channel_host.get()) { | 313 if (!channel_host.get()) { |
306 LOG(ERROR) << "Couldn't get PluginChannelHost"; | 314 LOG(ERROR) << "Couldn't get PluginChannelHost"; |
307 return false; | 315 return false; |
308 } | 316 } |
piman
2012/05/16 23:19:27
Is it ok not to reset here? You might get RemoveRo
Scott Hess - ex-Googler
2012/05/17 22:08:12
Hmm. auto_reset<> doesn't have a Reset(), but I c
| |
309 | 317 |
310 int instance_id; | 318 int instance_id; |
311 bool result = channel_host->Send(new PluginMsg_CreateInstance( | 319 bool result = channel_host->Send(new PluginMsg_CreateInstance( |
312 mime_type_, &instance_id)); | 320 mime_type_, &instance_id)); |
313 if (!result) { | 321 if (!result) { |
314 LOG(ERROR) << "Couldn't send PluginMsg_CreateInstance"; | 322 LOG(ERROR) << "Couldn't send PluginMsg_CreateInstance"; |
315 return false; | 323 return false; |
316 } | 324 } |
317 | 325 |
318 channel_host_ = channel_host; | 326 channel_host_ = channel_host; |
(...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1473 } | 1481 } |
1474 #endif | 1482 #endif |
1475 | 1483 |
1476 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, | 1484 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, |
1477 int resource_id) { | 1485 int resource_id) { |
1478 if (!plugin_) | 1486 if (!plugin_) |
1479 return; | 1487 return; |
1480 | 1488 |
1481 plugin_->URLRedirectResponse(allow, resource_id); | 1489 plugin_->URLRedirectResponse(allow, resource_id); |
1482 } | 1490 } |
OLD | NEW |