| 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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 | 287 |
| 288 const Extension* extension = | 288 const Extension* extension = |
| 289 ExtensionRegistry::Get(context) | 289 ExtensionRegistry::Get(context) |
| 290 ->GetExtensionById(extension_id, ExtensionRegistry::ENABLED); | 290 ->GetExtensionById(extension_id, ExtensionRegistry::ENABLED); |
| 291 if (extension && extension->is_shared_module()) { | 291 if (extension && extension->is_shared_module()) { |
| 292 // We have to check all the extensions that use this shared module for idle | 292 // We have to check all the extensions that use this shared module for idle |
| 293 // to tell whether it is really 'idle'. | 293 // to tell whether it is really 'idle'. |
| 294 SharedModuleService* service = ExtensionSystem::Get(context) | 294 SharedModuleService* service = ExtensionSystem::Get(context) |
| 295 ->extension_service() | 295 ->extension_service() |
| 296 ->shared_module_service(); | 296 ->shared_module_service(); |
| 297 scoped_ptr<ExtensionSet> dependents = | 297 std::unique_ptr<ExtensionSet> dependents = |
| 298 service->GetDependentExtensions(extension); | 298 service->GetDependentExtensions(extension); |
| 299 for (ExtensionSet::const_iterator i = dependents->begin(); | 299 for (ExtensionSet::const_iterator i = dependents->begin(); |
| 300 i != dependents->end(); | 300 i != dependents->end(); |
| 301 i++) { | 301 i++) { |
| 302 ids_to_check.push_back((*i)->id()); | 302 ids_to_check.push_back((*i)->id()); |
| 303 } | 303 } |
| 304 } | 304 } |
| 305 | 305 |
| 306 ProcessManager* process_manager = ProcessManager::Get(context); | 306 ProcessManager* process_manager = ProcessManager::Get(context); |
| 307 for (std::vector<std::string>::const_iterator i = ids_to_check.begin(); | 307 for (std::vector<std::string>::const_iterator i = ids_to_check.begin(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 323 } | 323 } |
| 324 return true; | 324 return true; |
| 325 } | 325 } |
| 326 | 326 |
| 327 GURL GetSiteForExtensionId(const std::string& extension_id, | 327 GURL GetSiteForExtensionId(const std::string& extension_id, |
| 328 content::BrowserContext* context) { | 328 content::BrowserContext* context) { |
| 329 return content::SiteInstance::GetSiteForURL( | 329 return content::SiteInstance::GetSiteForURL( |
| 330 context, Extension::GetBaseURLFromExtensionId(extension_id)); | 330 context, Extension::GetBaseURLFromExtensionId(extension_id)); |
| 331 } | 331 } |
| 332 | 332 |
| 333 scoped_ptr<base::DictionaryValue> GetExtensionInfo(const Extension* extension) { | 333 std::unique_ptr<base::DictionaryValue> GetExtensionInfo( |
| 334 const Extension* extension) { |
| 334 DCHECK(extension); | 335 DCHECK(extension); |
| 335 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue); | 336 std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue); |
| 336 | 337 |
| 337 dict->SetString("id", extension->id()); | 338 dict->SetString("id", extension->id()); |
| 338 dict->SetString("name", extension->name()); | 339 dict->SetString("name", extension->name()); |
| 339 | 340 |
| 340 GURL icon = extensions::ExtensionIconSource::GetIconURL( | 341 GURL icon = extensions::ExtensionIconSource::GetIconURL( |
| 341 extension, | 342 extension, |
| 342 extension_misc::EXTENSION_ICON_SMALLISH, | 343 extension_misc::EXTENSION_ICON_SMALLISH, |
| 343 ExtensionIconSet::MATCH_BIGGER, | 344 ExtensionIconSet::MATCH_BIGGER, |
| 344 false, // Not grayscale. | 345 false, // Not grayscale. |
| 345 NULL); // Don't set bool if exists. | 346 NULL); // Don't set bool if exists. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 base::FieldTrialList::FindFullName( | 389 base::FieldTrialList::FindFullName( |
| 389 kSupervisedUserExtensionPermissionIncreaseFieldTrialName); | 390 kSupervisedUserExtensionPermissionIncreaseFieldTrialName); |
| 390 std::string value = variations::GetVariationParamValue( | 391 std::string value = variations::GetVariationParamValue( |
| 391 kSupervisedUserExtensionPermissionIncreaseFieldTrialName, | 392 kSupervisedUserExtensionPermissionIncreaseFieldTrialName, |
| 392 profile->IsChild() ? "child_account" : "legacy_supervised_user"); | 393 profile->IsChild() ? "child_account" : "legacy_supervised_user"); |
| 393 return value == "true"; | 394 return value == "true"; |
| 394 } | 395 } |
| 395 | 396 |
| 396 } // namespace util | 397 } // namespace util |
| 397 } // namespace extensions | 398 } // namespace extensions |
| OLD | NEW |