| 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/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/debug/alias.h" | 9 #include "base/debug/alias.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 extension_group, | 252 extension_group, |
| 253 ScriptContext::GetDataSourceURLForFrame(frame), | 253 ScriptContext::GetDataSourceURLForFrame(frame), |
| 254 frame->document().securityOrigin()); | 254 frame->document().securityOrigin()); |
| 255 | 255 |
| 256 ScriptContext* context = | 256 ScriptContext* context = |
| 257 delegate_->CreateScriptContext(v8_context, frame, extension, context_type) | 257 delegate_->CreateScriptContext(v8_context, frame, extension, context_type) |
| 258 .release(); | 258 .release(); |
| 259 script_context_set_.Add(context); | 259 script_context_set_.Add(context); |
| 260 | 260 |
| 261 if (extension) { | 261 if (extension) { |
| 262 InitOriginPermissions(extension, context_type); | 262 InitOriginPermissions(extension); |
| 263 } | 263 } |
| 264 | 264 |
| 265 { | 265 { |
| 266 scoped_ptr<ModuleSystem> module_system( | 266 scoped_ptr<ModuleSystem> module_system( |
| 267 new ModuleSystem(context, &source_map_)); | 267 new ModuleSystem(context, &source_map_)); |
| 268 context->set_module_system(module_system.Pass()); | 268 context->set_module_system(module_system.Pass()); |
| 269 } | 269 } |
| 270 ModuleSystem* module_system = context->module_system(); | 270 ModuleSystem* module_system = context->module_system(); |
| 271 | 271 |
| 272 // Enable natives in startup. | 272 // Enable natives in startup. |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 bool other_webrequest) { | 790 bool other_webrequest) { |
| 791 delegate_->HandleWebRequestAPIUsage(adblock, adblock_plus, other_webrequest); | 791 delegate_->HandleWebRequestAPIUsage(adblock, adblock_plus, other_webrequest); |
| 792 } | 792 } |
| 793 | 793 |
| 794 void Dispatcher::UpdateActiveExtensions() { | 794 void Dispatcher::UpdateActiveExtensions() { |
| 795 std::set<std::string> active_extensions = active_extension_ids_; | 795 std::set<std::string> active_extensions = active_extension_ids_; |
| 796 user_script_slave_->GetActiveExtensions(&active_extensions); | 796 user_script_slave_->GetActiveExtensions(&active_extensions); |
| 797 delegate_->OnActiveExtensionsUpdated(active_extensions); | 797 delegate_->OnActiveExtensionsUpdated(active_extensions); |
| 798 } | 798 } |
| 799 | 799 |
| 800 void Dispatcher::InitOriginPermissions(const Extension* extension, | 800 void Dispatcher::InitOriginPermissions(const Extension* extension) { |
| 801 Feature::Context context_type) { | 801 delegate_->InitOriginPermissions(extension); |
| 802 delegate_->InitOriginPermissions(extension, context_type); | |
| 803 UpdateOriginPermissions( | 802 UpdateOriginPermissions( |
| 804 UpdatedExtensionPermissionsInfo::ADDED, | 803 UpdatedExtensionPermissionsInfo::ADDED, |
| 805 extension, | 804 extension, |
| 806 PermissionsData::ForExtension(extension)->GetEffectiveHostPermissions()); | 805 PermissionsData::ForExtension(extension)->GetEffectiveHostPermissions()); |
| 807 } | 806 } |
| 808 | 807 |
| 809 void Dispatcher::UpdateOriginPermissions( | 808 void Dispatcher::UpdateOriginPermissions( |
| 810 UpdatedExtensionPermissionsInfo::Reason reason, | 809 UpdatedExtensionPermissionsInfo::Reason reason, |
| 811 const Extension* extension, | 810 const Extension* extension, |
| 812 const URLPatternSet& origins) { | 811 const URLPatternSet& origins) { |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1233 return v8::Handle<v8::Object>(); | 1232 return v8::Handle<v8::Object>(); |
| 1234 | 1233 |
| 1235 if (bind_name) | 1234 if (bind_name) |
| 1236 *bind_name = split.back(); | 1235 *bind_name = split.back(); |
| 1237 | 1236 |
| 1238 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context)) | 1237 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context)) |
| 1239 : bind_object; | 1238 : bind_object; |
| 1240 } | 1239 } |
| 1241 | 1240 |
| 1242 } // namespace extensions | 1241 } // namespace extensions |
| OLD | NEW |