| 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/chrome_v8_context_set.h" | 5 #include "chrome/renderer/extensions/chrome_v8_context_set.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/tracked_objects.h" | 9 #include "base/tracked_objects.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 // We copy the context list, because calling into javascript may modify it | 110 // We copy the context list, because calling into javascript may modify it |
| 111 // out from under us. | 111 // out from under us. |
| 112 ContextSet contexts = GetAll(); | 112 ContextSet contexts = GetAll(); |
| 113 | 113 |
| 114 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); | 114 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); |
| 115 for (ContextSet::iterator it = contexts.begin(); it != contexts.end(); | 115 for (ContextSet::iterator it = contexts.begin(); it != contexts.end(); |
| 116 ++it) { | 116 ++it) { |
| 117 if ((*it)->v8_context().IsEmpty()) | 117 if ((*it)->v8_context().IsEmpty()) |
| 118 continue; | 118 continue; |
| 119 | 119 |
| 120 if (!extension_id.empty() && extension_id != (*it)->extension_id()) | 120 if (!extension_id.empty()) { |
| 121 continue; | 121 const Extension* extension = (*it)->extension(); |
| 122 if (!extension || (extension_id != extension->id())) |
| 123 continue; |
| 124 } |
| 122 | 125 |
| 123 content::RenderView* context_render_view = (*it)->GetRenderView(); | 126 content::RenderView* context_render_view = (*it)->GetRenderView(); |
| 124 if (!context_render_view) | 127 if (!context_render_view) |
| 125 continue; | 128 continue; |
| 126 | 129 |
| 127 if (render_view && render_view != context_render_view) | 130 if (render_view && render_view != context_render_view) |
| 128 continue; | 131 continue; |
| 129 | 132 |
| 130 if (!HasSufficientPermissions(context_render_view, event_url)) | 133 if (!HasSufficientPermissions(context_render_view, event_url)) |
| 131 continue; | 134 continue; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 146 // TODO(rafaelw): Consider only doing this check if function_name == | 149 // TODO(rafaelw): Consider only doing this check if function_name == |
| 147 // "Event.dispatchJSON". | 150 // "Event.dispatchJSON". |
| 148 #ifndef NDEBUG | 151 #ifndef NDEBUG |
| 149 if (!retval.IsEmpty() && !retval->IsUndefined()) { | 152 if (!retval.IsEmpty() && !retval->IsUndefined()) { |
| 150 std::string error = *v8::String::AsciiValue(retval); | 153 std::string error = *v8::String::AsciiValue(retval); |
| 151 DCHECK(false) << error; | 154 DCHECK(false) << error; |
| 152 } | 155 } |
| 153 #endif | 156 #endif |
| 154 } | 157 } |
| 155 } | 158 } |
| OLD | NEW |