Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(388)

Side by Side Diff: chrome/renderer/extensions/schema_generated_bindings.cc

Issue 9950046: Implement FeatureProvider for ExtensionAPI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698