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

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

Issue 315573003: Remove PermissionsData::ForExtension() completely (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | Annotate | Revision Log
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/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
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::ForExtension(extension)->SetActivePermissions(new_active); 753 extension->permissions_data()->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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 Feature::Context context_type) {
802 delegate_->InitOriginPermissions(extension, context_type); 802 delegate_->InitOriginPermissions(extension, context_type);
803 UpdateOriginPermissions( 803 UpdateOriginPermissions(
804 UpdatedExtensionPermissionsInfo::ADDED, 804 UpdatedExtensionPermissionsInfo::ADDED,
805 extension, 805 extension,
806 PermissionsData::ForExtension(extension)->GetEffectiveHostPermissions()); 806 extension->permissions_data()->GetEffectiveHostPermissions());
807 } 807 }
808 808
809 void Dispatcher::UpdateOriginPermissions( 809 void Dispatcher::UpdateOriginPermissions(
810 UpdatedExtensionPermissionsInfo::Reason reason, 810 UpdatedExtensionPermissionsInfo::Reason reason,
811 const Extension* extension, 811 const Extension* extension,
812 const URLPatternSet& origins) { 812 const URLPatternSet& origins) {
813 for (URLPatternSet::const_iterator i = origins.begin(); i != origins.end(); 813 for (URLPatternSet::const_iterator i = origins.begin(); i != origins.end();
814 ++i) { 814 ++i) {
815 const char* schemes[] = { 815 const char* schemes[] = {
816 url::kHttpScheme, 816 url::kHttpScheme,
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 return v8::Handle<v8::Object>(); 1233 return v8::Handle<v8::Object>();
1234 1234
1235 if (bind_name) 1235 if (bind_name)
1236 *bind_name = split.back(); 1236 *bind_name = split.back();
1237 1237
1238 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context)) 1238 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context))
1239 : bind_object; 1239 : bind_object;
1240 } 1240 }
1241 1241
1242 } // namespace extensions 1242 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/permissions/permissions_data_unittest.cc ('k') | extensions/renderer/script_injection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698