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/browser/extensions/permissions_updater.h" | 5 #include "chrome/browser/extensions/permissions_updater.h" |
6 | 6 |
7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/extensions/api/permissions/permissions_api_helpers.h" | 10 #include "chrome/browser/extensions/api/permissions/permissions_api_helpers.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 void PermissionsUpdater::GrantActivePermissions(const Extension* extension) { | 76 void PermissionsUpdater::GrantActivePermissions(const Extension* extension) { |
77 CHECK(extension); | 77 CHECK(extension); |
78 | 78 |
79 // We only maintain the granted permissions prefs for INTERNAL and LOAD | 79 // We only maintain the granted permissions prefs for INTERNAL and LOAD |
80 // extensions. | 80 // extensions. |
81 if (!Manifest::IsUnpackedLocation(extension->location()) && | 81 if (!Manifest::IsUnpackedLocation(extension->location()) && |
82 extension->location() != Manifest::INTERNAL) | 82 extension->location() != Manifest::INTERNAL) |
83 return; | 83 return; |
84 | 84 |
85 ExtensionPrefs::Get(profile_)->AddGrantedPermissions( | 85 ExtensionPrefs::Get(profile_)->AddGrantedPermissions( |
86 extension->id(), extension->GetActivePermissions()); | 86 extension->id(), extension->GetActivePermissions().get()); |
87 } | 87 } |
88 | 88 |
89 void PermissionsUpdater::UpdateActivePermissions( | 89 void PermissionsUpdater::UpdateActivePermissions( |
90 const Extension* extension, const PermissionSet* permissions) { | 90 const Extension* extension, const PermissionSet* permissions) { |
91 ExtensionPrefs::Get(profile_)->SetActivePermissions( | 91 ExtensionPrefs::Get(profile_)->SetActivePermissions( |
92 extension->id(), permissions); | 92 extension->id(), permissions); |
93 PermissionsData::SetActivePermissions(extension, permissions); | 93 PermissionsData::SetActivePermissions(extension, permissions); |
94 } | 94 } |
95 | 95 |
96 void PermissionsUpdater::DispatchEvent( | 96 void PermissionsUpdater::DispatchEvent( |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 changed->apis(), | 150 changed->apis(), |
151 changed->explicit_hosts(), | 151 changed->explicit_hosts(), |
152 changed->scriptable_hosts())); | 152 changed->scriptable_hosts())); |
153 } | 153 } |
154 | 154 |
155 // Trigger the onAdded and onRemoved events in the extension. | 155 // Trigger the onAdded and onRemoved events in the extension. |
156 DispatchEvent(extension->id(), event_name, changed); | 156 DispatchEvent(extension->id(), event_name, changed); |
157 } | 157 } |
158 | 158 |
159 } // namespace extensions | 159 } // namespace extensions |
OLD | NEW |