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 scoped_ptr<AutoReset<bool> > track_nested_removes(new AutoReset<bool>( |
| 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 |
(...skipping 10 matching lines...) Expand all Loading... |
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 } |
| 317 #if defined(OS_MACOSX) |
| 318 track_nested_removes.reset(); |
| 319 #endif |
309 | 320 |
310 int instance_id; | 321 int instance_id; |
311 bool result = channel_host->Send(new PluginMsg_CreateInstance( | 322 bool result = channel_host->Send(new PluginMsg_CreateInstance( |
312 mime_type_, &instance_id)); | 323 mime_type_, &instance_id)); |
313 if (!result) { | 324 if (!result) { |
314 LOG(ERROR) << "Couldn't send PluginMsg_CreateInstance"; | 325 LOG(ERROR) << "Couldn't send PluginMsg_CreateInstance"; |
315 return false; | 326 return false; |
316 } | 327 } |
317 | 328 |
318 channel_host_ = channel_host; | 329 channel_host_ = channel_host; |
(...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1473 } | 1484 } |
1474 #endif | 1485 #endif |
1475 | 1486 |
1476 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, | 1487 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, |
1477 int resource_id) { | 1488 int resource_id) { |
1478 if (!plugin_) | 1489 if (!plugin_) |
1479 return; | 1490 return; |
1480 | 1491 |
1481 plugin_->URLRedirectResponse(allow, resource_id); | 1492 plugin_->URLRedirectResponse(allow, resource_id); |
1482 } | 1493 } |
OLD | NEW |