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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 // Get the current RenderView so that we can send a routed IPC message from | 136 // Get the current RenderView so that we can send a routed IPC message from |
137 // the correct source. | 137 // the correct source. |
138 content::RenderView* renderview = current_context->GetRenderView(); | 138 content::RenderView* renderview = current_context->GetRenderView(); |
139 if (!renderview) | 139 if (!renderview) |
140 return v8::Undefined(); | 140 return v8::Undefined(); |
141 | 141 |
142 std::string name = *v8::String::AsciiValue(args[0]); | 142 std::string name = *v8::String::AsciiValue(args[0]); |
143 const std::set<std::string>& function_names = | 143 const std::set<std::string>& function_names = |
144 v8_extension->extension_dispatcher_->function_names(); | 144 v8_extension->extension_dispatcher_->function_names(); |
145 if (function_names.find(name) == function_names.end()) { | 145 if (function_names.find(name) == function_names.end()) { |
146 NOTREACHED() << "Unexpected function " << name; | 146 NOTREACHED() << "Unexpected function " << name << |
| 147 ". Did you remember to register it with ExtensionFunctionRegistry?"; |
147 return v8::Undefined(); | 148 return v8::Undefined(); |
148 } | 149 } |
149 | 150 |
150 if (!v8_extension->CheckCurrentContextAccessToExtensionAPI(name)) | 151 if (!v8_extension->CheckCurrentContextAccessToExtensionAPI(name)) |
151 return v8::Undefined(); | 152 return v8::Undefined(); |
152 | 153 |
153 GURL source_url; | 154 GURL source_url; |
154 WebSecurityOrigin source_origin; | 155 WebSecurityOrigin source_origin; |
155 WebFrame* webframe = current_context->web_frame(); | 156 WebFrame* webframe = current_context->web_frame(); |
156 if (webframe) { | 157 if (webframe) { |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 const std::string& extension_id) { | 344 const std::string& extension_id) { |
344 for (PendingRequestMap::const_iterator it = g_pending_requests.Get().begin(); | 345 for (PendingRequestMap::const_iterator it = g_pending_requests.Get().begin(); |
345 it != g_pending_requests.Get().end(); ++it) { | 346 it != g_pending_requests.Get().end(); ++it) { |
346 if (it->second->extension_id == extension_id) | 347 if (it->second->extension_id == extension_id) |
347 return true; | 348 return true; |
348 } | 349 } |
349 return false; | 350 return false; |
350 } | 351 } |
351 | 352 |
352 } // namespace | 353 } // namespace |
OLD | NEW |