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 "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" |
| 11 #include "chrome/common/extensions/extension.h" |
11 #include "chrome/common/url_constants.h" | 12 #include "chrome/common/url_constants.h" |
12 #include "chrome/renderer/extensions/chrome_v8_context.h" | 13 #include "chrome/renderer/extensions/chrome_v8_context.h" |
13 #include "content/public/renderer/render_thread.h" | 14 #include "content/public/renderer/render_thread.h" |
14 #include "content/public/renderer/v8_value_converter.h" | 15 #include "content/public/renderer/v8_value_converter.h" |
15 #include "content/public/renderer/render_view.h" | 16 #include "content/public/renderer/render_view.h" |
16 #include "v8/include/v8.h" | 17 #include "v8/include/v8.h" |
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
19 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURL.h" |
20 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques
t.h" | 21 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques
t.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 // out from under us. | 112 // out from under us. |
112 ContextSet contexts = GetAll(); | 113 ContextSet contexts = GetAll(); |
113 | 114 |
114 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); | 115 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); |
115 for (ContextSet::iterator it = contexts.begin(); it != contexts.end(); | 116 for (ContextSet::iterator it = contexts.begin(); it != contexts.end(); |
116 ++it) { | 117 ++it) { |
117 if ((*it)->v8_context().IsEmpty()) | 118 if ((*it)->v8_context().IsEmpty()) |
118 continue; | 119 continue; |
119 | 120 |
120 if (!extension_id.empty()) { | 121 if (!extension_id.empty()) { |
121 const Extension* extension = (*it)->extension(); | 122 const extensions::Extension* extension = (*it)->extension(); |
122 if (!extension || (extension_id != extension->id())) | 123 if (!extension || (extension_id != extension->id())) |
123 continue; | 124 continue; |
124 } | 125 } |
125 | 126 |
126 content::RenderView* context_render_view = (*it)->GetRenderView(); | 127 content::RenderView* context_render_view = (*it)->GetRenderView(); |
127 if (!context_render_view) | 128 if (!context_render_view) |
128 continue; | 129 continue; |
129 | 130 |
130 if (render_view && render_view != context_render_view) | 131 if (render_view && render_view != context_render_view) |
131 continue; | 132 continue; |
(...skipping 17 matching lines...) Expand all Loading... |
149 // TODO(rafaelw): Consider only doing this check if function_name == | 150 // TODO(rafaelw): Consider only doing this check if function_name == |
150 // "Event.dispatchJSON". | 151 // "Event.dispatchJSON". |
151 #ifndef NDEBUG | 152 #ifndef NDEBUG |
152 if (!retval.IsEmpty() && !retval->IsUndefined()) { | 153 if (!retval.IsEmpty() && !retval->IsUndefined()) { |
153 std::string error = *v8::String::AsciiValue(retval); | 154 std::string error = *v8::String::AsciiValue(retval); |
154 DCHECK(false) << error; | 155 DCHECK(false) << error; |
155 } | 156 } |
156 #endif | 157 #endif |
157 } | 158 } |
158 } | 159 } |
OLD | NEW |