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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // however it does not play correctly with the "IsTestExtensionId" checks. | 137 // however it does not play correctly with the "IsTestExtensionId" checks. |
138 // We need to remove that first. | 138 // We need to remove that first. |
139 scoped_ptr<std::set<std::string> > apis; | 139 scoped_ptr<std::set<std::string> > apis; |
140 | 140 |
141 const std::string& extension_id = v8_context->extension_id(); | 141 const std::string& extension_id = v8_context->extension_id(); |
142 if (extension_dispatcher()->IsTestExtensionId(extension_id)) { | 142 if (extension_dispatcher()->IsTestExtensionId(extension_id)) { |
143 apis.reset(new std::set<std::string>()); | 143 apis.reset(new std::set<std::string>()); |
144 // The minimal set of APIs that tests need. | 144 // The minimal set of APIs that tests need. |
145 apis->insert("extension"); | 145 apis->insert("extension"); |
146 } else { | 146 } else { |
147 apis = ExtensionAPI::GetInstance()->GetAPIsForContext( | 147 apis = ExtensionAPI::GetSharedInstance()->GetAPIsForContext( |
148 v8_context->context_type(), | 148 v8_context->context_type(), |
149 extension_dispatcher()->extensions()->GetByID(extension_id), | 149 extension_dispatcher()->extensions()->GetByID(extension_id), |
150 UserScriptSlave::GetDataSourceURLForFrame(v8_context->web_frame())); | 150 UserScriptSlave::GetDataSourceURLForFrame(v8_context->web_frame())); |
151 } | 151 } |
152 | 152 |
153 return extension_dispatcher()->v8_schema_registry()->GetSchemas(*apis); | 153 return extension_dispatcher()->v8_schema_registry()->GetSchemas(*apis); |
154 } | 154 } |
155 | 155 |
156 v8::Handle<v8::Value> SchemaGeneratedBindings::GetNextRequestId( | 156 v8::Handle<v8::Value> SchemaGeneratedBindings::GetNextRequestId( |
157 const v8::Arguments& args) { | 157 const v8::Arguments& args) { |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 } | 353 } |
354 #endif | 354 #endif |
355 | 355 |
356 // Save the extension id before erasing the request. | 356 // Save the extension id before erasing the request. |
357 *extension_id = request->extension_id; | 357 *extension_id = request->extension_id; |
358 | 358 |
359 g_pending_requests.Get().RemoveRequest(request_id); | 359 g_pending_requests.Get().RemoveRequest(request_id); |
360 } | 360 } |
361 | 361 |
362 } // namespace extensions | 362 } // namespace extensions |
OLD | NEW |