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 "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/base64.h" | 8 #include "base/base64.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
707 | 707 |
708 extension_id_prompting_ = extension_id; | 708 extension_id_prompting_ = extension_id; |
709 | 709 |
710 GetExtensionUninstallDialog()->ConfirmUninstall(extension); | 710 GetExtensionUninstallDialog()->ConfirmUninstall(extension); |
711 } | 711 } |
712 | 712 |
713 void ExtensionSettingsHandler::HandleOptionsMessage(const ListValue* args) { | 713 void ExtensionSettingsHandler::HandleOptionsMessage(const ListValue* args) { |
714 const Extension* extension = GetActiveExtension(args); | 714 const Extension* extension = GetActiveExtension(args); |
715 if (!extension || extension->options_url().is_empty()) | 715 if (!extension || extension->options_url().is_empty()) |
716 return; | 716 return; |
717 Profile::FromWebUI(web_ui())->GetExtensionProcessManager()->OpenOptionsPage( | 717 extensions::ExtensionSystem::Get(Profile::FromWebUI(web_ui()))-> |
718 extension, | 718 process_manager()->OpenOptionsPage(extension, |
Yoyo Zhou
2012/10/23 00:20:06
Side note: I thought this was weird and I filed cr
Miranda Callahan
2012/10/23 11:04:43
Agreed that it's strange -- thanks for filing the
| |
719 browser::FindBrowserWithWebContents(web_ui()->GetWebContents())); | 719 browser::FindBrowserWithWebContents(web_ui()->GetWebContents())); |
720 } | 720 } |
721 | 721 |
722 void ExtensionSettingsHandler::HandleShowButtonMessage(const ListValue* args) { | 722 void ExtensionSettingsHandler::HandleShowButtonMessage(const ListValue* args) { |
723 const Extension* extension = GetActiveExtension(args); | 723 const Extension* extension = GetActiveExtension(args); |
724 if (!extension) | 724 if (!extension) |
725 return; | 725 return; |
726 extension_service_->extension_prefs()-> | 726 extension_service_->extension_prefs()-> |
727 SetBrowserActionVisibility(extension, true); | 727 SetBrowserActionVisibility(extension, true); |
728 } | 728 } |
729 | 729 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
813 local_state_pref_registrar_.Add(prefs::kInManagedMode, this); | 813 local_state_pref_registrar_.Add(prefs::kInManagedMode, this); |
814 } | 814 } |
815 | 815 |
816 std::vector<ExtensionPage> | 816 std::vector<ExtensionPage> |
817 ExtensionSettingsHandler::GetInspectablePagesForExtension( | 817 ExtensionSettingsHandler::GetInspectablePagesForExtension( |
818 const Extension* extension, bool extension_is_enabled) { | 818 const Extension* extension, bool extension_is_enabled) { |
819 std::vector<ExtensionPage> result; | 819 std::vector<ExtensionPage> result; |
820 | 820 |
821 // Get the extension process's active views. | 821 // Get the extension process's active views. |
822 ExtensionProcessManager* process_manager = | 822 ExtensionProcessManager* process_manager = |
823 extension_service_->profile()->GetExtensionProcessManager(); | 823 extensions::ExtensionSystem::Get(extension_service_->profile())-> |
824 process_manager(); | |
824 GetInspectablePagesForExtensionProcess( | 825 GetInspectablePagesForExtensionProcess( |
825 process_manager->GetRenderViewHostsForExtension(extension->id()), | 826 process_manager->GetRenderViewHostsForExtension(extension->id()), |
826 &result); | 827 &result); |
827 | 828 |
828 // Get shell window views | 829 // Get shell window views |
829 GetShellWindowPagesForExtensionProfile(extension, | 830 GetShellWindowPagesForExtensionProfile(extension, |
830 extension_service_->profile(), &result); | 831 extension_service_->profile(), &result); |
831 | 832 |
832 // Include a link to start the lazy background page, if applicable. | 833 // Include a link to start the lazy background page, if applicable. |
833 if (extension->has_lazy_background_page() && extension_is_enabled && | 834 if (extension->has_lazy_background_page() && extension_is_enabled && |
834 !process_manager->GetBackgroundHostForExtension(extension->id())) { | 835 !process_manager->GetBackgroundHostForExtension(extension->id())) { |
835 result.push_back( | 836 result.push_back( |
836 ExtensionPage(extension->GetBackgroundURL(), -1, -1, false)); | 837 ExtensionPage(extension->GetBackgroundURL(), -1, -1, false)); |
837 } | 838 } |
838 | 839 |
839 // Repeat for the incognito process, if applicable. Don't try to get | 840 // Repeat for the incognito process, if applicable. Don't try to get |
840 // shell windows for incognito processes. | 841 // shell windows for incognito processes. |
841 if (extension_service_->profile()->HasOffTheRecordProfile() && | 842 if (extension_service_->profile()->HasOffTheRecordProfile() && |
842 extension->incognito_split_mode()) { | 843 extension->incognito_split_mode()) { |
843 ExtensionProcessManager* process_manager = | 844 ExtensionProcessManager* process_manager = |
844 extension_service_->profile()->GetOffTheRecordProfile()-> | 845 extensions::ExtensionSystem::Get(extension_service_->profile()-> |
845 GetExtensionProcessManager(); | 846 GetOffTheRecordProfile())->process_manager(); |
846 GetInspectablePagesForExtensionProcess( | 847 GetInspectablePagesForExtensionProcess( |
847 process_manager->GetRenderViewHostsForExtension(extension->id()), | 848 process_manager->GetRenderViewHostsForExtension(extension->id()), |
848 &result); | 849 &result); |
849 | 850 |
850 if (extension->has_lazy_background_page() && extension_is_enabled && | 851 if (extension->has_lazy_background_page() && extension_is_enabled && |
851 !process_manager->GetBackgroundHostForExtension(extension->id())) { | 852 !process_manager->GetBackgroundHostForExtension(extension->id())) { |
852 result.push_back( | 853 result.push_back( |
853 ExtensionPage(extension->GetBackgroundURL(), -1, -1, true)); | 854 ExtensionPage(extension->GetBackgroundURL(), -1, -1, true)); |
854 } | 855 } |
855 } | 856 } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
922 std::vector<std::string> requirement_errors) { | 923 std::vector<std::string> requirement_errors) { |
923 if (requirement_errors.empty()) { | 924 if (requirement_errors.empty()) { |
924 extension_service_->EnableExtension(extension_id); | 925 extension_service_->EnableExtension(extension_id); |
925 } else { | 926 } else { |
926 ExtensionErrorReporter::GetInstance()->ReportError( | 927 ExtensionErrorReporter::GetInstance()->ReportError( |
927 UTF8ToUTF16(JoinString(requirement_errors, ' ')), | 928 UTF8ToUTF16(JoinString(requirement_errors, ' ')), |
928 true /* be noisy */); | 929 true /* be noisy */); |
929 } | 930 } |
930 requirements_checker_.reset(); | 931 requirements_checker_.reset(); |
931 } | 932 } |
OLD | NEW |