Chromium Code Reviews| Index: chrome/renderer/extensions/dispatcher.cc |
| diff --git a/chrome/renderer/extensions/dispatcher.cc b/chrome/renderer/extensions/dispatcher.cc |
| index eb8796329d70e0b96f0c59e7e2e29d0d0dfd6dcf..4e9a2b6ed0a343af9e631377dc83b29af582ff8e 100644 |
| --- a/chrome/renderer/extensions/dispatcher.cc |
| +++ b/chrome/renderer/extensions/dispatcher.cc |
| @@ -722,8 +722,9 @@ void Dispatcher::RegisterSchemaGeneratedBindings( |
| for (std::set<std::string>::iterator it = apis.begin(); |
| it != apis.end(); ++it) { |
| const std::string& api_name = *it; |
| - if (!context->IsAnyFeatureAvailableToContext(api_name)) |
| - continue; |
| + // TODO(cduvall): Reenable once all APIs are converted to features. |
| + // if (!context->IsAnyFeatureAvailableToContext(api_name)) |
| + // continue; |
| Feature* feature = |
| BaseFeatureProvider::GetByName("api")->GetFeature(api_name); |
| @@ -750,7 +751,12 @@ void Dispatcher::RegisterSchemaGeneratedBindings( |
| bool only_ancestor_available = false; |
| for (size_t i = 0; i < split.size() - 1; ++i) { |
| ancestor_name += (i ? ".": "") + split[i]; |
| - if (!ancestor_name.empty() && |
| + // Only check if the ancestor is "app" for now, because this is the only |
| + // API that actually has children. If this checks every ancestor, the |
| + // API schemas will need to be loaded to check availability. This can go |
| + // back to checking all APIs once all the APIs have been converted to the |
| + // feature system. |
| + if (ancestor_name == "app" && !ancestor_name.empty() && |
|
not at google - send to devlin
2013/05/10 02:46:45
maybe you should comment out the second of these c
cduvall
2013/05/10 03:31:07
Done.
|
| context->GetAvailability(ancestor_name).is_available() && |
| !context->GetAvailability(api_name).is_available()) { |
| only_ancestor_available = true; |
| @@ -1053,29 +1059,12 @@ void Dispatcher::DidCreateScriptContext( |
| GetOrCreateChrome(v8_context); |
| - // Loading JavaScript is expensive, so only run the full API bindings |
| - // generation mechanisms in extension pages (NOT all web pages). |
| - switch (context_type) { |
| - case Feature::UNSPECIFIED_CONTEXT: |
| - case Feature::WEB_PAGE_CONTEXT: |
| - // TODO(kalman): see comment below about ExtensionAPI. |
| - InstallBindings(module_system.get(), v8_context, "app"); |
| - InstallBindings(module_system.get(), v8_context, "webstore"); |
| - break; |
| - case Feature::BLESSED_EXTENSION_CONTEXT: |
| - case Feature::UNBLESSED_EXTENSION_CONTEXT: |
| - case Feature::CONTENT_SCRIPT_CONTEXT: |
| - if (extension && !extension->is_platform_app()) |
| - module_system->Require("miscellaneous_bindings"); |
| - module_system->Require("json"); // see paranoid comment in json.js |
| - |
| - // TODO(kalman): move this code back out of the switch and execute it |
| - // regardless of |context_type|. ExtensionAPI knows how to return the |
| - // correct APIs, however, until it doesn't have a 2MB overhead we can't |
| - // load it in every process. |
| - RegisterSchemaGeneratedBindings(module_system.get(), context); |
| - break; |
| - } |
| + if (extension && !extension->is_platform_app()) |
|
not at google - send to devlin
2013/05/10 02:46:45
Maybe this _is_ a bit premature if there's still a
cduvall
2013/05/10 03:31:07
Tried the extension api thing, commented there.
|
| + module_system->Require("miscellaneous_bindings"); |
| + if (context_type != Feature::WEB_PAGE_CONTEXT) |
| + module_system->Require("json"); // see paranoid comment in json.js |
| + |
| + RegisterSchemaGeneratedBindings(module_system.get(), context); |
| bool is_within_platform_app = IsWithinPlatformApp(frame); |
| // Inject custom JS into the platform app context. |