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

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

Issue 309533007: Refactor PermissionsData pt1 (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 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 switch (reason) { 738 switch (reason) {
739 case UpdatedExtensionPermissionsInfo::ADDED: 739 case UpdatedExtensionPermissionsInfo::ADDED:
740 new_active = PermissionSet::CreateUnion(old_active.get(), delta.get()); 740 new_active = PermissionSet::CreateUnion(old_active.get(), delta.get());
741 break; 741 break;
742 case UpdatedExtensionPermissionsInfo::REMOVED: 742 case UpdatedExtensionPermissionsInfo::REMOVED:
743 new_active = 743 new_active =
744 PermissionSet::CreateDifference(old_active.get(), delta.get()); 744 PermissionSet::CreateDifference(old_active.get(), delta.get());
745 break; 745 break;
746 } 746 }
747 747
748 PermissionsData::SetActivePermissions(extension, new_active); 748 PermissionsData::ForExtension(extension)->SetActivePermissions(new_active);
749 UpdateOriginPermissions(reason, extension, explicit_hosts); 749 UpdateOriginPermissions(reason, extension, explicit_hosts);
750 UpdateBindings(extension->id()); 750 UpdateBindings(extension->id());
751 } 751 }
752 752
753 void Dispatcher::OnUpdateTabSpecificPermissions( 753 void Dispatcher::OnUpdateTabSpecificPermissions(
754 int page_id, 754 int page_id,
755 int tab_id, 755 int tab_id,
756 const std::string& extension_id, 756 const std::string& extension_id,
757 const URLPatternSet& origin_set) { 757 const URLPatternSet& origin_set) {
758 delegate_->UpdateTabSpecificPermissions( 758 delegate_->UpdateTabSpecificPermissions(
(...skipping 17 matching lines...) Expand all
776 user_script_slave_->GetActiveExtensions(&active_extensions); 776 user_script_slave_->GetActiveExtensions(&active_extensions);
777 delegate_->OnActiveExtensionsUpdated(active_extensions); 777 delegate_->OnActiveExtensionsUpdated(active_extensions);
778 } 778 }
779 779
780 void Dispatcher::InitOriginPermissions(const Extension* extension, 780 void Dispatcher::InitOriginPermissions(const Extension* extension,
781 Feature::Context context_type) { 781 Feature::Context context_type) {
782 delegate_->InitOriginPermissions(extension, context_type); 782 delegate_->InitOriginPermissions(extension, context_type);
783 UpdateOriginPermissions( 783 UpdateOriginPermissions(
784 UpdatedExtensionPermissionsInfo::ADDED, 784 UpdatedExtensionPermissionsInfo::ADDED,
785 extension, 785 extension,
786 PermissionsData::GetEffectiveHostPermissions(extension)); 786 PermissionsData::ForExtension(extension)->GetEffectiveHostPermissions());
787 } 787 }
788 788
789 void Dispatcher::UpdateOriginPermissions( 789 void Dispatcher::UpdateOriginPermissions(
790 UpdatedExtensionPermissionsInfo::Reason reason, 790 UpdatedExtensionPermissionsInfo::Reason reason,
791 const Extension* extension, 791 const Extension* extension,
792 const URLPatternSet& origins) { 792 const URLPatternSet& origins) {
793 for (URLPatternSet::const_iterator i = origins.begin(); i != origins.end(); 793 for (URLPatternSet::const_iterator i = origins.begin(); i != origins.end();
794 ++i) { 794 ++i) {
795 const char* schemes[] = { 795 const char* schemes[] = {
796 url::kHttpScheme, 796 url::kHttpScheme,
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
1213 return v8::Handle<v8::Object>(); 1213 return v8::Handle<v8::Object>();
1214 1214
1215 if (bind_name) 1215 if (bind_name)
1216 *bind_name = split.back(); 1216 *bind_name = split.back();
1217 1217
1218 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context)) 1218 return bind_object.IsEmpty() ? AsObjectOrEmpty(GetOrCreateChrome(context))
1219 : bind_object; 1219 : bind_object;
1220 } 1220 }
1221 1221
1222 } // namespace extensions 1222 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698