| 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 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1340 | 1340 |
| 1341 v8::Local<v8::Object> new_object = v8::Object::New(isolate); | 1341 v8::Local<v8::Object> new_object = v8::Object::New(isolate); |
| 1342 object->Set(key, new_object); | 1342 object->Set(key, new_object); |
| 1343 return new_object; | 1343 return new_object; |
| 1344 } | 1344 } |
| 1345 | 1345 |
| 1346 v8::Local<v8::Object> Dispatcher::GetOrCreateBindObjectIfAvailable( | 1346 v8::Local<v8::Object> Dispatcher::GetOrCreateBindObjectIfAvailable( |
| 1347 const std::string& api_name, | 1347 const std::string& api_name, |
| 1348 std::string* bind_name, | 1348 std::string* bind_name, |
| 1349 ScriptContext* context) { | 1349 ScriptContext* context) { |
| 1350 std::vector<std::string> split; | 1350 std::vector<std::string> split = base::SplitString( |
| 1351 base::SplitString(api_name, '.', &split); | 1351 api_name, ".", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
| 1352 | 1352 |
| 1353 v8::Local<v8::Object> bind_object; | 1353 v8::Local<v8::Object> bind_object; |
| 1354 | 1354 |
| 1355 // Check if this API has an ancestor. If the API's ancestor is available and | 1355 // Check if this API has an ancestor. If the API's ancestor is available and |
| 1356 // the API is not available, don't install the bindings for this API. If | 1356 // the API is not available, don't install the bindings for this API. If |
| 1357 // the API is available and its ancestor is not, delete the ancestor and | 1357 // the API is available and its ancestor is not, delete the ancestor and |
| 1358 // install the bindings for the API. This is to prevent loading the ancestor | 1358 // install the bindings for the API. This is to prevent loading the ancestor |
| 1359 // API schema if it will not be needed. | 1359 // API schema if it will not be needed. |
| 1360 // | 1360 // |
| 1361 // For example: | 1361 // For example: |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1445 void Dispatcher::AddChannelSpecificFeatures() { | 1445 void Dispatcher::AddChannelSpecificFeatures() { |
| 1446 // chrome-extension: resources should be allowed to register a Service Worker. | 1446 // chrome-extension: resources should be allowed to register a Service Worker. |
| 1447 if (FeatureProvider::GetBehaviorFeature(BehaviorFeature::kServiceWorker) | 1447 if (FeatureProvider::GetBehaviorFeature(BehaviorFeature::kServiceWorker) |
| 1448 ->IsAvailableToEnvironment() | 1448 ->IsAvailableToEnvironment() |
| 1449 .is_available()) | 1449 .is_available()) |
| 1450 WebSecurityPolicy::registerURLSchemeAsAllowingServiceWorkers( | 1450 WebSecurityPolicy::registerURLSchemeAsAllowingServiceWorkers( |
| 1451 WebString::fromUTF8(kExtensionScheme)); | 1451 WebString::fromUTF8(kExtensionScheme)); |
| 1452 } | 1452 } |
| 1453 | 1453 |
| 1454 } // namespace extensions | 1454 } // namespace extensions |
| OLD | NEW |