OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/renderer/extensions/event_bindings.h" | 5 #include "chrome/renderer/extensions/event_bindings.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 | 385 |
386 V8ValueConverter converter; | 386 V8ValueConverter converter; |
387 for (ContextList::iterator it = contexts.begin(); | 387 for (ContextList::iterator it = contexts.begin(); |
388 it != contexts.end(); ++it) { | 388 it != contexts.end(); ++it) { |
389 if ((*it)->context.IsEmpty()) | 389 if ((*it)->context.IsEmpty()) |
390 continue; | 390 continue; |
391 | 391 |
392 if (!extension_id.empty() && extension_id != (*it)->extension_id) | 392 if (!extension_id.empty() && extension_id != (*it)->extension_id) |
393 continue; | 393 continue; |
394 | 394 |
395 WebFrame* context_frame = WebFrame::frameForContext((*it)->context); | 395 RenderView* context_render_view = (*it)->GetRenderView(); |
396 if (!context_frame || !context_frame->view()) | |
397 continue; | |
398 | |
399 RenderView* context_render_view = | |
400 RenderView::FromWebView(context_frame->view()); | |
401 if (!context_render_view) | 396 if (!context_render_view) |
402 continue; | 397 continue; |
403 | 398 |
404 if (render_view && render_view != context_render_view) | 399 if (render_view && render_view != context_render_view) |
405 continue; | 400 continue; |
406 | 401 |
407 if (!HasSufficientPermissions(context_render_view, event_url)) | 402 if (!HasSufficientPermissions(context_render_view, event_url)) |
408 continue; | 403 continue; |
409 | 404 |
410 v8::Local<v8::Context> context(*((*it)->context)); | 405 v8::Local<v8::Context> context(*((*it)->context)); |
(...skipping 11 matching lines...) Expand all Loading... |
422 // TODO(rafaelw): Consider only doing this check if function_name == | 417 // TODO(rafaelw): Consider only doing this check if function_name == |
423 // "Event.dispatchJSON". | 418 // "Event.dispatchJSON". |
424 #ifndef NDEBUG | 419 #ifndef NDEBUG |
425 if (!retval.IsEmpty() && !retval->IsUndefined()) { | 420 if (!retval.IsEmpty() && !retval->IsUndefined()) { |
426 std::string error = *v8::String::AsciiValue(retval); | 421 std::string error = *v8::String::AsciiValue(retval); |
427 DCHECK(false) << error; | 422 DCHECK(false) << error; |
428 } | 423 } |
429 #endif | 424 #endif |
430 } | 425 } |
431 } | 426 } |
OLD | NEW |