Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(257)

Side by Side Diff: extensions/renderer/dispatcher.cc

Issue 1211243010: [Service Worker Registration] Registered extension scheme to allow service workers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added license Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « extensions/renderer/dispatcher.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/metrics/histogram_macros.h" 12 #include "base/metrics/histogram_macros.h"
13 #include "base/metrics/user_metrics_action.h" 13 #include "base/metrics/user_metrics_action.h"
14 #include "base/strings/string_piece.h" 14 #include "base/strings/string_piece.h"
15 #include "base/strings/string_split.h" 15 #include "base/strings/string_split.h"
16 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
17 #include "base/strings/utf_string_conversions.h"
17 #include "base/time/time.h" 18 #include "base/time/time.h"
18 #include "base/values.h" 19 #include "base/values.h"
19 #include "content/grit/content_resources.h" 20 #include "content/grit/content_resources.h"
20 #include "content/public/child/v8_value_converter.h" 21 #include "content/public/child/v8_value_converter.h"
21 #include "content/public/common/content_switches.h" 22 #include "content/public/common/content_switches.h"
22 #include "content/public/common/url_constants.h" 23 #include "content/public/common/url_constants.h"
23 #include "content/public/renderer/render_frame.h" 24 #include "content/public/renderer/render_frame.h"
24 #include "content/public/renderer/render_thread.h" 25 #include "content/public/renderer/render_thread.h"
25 #include "extensions/common/api/messaging/message.h" 26 #include "extensions/common/api/messaging/message.h"
26 #include "extensions/common/constants.h" 27 #include "extensions/common/constants.h"
27 #include "extensions/common/extension_api.h" 28 #include "extensions/common/extension_api.h"
28 #include "extensions/common/extension_messages.h" 29 #include "extensions/common/extension_messages.h"
29 #include "extensions/common/extension_urls.h" 30 #include "extensions/common/extension_urls.h"
30 #include "extensions/common/feature_switch.h" 31 #include "extensions/common/feature_switch.h"
32 #include "extensions/common/features/behavior_feature.h"
31 #include "extensions/common/features/feature.h" 33 #include "extensions/common/features/feature.h"
32 #include "extensions/common/features/feature_provider.h" 34 #include "extensions/common/features/feature_provider.h"
33 #include "extensions/common/manifest.h" 35 #include "extensions/common/manifest.h"
34 #include "extensions/common/manifest_constants.h" 36 #include "extensions/common/manifest_constants.h"
35 #include "extensions/common/manifest_handlers/background_info.h" 37 #include "extensions/common/manifest_handlers/background_info.h"
36 #include "extensions/common/manifest_handlers/content_capabilities_handler.h" 38 #include "extensions/common/manifest_handlers/content_capabilities_handler.h"
37 #include "extensions/common/manifest_handlers/externally_connectable.h" 39 #include "extensions/common/manifest_handlers/externally_connectable.h"
38 #include "extensions/common/manifest_handlers/options_page_info.h" 40 #include "extensions/common/manifest_handlers/options_page_info.h"
39 #include "extensions/common/message_bundle.h" 41 #include "extensions/common/message_bundle.h"
40 #include "extensions/common/permissions/permission_set.h" 42 #include "extensions/common/permissions/permission_set.h"
(...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 const std::string& module_name, 907 const std::string& module_name,
906 const std::string& function_name, 908 const std::string& function_name,
907 const base::ListValue& args, 909 const base::ListValue& args,
908 bool user_gesture) { 910 bool user_gesture) {
909 InvokeModuleSystemMethod( 911 InvokeModuleSystemMethod(
910 NULL, extension_id, module_name, function_name, args, user_gesture); 912 NULL, extension_id, module_name, function_name, args, user_gesture);
911 } 913 }
912 914
913 void Dispatcher::OnSetChannel(int channel) { 915 void Dispatcher::OnSetChannel(int channel) {
914 delegate_->SetChannel(channel); 916 delegate_->SetChannel(channel);
917 AddChannelSpecificFeatures();
915 } 918 }
916 919
917 void Dispatcher::OnSetFunctionNames(const std::vector<std::string>& names) { 920 void Dispatcher::OnSetFunctionNames(const std::vector<std::string>& names) {
918 function_names_.clear(); 921 function_names_.clear();
919 for (size_t i = 0; i < names.size(); ++i) 922 for (size_t i = 0; i < names.size(); ++i)
920 function_names_.insert(names[i]); 923 function_names_.insert(names[i]);
921 } 924 }
922 925
923 void Dispatcher::OnSetScriptingWhitelist( 926 void Dispatcher::OnSetScriptingWhitelist(
924 const ExtensionsClient::ScriptingWhitelist& extension_ids) { 927 const ExtensionsClient::ScriptingWhitelist& extension_ids) {
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
1441 1444
1442 // The "guestViewDeny" module must always be loaded last. It registers 1445 // The "guestViewDeny" module must always be loaded last. It registers
1443 // error-providing custom elements for the GuestView types that are not 1446 // error-providing custom elements for the GuestView types that are not
1444 // available, and thus all of those types must have been checked and loaded 1447 // available, and thus all of those types must have been checked and loaded
1445 // (or not loaded) beforehand. 1448 // (or not loaded) beforehand.
1446 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) { 1449 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT) {
1447 module_system->Require("guestViewDeny"); 1450 module_system->Require("guestViewDeny");
1448 } 1451 }
1449 } 1452 }
1450 1453
1454 void Dispatcher::AddChannelSpecificFeatures() {
1455 // chrome-extension: resources should be allowed to register a Service Worker.
1456 if (FeatureProvider::GetBehaviorFeature(BehaviorFeature::kServiceWorker)
1457 ->IsAvailableToEnvironment()
1458 .is_available())
1459 WebSecurityPolicy::registerURLSchemeAsAllowingServiceWorkers(
1460 WebString::fromUTF8(kExtensionScheme));
1461 }
1462
1451 } // namespace extensions 1463 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/dispatcher.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698