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 RenderView* context_render_view = (*it)->GetRenderView(); | 395 WebFrame* context_frame = WebFrame::frameForContext((*it)->context); |
| 396 if (!context_frame || !context_frame->view()) |
| 397 continue; |
| 398 |
| 399 RenderView* context_render_view = |
| 400 RenderView::FromWebView(context_frame->view()); |
396 if (!context_render_view) | 401 if (!context_render_view) |
397 continue; | 402 continue; |
398 | 403 |
399 if (render_view && render_view != context_render_view) | 404 if (render_view && render_view != context_render_view) |
400 continue; | 405 continue; |
401 | 406 |
402 if (!HasSufficientPermissions(context_render_view, event_url)) | 407 if (!HasSufficientPermissions(context_render_view, event_url)) |
403 continue; | 408 continue; |
404 | 409 |
405 v8::Local<v8::Context> context(*((*it)->context)); | 410 v8::Local<v8::Context> context(*((*it)->context)); |
(...skipping 11 matching lines...) Expand all Loading... |
417 // TODO(rafaelw): Consider only doing this check if function_name == | 422 // TODO(rafaelw): Consider only doing this check if function_name == |
418 // "Event.dispatchJSON". | 423 // "Event.dispatchJSON". |
419 #ifndef NDEBUG | 424 #ifndef NDEBUG |
420 if (!retval.IsEmpty() && !retval->IsUndefined()) { | 425 if (!retval.IsEmpty() && !retval->IsUndefined()) { |
421 std::string error = *v8::String::AsciiValue(retval); | 426 std::string error = *v8::String::AsciiValue(retval); |
422 DCHECK(false) << error; | 427 DCHECK(false) << error; |
423 } | 428 } |
424 #endif | 429 #endif |
425 } | 430 } |
426 } | 431 } |
OLD | NEW |