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/schema_generated_bindings.h" | 5 #include "chrome/renderer/extensions/schema_generated_bindings.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
134 // Get the current RenderView so that we can send a routed IPC message from | 134 // Get the current RenderView so that we can send a routed IPC message from |
135 // the correct source. | 135 // the correct source. |
136 content::RenderView* renderview = current_context->GetRenderView(); | 136 content::RenderView* renderview = current_context->GetRenderView(); |
137 if (!renderview) | 137 if (!renderview) |
138 return v8::Undefined(); | 138 return v8::Undefined(); |
139 | 139 |
140 std::string name = *v8::String::AsciiValue(args[0]); | 140 std::string name = *v8::String::AsciiValue(args[0]); |
141 const std::set<std::string>& function_names = | 141 const std::set<std::string>& function_names = |
142 v8_extension->extension_dispatcher_->function_names(); | 142 v8_extension->extension_dispatcher_->function_names(); |
143 if (function_names.find(name) == function_names.end()) { | 143 if (function_names.find(name) == function_names.end()) { |
144 NOTREACHED() << "Unexpected function " << name; | 144 NOTREACHED() << "Unexpected function " << name << |
145 ". Did you remember to register it with ExtensionFunctionRegistry?"; | |
Aaron Boodman
2012/03/28 03:36:18
Heh.
Can we automate registration?
Mihai Parparita -not on Chrome
2012/03/28 17:01:31
I thought Mike and Antony's IDL work automates tha
Matt Perry
2012/03/28 20:21:36
Ah, cool, it does. Unfortunately it doesn't quite
| |
145 return v8::Undefined(); | 146 return v8::Undefined(); |
146 } | 147 } |
147 | 148 |
148 if (!v8_extension->CheckCurrentContextAccessToExtensionAPI(name)) | 149 if (!v8_extension->CheckCurrentContextAccessToExtensionAPI(name)) |
149 return v8::Undefined(); | 150 return v8::Undefined(); |
150 | 151 |
151 GURL source_url; | 152 GURL source_url; |
152 WebSecurityOrigin source_origin; | 153 WebSecurityOrigin source_origin; |
153 WebFrame* webframe = current_context->web_frame(); | 154 WebFrame* webframe = current_context->web_frame(); |
154 if (webframe) { | 155 if (webframe) { |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
341 const std::string& extension_id) { | 342 const std::string& extension_id) { |
342 for (PendingRequestMap::const_iterator it = g_pending_requests.Get().begin(); | 343 for (PendingRequestMap::const_iterator it = g_pending_requests.Get().begin(); |
343 it != g_pending_requests.Get().end(); ++it) { | 344 it != g_pending_requests.Get().end(); ++it) { |
344 if (it->second->extension_id == extension_id) | 345 if (it->second->extension_id == extension_id) |
345 return true; | 346 return true; |
346 } | 347 } |
347 return false; | 348 return false; |
348 } | 349 } |
349 | 350 |
350 } // namespace | 351 } // namespace |
OLD | NEW |