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 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 switch (reason) { | 743 switch (reason) { |
744 case UpdatedExtensionPermissionsInfo::ADDED: | 744 case UpdatedExtensionPermissionsInfo::ADDED: |
745 new_active = PermissionSet::CreateUnion(old_active.get(), delta.get()); | 745 new_active = PermissionSet::CreateUnion(old_active.get(), delta.get()); |
746 break; | 746 break; |
747 case UpdatedExtensionPermissionsInfo::REMOVED: | 747 case UpdatedExtensionPermissionsInfo::REMOVED: |
748 new_active = | 748 new_active = |
749 PermissionSet::CreateDifference(old_active.get(), delta.get()); | 749 PermissionSet::CreateDifference(old_active.get(), delta.get()); |
750 break; | 750 break; |
751 } | 751 } |
752 | 752 |
753 PermissionsData::SetActivePermissions(extension, new_active); | 753 PermissionsData::ForExtension(extension)->SetActivePermissions(new_active); |
754 UpdateOriginPermissions(reason, extension, explicit_hosts); | 754 UpdateOriginPermissions(reason, extension, explicit_hosts); |
755 UpdateBindings(extension->id()); | 755 UpdateBindings(extension->id()); |
756 } | 756 } |
757 | 757 |
758 void Dispatcher::OnUpdateTabSpecificPermissions( | 758 void Dispatcher::OnUpdateTabSpecificPermissions( |
759 int page_id, | 759 int page_id, |
760 int tab_id, | 760 int tab_id, |
761 const std::string& extension_id, | 761 const std::string& extension_id, |
762 const URLPatternSet& origin_set) { | 762 const URLPatternSet& origin_set) { |
763 delegate_->UpdateTabSpecificPermissions( | 763 delegate_->UpdateTabSpecificPermissions( |
(...skipping 17 matching lines...) Expand all Loading... |
781 user_script_slave_->GetActiveExtensions(&active_extensions); | 781 user_script_slave_->GetActiveExtensions(&active_extensions); |
782 delegate_->OnActiveExtensionsUpdated(active_extensions); | 782 delegate_->OnActiveExtensionsUpdated(active_extensions); |
783 } | 783 } |
784 | 784 |
785 void Dispatcher::InitOriginPermissions(const Extension* extension, | 785 void Dispatcher::InitOriginPermissions(const Extension* extension, |
786 Feature::Context context_type) { | 786 Feature::Context context_type) { |
787 delegate_->InitOriginPermissions(extension, context_type); | 787 delegate_->InitOriginPermissions(extension, context_type); |
788 UpdateOriginPermissions( | 788 UpdateOriginPermissions( |
789 UpdatedExtensionPermissionsInfo::ADDED, | 789 UpdatedExtensionPermissionsInfo::ADDED, |
790 extension, | 790 extension, |
791 PermissionsData::GetEffectiveHostPermissions(extension)); | 791 PermissionsData::ForExtension(extension)->GetEffectiveHostPermissions()); |
792 } | 792 } |
793 | 793 |
794 void Dispatcher::UpdateOriginPermissions( | 794 void Dispatcher::UpdateOriginPermissions( |
795 UpdatedExtensionPermissionsInfo::Reason reason, | 795 UpdatedExtensionPermissionsInfo::Reason reason, |
796 const Extension* extension, | 796 const Extension* extension, |
797 const URLPatternSet& origins) { | 797 const URLPatternSet& origins) { |
798 for (URLPatternSet::const_iterator i = origins.begin(); i != origins.end(); | 798 for (URLPatternSet::const_iterator i = origins.begin(); i != origins.end(); |
799 ++i) { | 799 ++i) { |
800 const char* schemes[] = { | 800 const char* schemes[] = { |
801 url::kHttpScheme, | 801 url::kHttpScheme, |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1218 return v8::Handle<v8::Object>(); | 1218 return v8::Handle<v8::Object>(); |
1219 | 1219 |
1220 if (bind_name) | 1220 if (bind_name) |
1221 *bind_name = split.back(); | 1221 *bind_name = split.back(); |
1222 | 1222 |
1223 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context)) | 1223 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context)) |
1224 : bind_object; | 1224 : bind_object; |
1225 } | 1225 } |
1226 | 1226 |
1227 } // namespace extensions | 1227 } // namespace extensions |
OLD | NEW |