| 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/ui/webui/extensions/extension_settings_handler.h" | 5 #include "chrome/browser/ui/webui/extensions/extension_settings_handler.h" |
| 6 | 6 |
| 7 #include "apps/app_load_service.h" | 7 #include "apps/app_load_service.h" |
| 8 #include "apps/app_restore_service.h" | 8 #include "apps/app_restore_service.h" |
| 9 #include "apps/saved_files_service.h" | 9 #include "apps/saved_files_service.h" |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 void ExtensionSettingsHandler::InstallUIAbort(bool user_initiated) { | 534 void ExtensionSettingsHandler::InstallUIAbort(bool user_initiated) { |
| 535 extension_id_prompting_.clear(); | 535 extension_id_prompting_.clear(); |
| 536 } | 536 } |
| 537 | 537 |
| 538 void ExtensionSettingsHandler::ReloadUnpackedExtensions() { | 538 void ExtensionSettingsHandler::ReloadUnpackedExtensions() { |
| 539 const ExtensionSet* extensions = extension_service_->extensions(); | 539 const ExtensionSet* extensions = extension_service_->extensions(); |
| 540 std::vector<const Extension*> unpacked_extensions; | 540 std::vector<const Extension*> unpacked_extensions; |
| 541 for (ExtensionSet::const_iterator extension = extensions->begin(); | 541 for (ExtensionSet::const_iterator extension = extensions->begin(); |
| 542 extension != extensions->end(); ++extension) { | 542 extension != extensions->end(); ++extension) { |
| 543 if (Manifest::IsUnpackedLocation((*extension)->location())) | 543 if (Manifest::IsUnpackedLocation((*extension)->location())) |
| 544 unpacked_extensions.push_back(*extension); | 544 unpacked_extensions.push_back(extension->get()); |
| 545 } | 545 } |
| 546 | 546 |
| 547 for (std::vector<const Extension*>::iterator iter = | 547 for (std::vector<const Extension*>::iterator iter = |
| 548 unpacked_extensions.begin(); iter != unpacked_extensions.end(); ++iter) { | 548 unpacked_extensions.begin(); iter != unpacked_extensions.end(); ++iter) { |
| 549 extension_service_->ReloadExtension((*iter)->id()); | 549 extension_service_->ReloadExtension((*iter)->id()); |
| 550 } | 550 } |
| 551 } | 551 } |
| 552 | 552 |
| 553 void ExtensionSettingsHandler::HandleRequestExtensionsData( | 553 void ExtensionSettingsHandler::HandleRequestExtensionsData( |
| 554 const ListValue* args) { | 554 const ListValue* args) { |
| 555 DictionaryValue results; | 555 DictionaryValue results; |
| 556 | 556 |
| 557 Profile* profile = Profile::FromWebUI(web_ui()); | 557 Profile* profile = Profile::FromWebUI(web_ui()); |
| 558 | 558 |
| 559 // Add the extensions to the results structure. | 559 // Add the extensions to the results structure. |
| 560 ListValue* extensions_list = new ListValue(); | 560 ListValue* extensions_list = new ListValue(); |
| 561 | 561 |
| 562 extensions::ExtensionWarningService* warnings = | 562 extensions::ExtensionWarningService* warnings = |
| 563 extensions::ExtensionSystem::Get(profile)->warning_service(); | 563 extensions::ExtensionSystem::Get(profile)->warning_service(); |
| 564 | 564 |
| 565 const ExtensionSet* extensions = extension_service_->extensions(); | 565 const ExtensionSet* extensions = extension_service_->extensions(); |
| 566 for (ExtensionSet::const_iterator extension = extensions->begin(); | 566 for (ExtensionSet::const_iterator extension = extensions->begin(); |
| 567 extension != extensions->end(); ++extension) { | 567 extension != extensions->end(); ++extension) { |
| 568 if ((*extension)->ShouldDisplayInExtensionSettings()) { | 568 if ((*extension)->ShouldDisplayInExtensionSettings()) { |
| 569 extensions_list->Append(CreateExtensionDetailValue( | 569 extensions_list->Append(CreateExtensionDetailValue( |
| 570 *extension, | 570 extension->get(), |
| 571 GetInspectablePagesForExtension(*extension, true), | 571 GetInspectablePagesForExtension(extension->get(), true), |
| 572 warnings)); | 572 warnings)); |
| 573 } | 573 } |
| 574 } | 574 } |
| 575 extensions = extension_service_->disabled_extensions(); | 575 extensions = extension_service_->disabled_extensions(); |
| 576 for (ExtensionSet::const_iterator extension = extensions->begin(); | 576 for (ExtensionSet::const_iterator extension = extensions->begin(); |
| 577 extension != extensions->end(); ++extension) { | 577 extension != extensions->end(); ++extension) { |
| 578 if ((*extension)->ShouldDisplayInExtensionSettings()) { | 578 if ((*extension)->ShouldDisplayInExtensionSettings()) { |
| 579 extensions_list->Append(CreateExtensionDetailValue( | 579 extensions_list->Append(CreateExtensionDetailValue( |
| 580 *extension, | 580 extension->get(), |
| 581 GetInspectablePagesForExtension(*extension, false), | 581 GetInspectablePagesForExtension(extension->get(), false), |
| 582 warnings)); | 582 warnings)); |
| 583 } | 583 } |
| 584 } | 584 } |
| 585 extensions = extension_service_->terminated_extensions(); | 585 extensions = extension_service_->terminated_extensions(); |
| 586 std::vector<ExtensionPage> empty_pages; | 586 std::vector<ExtensionPage> empty_pages; |
| 587 for (ExtensionSet::const_iterator extension = extensions->begin(); | 587 for (ExtensionSet::const_iterator extension = extensions->begin(); |
| 588 extension != extensions->end(); ++extension) { | 588 extension != extensions->end(); ++extension) { |
| 589 if ((*extension)->ShouldDisplayInExtensionSettings()) { | 589 if ((*extension)->ShouldDisplayInExtensionSettings()) { |
| 590 extensions_list->Append(CreateExtensionDetailValue( | 590 extensions_list->Append(CreateExtensionDetailValue( |
| 591 *extension, | 591 extension->get(), |
| 592 empty_pages, // Terminated process has no active pages. | 592 empty_pages, // Terminated process has no active pages. |
| 593 warnings)); | 593 warnings)); |
| 594 } | 594 } |
| 595 } | 595 } |
| 596 results.Set("extensions", extensions_list); | 596 results.Set("extensions", extensions_list); |
| 597 | 597 |
| 598 ManagedUserService* service = | 598 ManagedUserService* service = |
| 599 ManagedUserServiceFactory::GetForProfile(profile); | 599 ManagedUserServiceFactory::GetForProfile(profile); |
| 600 | 600 |
| 601 bool is_managed = service->ProfileIsManaged(); | 601 bool is_managed = service->ProfileIsManaged(); |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1062 std::vector<std::string> requirement_errors) { | 1062 std::vector<std::string> requirement_errors) { |
| 1063 if (requirement_errors.empty()) { | 1063 if (requirement_errors.empty()) { |
| 1064 extension_service_->EnableExtension(extension_id); | 1064 extension_service_->EnableExtension(extension_id); |
| 1065 } else { | 1065 } else { |
| 1066 ExtensionErrorReporter::GetInstance()->ReportError( | 1066 ExtensionErrorReporter::GetInstance()->ReportError( |
| 1067 UTF8ToUTF16(JoinString(requirement_errors, ' ')), | 1067 UTF8ToUTF16(JoinString(requirement_errors, ' ')), |
| 1068 true /* be noisy */); | 1068 true /* be noisy */); |
| 1069 } | 1069 } |
| 1070 requirements_checker_.reset(); | 1070 requirements_checker_.reset(); |
| 1071 } | 1071 } |
| OLD | NEW |