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 // TODO(rickcam): Bug 73183: Add unit tests for image loading | 5 // TODO(rickcam): Bug 73183: Add unit tests for image loading |
6 | 6 |
7 #include <cstdlib> | 7 #include <cstdlib> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "chrome/browser/background/background_application_list_model.h" | 10 #include "chrome/browser/background/background_application_list_model.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 110 |
111 void AddBackgroundPermission(ExtensionService* service, | 111 void AddBackgroundPermission(ExtensionService* service, |
112 Extension* extension) { | 112 Extension* extension) { |
113 if (BackgroundApplicationListModel::IsBackgroundApp(*extension, | 113 if (BackgroundApplicationListModel::IsBackgroundApp(*extension, |
114 service->profile())) { | 114 service->profile())) { |
115 return; | 115 return; |
116 } | 116 } |
117 | 117 |
118 scoped_refptr<Extension> temporary = | 118 scoped_refptr<Extension> temporary = |
119 CreateExtension(GenerateUniqueExtensionName(), true); | 119 CreateExtension(GenerateUniqueExtensionName(), true); |
120 scoped_refptr<const extensions::PermissionSet> permissions = | 120 const extensions::PermissionSet* permissions = |
121 temporary->permissions_data()->active_permissions(); | 121 temporary->permissions_data()->active_permissions(); |
122 extensions::PermissionsUpdater(service->profile()).AddPermissions( | 122 extensions::PermissionsUpdater(service->profile()) |
123 extension, permissions.get()); | 123 .AddPermissions(extension, permissions); |
124 } | 124 } |
125 | 125 |
126 void RemoveBackgroundPermission(ExtensionService* service, | 126 void RemoveBackgroundPermission(ExtensionService* service, |
127 Extension* extension) { | 127 Extension* extension) { |
128 if (!BackgroundApplicationListModel::IsBackgroundApp(*extension, | 128 if (!BackgroundApplicationListModel::IsBackgroundApp(*extension, |
129 service->profile())) { | 129 service->profile())) { |
130 return; | 130 return; |
131 } | 131 } |
132 extensions::PermissionsUpdater(service->profile()) | 132 extensions::PermissionsUpdater(service->profile()) |
133 .RemovePermissionsUnsafe( | 133 .RemovePermissionsUnsafe( |
134 extension, extension->permissions_data()->active_permissions().get()); | 134 extension, extension->permissions_data()->active_permissions()); |
135 } | 135 } |
136 | 136 |
137 void AddEphemeralApp(const Extension* extension, ExtensionService* service) { | 137 void AddEphemeralApp(const Extension* extension, ExtensionService* service) { |
138 extensions::ExtensionPrefs* prefs = | 138 extensions::ExtensionPrefs* prefs = |
139 extensions::ExtensionPrefs::Get(service->profile()); | 139 extensions::ExtensionPrefs::Get(service->profile()); |
140 ASSERT_TRUE(prefs); | 140 ASSERT_TRUE(prefs); |
141 prefs->OnExtensionInstalled(extension, | 141 prefs->OnExtensionInstalled(extension, |
142 extensions::Extension::ENABLED, | 142 extensions::Extension::ENABLED, |
143 syncer::StringOrdinal(), | 143 syncer::StringOrdinal(), |
144 extensions::kInstallFlagIsEphemeral, | 144 extensions::kInstallFlagIsEphemeral, |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 case 2: | 436 case 2: |
437 TogglePermission(service(), &extensions, model.get(), &expected, | 437 TogglePermission(service(), &extensions, model.get(), &expected, |
438 &count); | 438 &count); |
439 break; | 439 break; |
440 default: | 440 default: |
441 NOTREACHED(); | 441 NOTREACHED(); |
442 break; | 442 break; |
443 } | 443 } |
444 } | 444 } |
445 } | 445 } |
OLD | NEW |