OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/extension_util.h" | 5 #include "chrome/browser/extensions/extension_util.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 } | 190 } |
191 | 191 |
192 void SetWasInstalledByCustodian(const std::string& extension_id, | 192 void SetWasInstalledByCustodian(const std::string& extension_id, |
193 content::BrowserContext* context, | 193 content::BrowserContext* context, |
194 bool installed_by_custodian) { | 194 bool installed_by_custodian) { |
195 if (installed_by_custodian == WasInstalledByCustodian(extension_id, context)) | 195 if (installed_by_custodian == WasInstalledByCustodian(extension_id, context)) |
196 return; | 196 return; |
197 | 197 |
198 ExtensionPrefs::Get(context)->UpdateExtensionPref( | 198 ExtensionPrefs::Get(context)->UpdateExtensionPref( |
199 extension_id, kWasInstalledByCustodianPrefName, | 199 extension_id, kWasInstalledByCustodianPrefName, |
200 installed_by_custodian ? new base::FundamentalValue(true) : nullptr); | 200 installed_by_custodian ? new base::Value(true) : nullptr); |
201 ExtensionService* service = | 201 ExtensionService* service = |
202 ExtensionSystem::Get(context)->extension_service(); | 202 ExtensionSystem::Get(context)->extension_service(); |
203 | 203 |
204 if (!installed_by_custodian) { | 204 if (!installed_by_custodian) { |
205 // If installed_by_custodian changes to false, the extension may need to | 205 // If installed_by_custodian changes to false, the extension may need to |
206 // be unloaded now. | 206 // be unloaded now. |
207 service->ReloadExtension(extension_id); | 207 service->ReloadExtension(extension_id); |
208 return; | 208 return; |
209 } | 209 } |
210 | 210 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 #endif | 347 #endif |
348 } | 348 } |
349 | 349 |
350 bool IsExtensionSupervised(const Extension* extension, Profile* profile) { | 350 bool IsExtensionSupervised(const Extension* extension, Profile* profile) { |
351 return WasInstalledByCustodian(extension->id(), profile) && | 351 return WasInstalledByCustodian(extension->id(), profile) && |
352 profile->IsSupervised(); | 352 profile->IsSupervised(); |
353 } | 353 } |
354 | 354 |
355 } // namespace util | 355 } // namespace util |
356 } // namespace extensions | 356 } // namespace extensions |
OLD | NEW |