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/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1062 const std::string& module_name, | 1062 const std::string& module_name, |
1063 const std::string& function_name, | 1063 const std::string& function_name, |
1064 const base::ListValue& args, | 1064 const base::ListValue& args, |
1065 bool user_gesture) { | 1065 bool user_gesture) { |
1066 InvokeModuleSystemMethod( | 1066 InvokeModuleSystemMethod( |
1067 NULL, extension_id, module_name, function_name, args, user_gesture); | 1067 NULL, extension_id, module_name, function_name, args, user_gesture); |
1068 } | 1068 } |
1069 | 1069 |
1070 void Dispatcher::OnSetChannel(int channel) { | 1070 void Dispatcher::OnSetChannel(int channel) { |
1071 delegate_->SetChannel(channel); | 1071 delegate_->SetChannel(channel); |
| 1072 AddChannelSpecificFeatures(); |
1072 } | 1073 } |
1073 | 1074 |
1074 void Dispatcher::OnSetScriptingWhitelist( | 1075 void Dispatcher::OnSetScriptingWhitelist( |
1075 const ExtensionsClient::ScriptingWhitelist& extension_ids) { | 1076 const ExtensionsClient::ScriptingWhitelist& extension_ids) { |
1076 ExtensionsClient::Get()->SetScriptingWhitelist(extension_ids); | 1077 ExtensionsClient::Get()->SetScriptingWhitelist(extension_ids); |
1077 } | 1078 } |
1078 | 1079 |
1079 void Dispatcher::OnSetSystemFont(const std::string& font_family, | 1080 void Dispatcher::OnSetSystemFont(const std::string& font_family, |
1080 const std::string& font_size) { | 1081 const std::string& font_size) { |
1081 system_font_family_ = font_family; | 1082 system_font_family_ = font_family; |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1592 | 1593 |
1593 // The "guestViewDeny" module must always be loaded last. It registers | 1594 // The "guestViewDeny" module must always be loaded last. It registers |
1594 // error-providing custom elements for the GuestView types that are not | 1595 // error-providing custom elements for the GuestView types that are not |
1595 // available, and thus all of those types must have been checked and loaded | 1596 // available, and thus all of those types must have been checked and loaded |
1596 // (or not loaded) beforehand. | 1597 // (or not loaded) beforehand. |
1597 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { | 1598 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { |
1598 module_system->Require("guestViewDeny"); | 1599 module_system->Require("guestViewDeny"); |
1599 } | 1600 } |
1600 } | 1601 } |
1601 | 1602 |
| 1603 void Dispatcher::AddChannelSpecificFeatures() { |
| 1604 // chrome-extension: resources should be allowed to register a Service Worker. |
| 1605 if (FeatureProvider::GetBehaviorFeature(BehaviorFeature::kServiceWorker) |
| 1606 ->IsAvailableToEnvironment() |
| 1607 .is_available()) |
| 1608 WebSecurityPolicy::registerURLSchemeAsAllowingServiceWorkers( |
| 1609 WebString::fromUTF8(kExtensionScheme)); |
| 1610 } |
| 1611 |
1602 } // namespace extensions | 1612 } // namespace extensions |
OLD | NEW |