Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Side by Side Diff: content/renderer/browser_plugin/browser_plugin.cc

Issue 10832207: Browser Plugin: Report Guest crash to Javascript (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with ToT Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | content/renderer/browser_plugin/browser_plugin_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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";
40 const char kNavigationEventName[] = "navigation"; 41 const char kNavigationEventName[] = "navigation";
41 const char* kSrcAttribute = "src"; 42 const char* kSrcAttribute = "src";
42 } 43 }
43 44
44 BrowserPlugin::BrowserPlugin( 45 BrowserPlugin::BrowserPlugin(
45 int instance_id, 46 int instance_id,
46 RenderViewImpl* render_view, 47 RenderViewImpl* render_view,
47 WebKit::WebFrame* frame, 48 WebKit::WebFrame* frame,
48 const WebPluginParams& params) 49 const WebPluginParams& params)
49 : instance_id_(instance_id), 50 : instance_id_(instance_id),
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_UpdateRect_ACK( 178 BrowserPluginManager::Get()->Send(new BrowserPluginHostMsg_UpdateRect_ACK(
178 render_view_->GetRoutingID(), 179 render_view_->GetRoutingID(),
179 instance_id_, 180 instance_id_,
180 message_id, 181 message_id,
181 gfx::Size())); 182 gfx::Size()));
182 } 183 }
183 184
184 void BrowserPlugin::GuestCrashed() { 185 void BrowserPlugin::GuestCrashed() {
185 guest_crashed_ = true; 186 guest_crashed_ = true;
186 container_->invalidate(); 187 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 }
187 } 203 }
188 204
189 void BrowserPlugin::DidNavigate(const GURL& url) { 205 void BrowserPlugin::DidNavigate(const GURL& url) {
190 src_ = url.spec(); 206 src_ = url.spec();
191 if (!HasListeners(kNavigationEventName)) 207 if (!HasListeners(kNavigationEventName))
192 return; 208 return;
193 209
194 EventListeners& listeners = event_listener_map_[kNavigationEventName]; 210 EventListeners& listeners = event_listener_map_[kNavigationEventName];
195 EventListeners::iterator it = listeners.begin(); 211 EventListeners::iterator it = listeners.begin();
196 for (; it != listeners.end(); ++it) { 212 for (; it != listeners.end(); ++it) {
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 void* notify_data) { 408 void* notify_data) {
393 } 409 }
394 410
395 void BrowserPlugin::didFailLoadingFrameRequest( 411 void BrowserPlugin::didFailLoadingFrameRequest(
396 const WebKit::WebURL& url, 412 const WebKit::WebURL& url,
397 void* notify_data, 413 void* notify_data,
398 const WebKit::WebURLError& error) { 414 const WebKit::WebURLError& error) {
399 } 415 }
400 416
401 } // namespace content 417 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/browser_plugin/browser_plugin_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698