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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 UpdateActivePermissions(extension, total.get()); | 68 UpdateActivePermissions(extension, total.get()); |
69 | 69 |
70 NotifyPermissionsUpdated(REMOVED, extension, removed.get()); | 70 NotifyPermissionsUpdated(REMOVED, extension, removed.get()); |
71 } | 71 } |
72 | 72 |
73 void PermissionsUpdater::GrantActivePermissions(const Extension* extension) { | 73 void PermissionsUpdater::GrantActivePermissions(const Extension* extension) { |
74 CHECK(extension); | 74 CHECK(extension); |
75 | 75 |
76 // We only maintain the granted permissions prefs for extensions that can't | 76 // We only maintain the granted permissions prefs for extensions that can't |
77 // silently increase their permissions. | 77 // silently increase their permissions. |
78 if (extension->CanSilentlyIncreasePermissions()) | 78 if (extension->CanSilentlyIncreasePermissionsWhileRunning()) |
79 return; | 79 return; |
80 | 80 |
81 GetExtensionPrefs()->AddGrantedPermissions( | 81 GetExtensionPrefs()->AddGrantedPermissions( |
82 extension->id(), extension->GetActivePermissions()); | 82 extension->id(), extension->GetActivePermissions()); |
83 } | 83 } |
84 | 84 |
85 void PermissionsUpdater::UpdateActivePermissions( | 85 void PermissionsUpdater::UpdateActivePermissions( |
86 const Extension* extension, const ExtensionPermissionSet* permissions) { | 86 const Extension* extension, const ExtensionPermissionSet* permissions) { |
87 GetExtensionPrefs()->SetActivePermissions(extension->id(), permissions); | 87 GetExtensionPrefs()->SetActivePermissions(extension->id(), permissions); |
88 extension->SetActivePermissions(permissions); | 88 extension->SetActivePermissions(permissions); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 146 |
147 // Trigger the onAdded and onRemoved events in the extension. | 147 // Trigger the onAdded and onRemoved events in the extension. |
148 DispatchEvent(extension->id(), event_name, changed); | 148 DispatchEvent(extension->id(), event_name, changed); |
149 } | 149 } |
150 | 150 |
151 ExtensionPrefs* PermissionsUpdater::GetExtensionPrefs() { | 151 ExtensionPrefs* PermissionsUpdater::GetExtensionPrefs() { |
152 return profile_->GetExtensionService()->extension_prefs(); | 152 return profile_->GetExtensionService()->extension_prefs(); |
153 } | 153 } |
154 | 154 |
155 } // namespace extensions | 155 } // namespace extensions |
OLD | NEW |