| 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/browser_plugin/browser_plugin.h" | 5 #include "content/renderer/browser_plugin/browser_plugin.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #if defined (OS_WIN) | 9 #if defined (OS_WIN) |
| 10 #include "base/sys_info.h" | 10 #include "base/sys_info.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 WebKit::WebFrame* frame, | 51 WebKit::WebFrame* frame, |
| 52 const WebPluginParams& params) | 52 const WebPluginParams& params) |
| 53 : instance_id_(instance_id), | 53 : instance_id_(instance_id), |
| 54 render_view_(render_view), | 54 render_view_(render_view), |
| 55 container_(NULL), | 55 container_(NULL), |
| 56 damage_buffer_(NULL), | 56 damage_buffer_(NULL), |
| 57 sad_guest_(NULL), | 57 sad_guest_(NULL), |
| 58 guest_crashed_(false), | 58 guest_crashed_(false), |
| 59 resize_pending_(false), | 59 resize_pending_(false), |
| 60 navigate_src_sent_(false), | 60 navigate_src_sent_(false), |
| 61 parent_frame_(frame->identifier()) { | 61 parent_frame_(frame->identifier()), |
| 62 process_id_(0) { |
| 62 BrowserPluginManager::Get()->AddBrowserPlugin(instance_id, this); | 63 BrowserPluginManager::Get()->AddBrowserPlugin(instance_id, this); |
| 63 bindings_.reset(new BrowserPluginBindings(this)); | 64 bindings_.reset(new BrowserPluginBindings(this)); |
| 64 | 65 |
| 65 std::string src; | 66 std::string src; |
| 66 if (ParseSrcAttribute(params, &src)) | 67 if (ParseSrcAttribute(params, &src)) |
| 67 SetSrcAttribute(src); | 68 SetSrcAttribute(src); |
| 68 } | 69 } |
| 69 | 70 |
| 70 BrowserPlugin::~BrowserPlugin() { | 71 BrowserPlugin::~BrowserPlugin() { |
| 71 if (damage_buffer_) { | 72 if (damage_buffer_) { |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 v8::Context::Scope context_scope(v8::Context::New()); | 208 v8::Context::Scope context_scope(v8::Context::New()); |
| 208 v8::HandleScope handle_scope; | 209 v8::HandleScope handle_scope; |
| 209 container()->element().document().frame()-> | 210 container()->element().document().frame()-> |
| 210 callFunctionEvenIfScriptDisabled(*it, | 211 callFunctionEvenIfScriptDisabled(*it, |
| 211 v8::Object::New(), | 212 v8::Object::New(), |
| 212 0, | 213 0, |
| 213 NULL); | 214 NULL); |
| 214 } | 215 } |
| 215 } | 216 } |
| 216 | 217 |
| 217 void BrowserPlugin::DidNavigate(const GURL& url) { | 218 void BrowserPlugin::DidNavigate(const GURL& url, int process_id) { |
| 218 src_ = url.spec(); | 219 src_ = url.spec(); |
| 220 process_id_ = process_id; |
| 219 if (!HasListeners(kNavigationEventName)) | 221 if (!HasListeners(kNavigationEventName)) |
| 220 return; | 222 return; |
| 221 | 223 |
| 222 EventListeners& listeners = event_listener_map_[kNavigationEventName]; | 224 EventListeners& listeners = event_listener_map_[kNavigationEventName]; |
| 223 EventListeners::iterator it = listeners.begin(); | 225 EventListeners::iterator it = listeners.begin(); |
| 224 for (; it != listeners.end(); ++it) { | 226 for (; it != listeners.end(); ++it) { |
| 225 v8::Context::Scope context_scope(v8::Context::New()); | 227 v8::Context::Scope context_scope(v8::Context::New()); |
| 226 v8::HandleScope handle_scope; | 228 v8::HandleScope handle_scope; |
| 227 v8::Local<v8::Value> param = | 229 v8::Local<v8::Value> param = |
| 228 v8::Local<v8::Value>::New(v8::String::New(src_.c_str())); | 230 v8::Local<v8::Value>::New(v8::String::New(src_.c_str())); |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 void* notify_data) { | 455 void* notify_data) { |
| 454 } | 456 } |
| 455 | 457 |
| 456 void BrowserPlugin::didFailLoadingFrameRequest( | 458 void BrowserPlugin::didFailLoadingFrameRequest( |
| 457 const WebKit::WebURL& url, | 459 const WebKit::WebURL& url, |
| 458 void* notify_data, | 460 void* notify_data, |
| 459 const WebKit::WebURLError& error) { | 461 const WebKit::WebURLError& error) { |
| 460 } | 462 } |
| 461 | 463 |
| 462 } // namespace content | 464 } // namespace content |
| OLD | NEW |