| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/renderer/extensions/dispatcher.h" | 5 #include "chrome/renderer/extensions/dispatcher.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/string_piece.h" | 10 #include "base/string_piece.h" |
| (...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 void Dispatcher::UpdateActiveExtensions() { | 966 void Dispatcher::UpdateActiveExtensions() { |
| 967 // In single-process mode, the browser process reports the active extensions. | 967 // In single-process mode, the browser process reports the active extensions. |
| 968 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)) | 968 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)) |
| 969 return; | 969 return; |
| 970 | 970 |
| 971 std::set<std::string> active_extensions = active_extension_ids_; | 971 std::set<std::string> active_extensions = active_extension_ids_; |
| 972 user_script_slave_->GetActiveExtensions(&active_extensions); | 972 user_script_slave_->GetActiveExtensions(&active_extensions); |
| 973 child_process_logging::SetActiveExtensions(active_extensions); | 973 child_process_logging::SetActiveExtensions(active_extensions); |
| 974 } | 974 } |
| 975 | 975 |
| 976 void Dispatcher::RegisterExtension(v8::Extension* extension, | |
| 977 bool restrict_to_extensions) { | |
| 978 if (restrict_to_extensions) | |
| 979 restricted_v8_extensions_.insert(extension->name()); | |
| 980 | |
| 981 RenderThread::Get()->RegisterExtension(extension); | |
| 982 } | |
| 983 | |
| 984 void Dispatcher::OnUsingWebRequestAPI( | 976 void Dispatcher::OnUsingWebRequestAPI( |
| 985 bool adblock, bool adblock_plus, bool other) { | 977 bool adblock, bool adblock_plus, bool other) { |
| 986 webrequest_adblock_ = adblock; | 978 webrequest_adblock_ = adblock; |
| 987 webrequest_adblock_plus_ = adblock_plus; | 979 webrequest_adblock_plus_ = adblock_plus; |
| 988 webrequest_other_ = other; | 980 webrequest_other_ = other; |
| 989 } | 981 } |
| 990 | 982 |
| 991 void Dispatcher::OnShouldUnload(const std::string& extension_id, | 983 void Dispatcher::OnShouldUnload(const std::string& extension_id, |
| 992 int sequence_id) { | 984 int sequence_id) { |
| 993 RenderThread::Get()->Send( | 985 RenderThread::Get()->Send( |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1109 // we should abort. | 1101 // we should abort. |
| 1110 WebKit::WebFrame* frame = context->web_frame(); | 1102 WebKit::WebFrame* frame = context->web_frame(); |
| 1111 ExtensionURLInfo url_info(frame->document().securityOrigin(), | 1103 ExtensionURLInfo url_info(frame->document().securityOrigin(), |
| 1112 UserScriptSlave::GetDataSourceURLForFrame(frame)); | 1104 UserScriptSlave::GetDataSourceURLForFrame(frame)); |
| 1113 CHECK(!extensions_.IsSandboxedPage(url_info)); | 1105 CHECK(!extensions_.IsSandboxedPage(url_info)); |
| 1114 | 1106 |
| 1115 return true; | 1107 return true; |
| 1116 } | 1108 } |
| 1117 | 1109 |
| 1118 } // namespace extensions | 1110 } // namespace extensions |
| OLD | NEW |