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

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

Issue 10024055: Remove unneeded extension_messages_browsertest.cc + cleanup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: windoooowze 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/api_definitions_natives.h" 5 #include "chrome/renderer/extensions/api_definitions_natives.h"
6 6
7 #include "chrome/common/extensions/api/extension_api.h"
8 #include "chrome/renderer/extensions/user_script_slave.h"
9
10 namespace extensions { 7 namespace extensions {
11 8
12 ApiDefinitionsNatives::ApiDefinitionsNatives( 9 ApiDefinitionsNatives::ApiDefinitionsNatives(
13 ExtensionDispatcher* extension_dispatcher) 10 ExtensionDispatcher* extension_dispatcher)
14 : ChromeV8Extension(extension_dispatcher) { 11 : ChromeV8Extension(extension_dispatcher) {
15 RouteFunction("GetExtensionAPIDefinition", 12 RouteFunction("GetExtensionAPIDefinition",
16 base::Bind(&ApiDefinitionsNatives::GetExtensionAPIDefinition, 13 base::Bind(&ApiDefinitionsNatives::GetExtensionAPIDefinition,
17 base::Unretained(this))); 14 base::Unretained(this)));
18 } 15 }
19 16
20 v8::Handle<v8::Value> ApiDefinitionsNatives::GetExtensionAPIDefinition( 17 v8::Handle<v8::Value> ApiDefinitionsNatives::GetExtensionAPIDefinition(
21 const v8::Arguments& args) { 18 const v8::Arguments& args) {
22 ChromeV8Context* v8_context = 19 ChromeV8Context* v8_context =
23 extension_dispatcher()->v8_context_set().GetCurrent(); 20 extension_dispatcher()->v8_context_set().GetCurrent();
24 CHECK(v8_context); 21 CHECK(v8_context);
25 22 return extension_dispatcher()->v8_schema_registry()->GetSchemas(
26 // TODO(kalman): This is being calculated twice, first in 23 v8_context->GetAvailableExtensionAPIs());
27 // ExtensionDispatcher then again here. It might as well be a property of
28 // ChromeV8Context, however, this would require making ChromeV8Context take
29 // an Extension rather than an extension ID. In itself this is fine,
30 // however it does not play correctly with the "IsTestExtensionId" checks.
31 // We need to remove that first.
32 scoped_ptr<std::set<std::string> > apis;
33
34 const std::string& extension_id = v8_context->extension_id();
35 if (extension_dispatcher()->IsTestExtensionId(extension_id)) {
36 apis.reset(new std::set<std::string>());
37 // The minimal set of APIs that tests need.
38 apis->insert("extension");
39 } else {
40 apis = ExtensionAPI::GetSharedInstance()->GetAPIsForContext(
41 v8_context->context_type(),
42 extension_dispatcher()->extensions()->GetByID(extension_id),
43 UserScriptSlave::GetDataSourceURLForFrame(v8_context->web_frame()));
44 }
45
46 return extension_dispatcher()->v8_schema_registry()->GetSchemas(*apis);
47 } 24 }
48 25
49 } // namespace extensions 26 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/renderer/chrome_content_renderer_client.cc ('k') | chrome/renderer/extensions/app_bindings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698