Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/renderer/dispatcher.h" | 5 #include "extensions/renderer/dispatcher.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/alias.h" | 10 #include "base/debug/alias.h" |
| (...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1149 v8::HandleScope handle_scope(context->isolate()); | 1149 v8::HandleScope handle_scope(context->isolate()); |
| 1150 v8::Context::Scope context_scope(context->v8_context()); | 1150 v8::Context::Scope context_scope(context->v8_context()); |
| 1151 | 1151 |
| 1152 // TODO(kalman): Make the bindings registration have zero overhead then run | 1152 // TODO(kalman): Make the bindings registration have zero overhead then run |
| 1153 // the same code regardless of context type. | 1153 // the same code regardless of context type. |
| 1154 switch (context->context_type()) { | 1154 switch (context->context_type()) { |
| 1155 case Feature::UNSPECIFIED_CONTEXT: | 1155 case Feature::UNSPECIFIED_CONTEXT: |
| 1156 case Feature::WEB_PAGE_CONTEXT: | 1156 case Feature::WEB_PAGE_CONTEXT: |
| 1157 case Feature::BLESSED_WEB_PAGE_CONTEXT: | 1157 case Feature::BLESSED_WEB_PAGE_CONTEXT: |
| 1158 // Web page context; it's too expensive to run the full bindings code. | 1158 // Web page context; it's too expensive to run the full bindings code. |
| 1159 // Hard-code that the app and webstore APIs are available... | 1159 // Hard-code that the app and webstore APIs are available... |
|
not at google - send to devlin
2015/07/31 14:42:20
Could you fix this comment: "Hard-code registratio
Marc Treib
2015/07/31 15:28:42
Done.
| |
| 1160 if (context->GetAvailability("app").is_available()) | 1160 if (context->GetAvailability("app").is_available()) |
| 1161 RegisterBinding("app", context); | 1161 RegisterBinding("app", context); |
| 1162 if (context->GetAvailability("webstore").is_available()) | 1162 if (context->GetAvailability("webstore").is_available()) |
| 1163 RegisterBinding("webstore", context); | 1163 RegisterBinding("webstore", context); |
| 1164 if (context->GetAvailability("dashboardPrivate").is_available()) | |
| 1165 RegisterBinding("dashboardPrivate", context); | |
| 1164 if (IsRuntimeAvailableToContext(context)) | 1166 if (IsRuntimeAvailableToContext(context)) |
| 1165 RegisterBinding("runtime", context); | 1167 RegisterBinding("runtime", context); |
| 1166 UpdateContentCapabilities(context); | 1168 UpdateContentCapabilities(context); |
| 1167 break; | 1169 break; |
| 1168 | 1170 |
| 1169 case Feature::BLESSED_EXTENSION_CONTEXT: | 1171 case Feature::BLESSED_EXTENSION_CONTEXT: |
| 1170 case Feature::UNBLESSED_EXTENSION_CONTEXT: | 1172 case Feature::UNBLESSED_EXTENSION_CONTEXT: |
| 1171 case Feature::CONTENT_SCRIPT_CONTEXT: | 1173 case Feature::CONTENT_SCRIPT_CONTEXT: |
| 1172 case Feature::WEBUI_CONTEXT: { | 1174 case Feature::WEBUI_CONTEXT: { |
| 1173 // Extension context; iterate through all the APIs and bind the available | 1175 // Extension context; iterate through all the APIs and bind the available |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1452 void Dispatcher::AddChannelSpecificFeatures() { | 1454 void Dispatcher::AddChannelSpecificFeatures() { |
| 1453 // chrome-extension: resources should be allowed to register a Service Worker. | 1455 // chrome-extension: resources should be allowed to register a Service Worker. |
| 1454 if (FeatureProvider::GetBehaviorFeature(BehaviorFeature::kServiceWorker) | 1456 if (FeatureProvider::GetBehaviorFeature(BehaviorFeature::kServiceWorker) |
| 1455 ->IsAvailableToEnvironment() | 1457 ->IsAvailableToEnvironment() |
| 1456 .is_available()) | 1458 .is_available()) |
| 1457 WebSecurityPolicy::registerURLSchemeAsAllowingServiceWorkers( | 1459 WebSecurityPolicy::registerURLSchemeAsAllowingServiceWorkers( |
| 1458 WebString::fromUTF8(kExtensionScheme)); | 1460 WebString::fromUTF8(kExtensionScheme)); |
| 1459 } | 1461 } |
| 1460 | 1462 |
| 1461 } // namespace extensions | 1463 } // namespace extensions |
| OLD | NEW |