| 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 25 matching lines...) Expand all Loading... |
| 36 #include "chrome/browser/profiles/profile.h" | 36 #include "chrome/browser/profiles/profile.h" |
| 37 #include "chrome/browser/tab_contents/background_contents.h" | 37 #include "chrome/browser/tab_contents/background_contents.h" |
| 38 #include "chrome/browser/ui/browser_finder.h" | 38 #include "chrome/browser/ui/browser_finder.h" |
| 39 #include "chrome/browser/ui/chrome_select_file_policy.h" | 39 #include "chrome/browser/ui/chrome_select_file_policy.h" |
| 40 #include "chrome/browser/ui/extensions/application_launch.h" | 40 #include "chrome/browser/ui/extensions/application_launch.h" |
| 41 #include "chrome/browser/ui/extensions/shell_window.h" | 41 #include "chrome/browser/ui/extensions/shell_window.h" |
| 42 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 42 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
| 43 #include "chrome/browser/view_type_utils.h" | 43 #include "chrome/browser/view_type_utils.h" |
| 44 #include "chrome/common/chrome_notification_types.h" | 44 #include "chrome/common/chrome_notification_types.h" |
| 45 #include "chrome/common/chrome_switches.h" | 45 #include "chrome/common/chrome_switches.h" |
| 46 #include "chrome/common/extensions/background_info.h" |
| 46 #include "chrome/common/extensions/extension.h" | 47 #include "chrome/common/extensions/extension.h" |
| 47 #include "chrome/common/extensions/extension_constants.h" | 48 #include "chrome/common/extensions/extension_constants.h" |
| 48 #include "chrome/common/extensions/extension_icon_set.h" | 49 #include "chrome/common/extensions/extension_icon_set.h" |
| 49 #include "chrome/common/extensions/extension_set.h" | 50 #include "chrome/common/extensions/extension_set.h" |
| 50 #include "chrome/common/extensions/feature_switch.h" | 51 #include "chrome/common/extensions/feature_switch.h" |
| 51 #include "chrome/common/extensions/manifest_url_handler.h" | 52 #include "chrome/common/extensions/manifest_url_handler.h" |
| 52 #include "chrome/common/pref_names.h" | 53 #include "chrome/common/pref_names.h" |
| 53 #include "chrome/common/url_constants.h" | 54 #include "chrome/common/url_constants.h" |
| 54 #include "content/public/browser/notification_service.h" | 55 #include "content/public/browser/notification_service.h" |
| 55 #include "content/public/browser/notification_source.h" | 56 #include "content/public/browser/notification_source.h" |
| (...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 909 process_manager(); | 910 process_manager(); |
| 910 GetInspectablePagesForExtensionProcess( | 911 GetInspectablePagesForExtensionProcess( |
| 911 process_manager->GetRenderViewHostsForExtension(extension->id()), | 912 process_manager->GetRenderViewHostsForExtension(extension->id()), |
| 912 &result); | 913 &result); |
| 913 | 914 |
| 914 // Get shell window views | 915 // Get shell window views |
| 915 GetShellWindowPagesForExtensionProfile(extension, | 916 GetShellWindowPagesForExtensionProfile(extension, |
| 916 extension_service_->profile(), &result); | 917 extension_service_->profile(), &result); |
| 917 | 918 |
| 918 // Include a link to start the lazy background page, if applicable. | 919 // Include a link to start the lazy background page, if applicable. |
| 919 if (extension->has_lazy_background_page() && extension_is_enabled && | 920 if (extensions::BackgroundInfo::HasLazyBackgroundPage(extension) && |
| 921 extension_is_enabled && |
| 920 !process_manager->GetBackgroundHostForExtension(extension->id())) { | 922 !process_manager->GetBackgroundHostForExtension(extension->id())) { |
| 921 result.push_back( | 923 result.push_back( |
| 922 ExtensionPage(extension->GetBackgroundURL(), -1, -1, false)); | 924 ExtensionPage(extensions::BackgroundInfo::GetBackgroundURL(extension), |
| 925 -1, -1, false)); |
| 923 } | 926 } |
| 924 | 927 |
| 925 // Repeat for the incognito process, if applicable. Don't try to get | 928 // Repeat for the incognito process, if applicable. Don't try to get |
| 926 // shell windows for incognito processes. | 929 // shell windows for incognito processes. |
| 927 if (extension_service_->profile()->HasOffTheRecordProfile() && | 930 if (extension_service_->profile()->HasOffTheRecordProfile() && |
| 928 extension->incognito_split_mode()) { | 931 extension->incognito_split_mode()) { |
| 929 ExtensionProcessManager* process_manager = | 932 ExtensionProcessManager* process_manager = |
| 930 extensions::ExtensionSystem::Get(extension_service_->profile()-> | 933 extensions::ExtensionSystem::Get(extension_service_->profile()-> |
| 931 GetOffTheRecordProfile())->process_manager(); | 934 GetOffTheRecordProfile())->process_manager(); |
| 932 GetInspectablePagesForExtensionProcess( | 935 GetInspectablePagesForExtensionProcess( |
| 933 process_manager->GetRenderViewHostsForExtension(extension->id()), | 936 process_manager->GetRenderViewHostsForExtension(extension->id()), |
| 934 &result); | 937 &result); |
| 935 | 938 |
| 936 if (extension->has_lazy_background_page() && extension_is_enabled && | 939 if (extensions::BackgroundInfo::HasLazyBackgroundPage(extension) |
| 940 && extension_is_enabled && |
| 937 !process_manager->GetBackgroundHostForExtension(extension->id())) { | 941 !process_manager->GetBackgroundHostForExtension(extension->id())) { |
| 938 result.push_back( | 942 result.push_back( |
| 939 ExtensionPage(extension->GetBackgroundURL(), -1, -1, true)); | 943 ExtensionPage(extensions::BackgroundInfo::GetBackgroundURL(extension), |
| 944 -1, -1, true)); |
| 940 } | 945 } |
| 941 } | 946 } |
| 942 | 947 |
| 943 return result; | 948 return result; |
| 944 } | 949 } |
| 945 | 950 |
| 946 void ExtensionSettingsHandler::GetInspectablePagesForExtensionProcess( | 951 void ExtensionSettingsHandler::GetInspectablePagesForExtensionProcess( |
| 947 const std::set<RenderViewHost*>& views, | 952 const std::set<RenderViewHost*>& views, |
| 948 std::vector<ExtensionPage>* result) { | 953 std::vector<ExtensionPage>* result) { |
| 949 for (std::set<RenderViewHost*>::const_iterator iter = views.begin(); | 954 for (std::set<RenderViewHost*>::const_iterator iter = views.begin(); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1009 std::vector<std::string> requirement_errors) { | 1014 std::vector<std::string> requirement_errors) { |
| 1010 if (requirement_errors.empty()) { | 1015 if (requirement_errors.empty()) { |
| 1011 extension_service_->EnableExtension(extension_id); | 1016 extension_service_->EnableExtension(extension_id); |
| 1012 } else { | 1017 } else { |
| 1013 ExtensionErrorReporter::GetInstance()->ReportError( | 1018 ExtensionErrorReporter::GetInstance()->ReportError( |
| 1014 UTF8ToUTF16(JoinString(requirement_errors, ' ')), | 1019 UTF8ToUTF16(JoinString(requirement_errors, ' ')), |
| 1015 true /* be noisy */); | 1020 true /* be noisy */); |
| 1016 } | 1021 } |
| 1017 requirements_checker_.reset(); | 1022 requirements_checker_.reset(); |
| 1018 } | 1023 } |
| OLD | NEW |