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 #include "content/common/browser_plugin_messages.h" | 9 #include "content/common/browser_plugin_messages.h" |
10 #include "content/public/common/content_client.h" | 10 #include "content/public/common/content_client.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 using WebKit::WebPluginParams; | 30 using WebKit::WebPluginParams; |
31 using WebKit::WebPoint; | 31 using WebKit::WebPoint; |
32 using WebKit::WebString; | 32 using WebKit::WebString; |
33 using WebKit::WebRect; | 33 using WebKit::WebRect; |
34 using WebKit::WebURL; | 34 using WebKit::WebURL; |
35 using WebKit::WebVector; | 35 using WebKit::WebVector; |
36 | 36 |
37 namespace content { | 37 namespace content { |
38 | 38 |
39 namespace { | 39 namespace { |
40 const char kCrashEventName[] = "crash"; | |
41 const char kNavigationEventName[] = "navigation"; | 40 const char kNavigationEventName[] = "navigation"; |
42 const char* kSrcAttribute = "src"; | 41 const char* kSrcAttribute = "src"; |
43 } | 42 } |
44 | 43 |
45 BrowserPlugin::BrowserPlugin( | 44 BrowserPlugin::BrowserPlugin( |
46 int instance_id, | 45 int instance_id, |
47 RenderViewImpl* render_view, | 46 RenderViewImpl* render_view, |
48 WebKit::WebFrame* frame, | 47 WebKit::WebFrame* frame, |
49 const WebPluginParams& params) | 48 const WebPluginParams& params) |
50 : instance_id_(instance_id), | 49 : instance_id_(instance_id), |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_UpdateRect_ACK( | 177 BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_UpdateRect_ACK( |
179 render_view_->GetRoutingID(), | 178 render_view_->GetRoutingID(), |
180 instance_id_, | 179 instance_id_, |
181 message_id, | 180 message_id, |
182 gfx::Size())); | 181 gfx::Size())); |
183 } | 182 } |
184 | 183 |
185 void BrowserPlugin::GuestCrashed() { | 184 void BrowserPlugin::GuestCrashed() { |
186 guest_crashed_ = true; | 185 guest_crashed_ = true; |
187 container_->invalidate(); | 186 container_->invalidate(); |
188 | |
189 if (!HasListeners(kCrashEventName)) | |
190 return; | |
191 | |
192 EventListeners& listeners = event_listener_map_[kCrashEventName]; | |
193 EventListeners::iterator it = listeners.begin(); | |
194 for (; it != listeners.end(); ++it) { | |
195 v8::Context::Scope context_scope(v8::Context::New()); | |
196 v8::HandleScope handle_scope; | |
197 container()->element().document().frame()-> | |
198 callFunctionEvenIfScriptDisabled(*it, | |
199 v8::Object::New(), | |
200 0, | |
201 NULL); | |
202 } | |
203 } | 187 } |
204 | 188 |
205 void BrowserPlugin::DidNavigate(const GURL& url) { | 189 void BrowserPlugin::DidNavigate(const GURL& url) { |
206 src_ = url.spec(); | 190 src_ = url.spec(); |
207 if (!HasListeners(kNavigationEventName)) | 191 if (!HasListeners(kNavigationEventName)) |
208 return; | 192 return; |
209 | 193 |
210 EventListeners& listeners = event_listener_map_[kNavigationEventName]; | 194 EventListeners& listeners = event_listener_map_[kNavigationEventName]; |
211 EventListeners::iterator it = listeners.begin(); | 195 EventListeners::iterator it = listeners.begin(); |
212 for (; it != listeners.end(); ++it) { | 196 for (; it != listeners.end(); ++it) { |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 void* notify_data) { | 392 void* notify_data) { |
409 } | 393 } |
410 | 394 |
411 void BrowserPlugin::didFailLoadingFrameRequest( | 395 void BrowserPlugin::didFailLoadingFrameRequest( |
412 const WebKit::WebURL& url, | 396 const WebKit::WebURL& url, |
413 void* notify_data, | 397 void* notify_data, |
414 const WebKit::WebURLError& error) { | 398 const WebKit::WebURLError& error) { |
415 } | 399 } |
416 | 400 |
417 } // namespace content | 401 } // namespace content |
OLD | NEW |