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(); | |
1073 } | 1072 } |
1074 | 1073 |
1075 void Dispatcher::OnSetScriptingWhitelist( | 1074 void Dispatcher::OnSetScriptingWhitelist( |
1076 const ExtensionsClient::ScriptingWhitelist& extension_ids) { | 1075 const ExtensionsClient::ScriptingWhitelist& extension_ids) { |
1077 ExtensionsClient::Get()->SetScriptingWhitelist(extension_ids); | 1076 ExtensionsClient::Get()->SetScriptingWhitelist(extension_ids); |
1078 } | 1077 } |
1079 | 1078 |
1080 void Dispatcher::OnSetSystemFont(const std::string& font_family, | 1079 void Dispatcher::OnSetSystemFont(const std::string& font_family, |
1081 const std::string& font_size) { | 1080 const std::string& font_size) { |
1082 system_font_family_ = font_family; | 1081 system_font_family_ = font_family; |
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1593 | 1592 |
1594 // The "guestViewDeny" module must always be loaded last. It registers | 1593 // The "guestViewDeny" module must always be loaded last. It registers |
1595 // error-providing custom elements for the GuestView types that are not | 1594 // error-providing custom elements for the GuestView types that are not |
1596 // available, and thus all of those types must have been checked and loaded | 1595 // available, and thus all of those types must have been checked and loaded |
1597 // (or not loaded) beforehand. | 1596 // (or not loaded) beforehand. |
1598 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { | 1597 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { |
1599 module_system->Require("guestViewDeny"); | 1598 module_system->Require("guestViewDeny"); |
1600 } | 1599 } |
1601 } | 1600 } |
1602 | 1601 |
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 | |
1612 } // namespace extensions | 1602 } // namespace extensions |
OLD | NEW |