| 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_(-1) { |
| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 v8::Context::Scope context_scope(v8::Context::New()); | 225 v8::Context::Scope context_scope(v8::Context::New()); |
| 225 v8::HandleScope handle_scope; | 226 v8::HandleScope handle_scope; |
| 226 container()->element().document().frame()-> | 227 container()->element().document().frame()-> |
| 227 callFunctionEvenIfScriptDisabled(*it, | 228 callFunctionEvenIfScriptDisabled(*it, |
| 228 v8::Object::New(), | 229 v8::Object::New(), |
| 229 0, | 230 0, |
| 230 NULL); | 231 NULL); |
| 231 } | 232 } |
| 232 } | 233 } |
| 233 | 234 |
| 234 void BrowserPlugin::DidNavigate(const GURL& url) { | 235 void BrowserPlugin::DidNavigate(const GURL& url, int process_id) { |
| 235 src_ = url.spec(); | 236 src_ = url.spec(); |
| 237 process_id_ = process_id; |
| 236 if (!HasListeners(kNavigationEventName)) | 238 if (!HasListeners(kNavigationEventName)) |
| 237 return; | 239 return; |
| 238 | 240 |
| 239 EventListeners& listeners = event_listener_map_[kNavigationEventName]; | 241 EventListeners& listeners = event_listener_map_[kNavigationEventName]; |
| 240 EventListeners::iterator it = listeners.begin(); | 242 EventListeners::iterator it = listeners.begin(); |
| 241 for (; it != listeners.end(); ++it) { | 243 for (; it != listeners.end(); ++it) { |
| 242 v8::Context::Scope context_scope(v8::Context::New()); | 244 v8::Context::Scope context_scope(v8::Context::New()); |
| 243 v8::HandleScope handle_scope; | 245 v8::HandleScope handle_scope; |
| 244 v8::Local<v8::Value> param = | 246 v8::Local<v8::Value> param = |
| 245 v8::Local<v8::Value>::New(v8::String::New(src_.c_str())); | 247 v8::Local<v8::Value>::New(v8::String::New(src_.c_str())); |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 void* notify_data) { | 472 void* notify_data) { |
| 471 } | 473 } |
| 472 | 474 |
| 473 void BrowserPlugin::didFailLoadingFrameRequest( | 475 void BrowserPlugin::didFailLoadingFrameRequest( |
| 474 const WebKit::WebURL& url, | 476 const WebKit::WebURL& url, |
| 475 void* notify_data, | 477 void* notify_data, |
| 476 const WebKit::WebURLError& error) { | 478 const WebKit::WebURLError& error) { |
| 477 } | 479 } |
| 478 | 480 |
| 479 } // namespace content | 481 } // namespace content |
| OLD | NEW |