| 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 26 matching lines...) Expand all Loading... |
| 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/ui/webui/managed_user_passphrase_dialog.h" | 43 #include "chrome/browser/ui/webui/managed_user_passphrase_dialog.h" |
| 44 #include "chrome/browser/view_type_utils.h" | 44 #include "chrome/browser/view_type_utils.h" |
| 45 #include "chrome/common/chrome_notification_types.h" | 45 #include "chrome/common/chrome_notification_types.h" |
| 46 #include "chrome/common/chrome_switches.h" | 46 #include "chrome/common/chrome_switches.h" |
| 47 #include "chrome/common/extensions/background_info.h" |
| 47 #include "chrome/common/extensions/extension.h" | 48 #include "chrome/common/extensions/extension.h" |
| 48 #include "chrome/common/extensions/extension_constants.h" | 49 #include "chrome/common/extensions/extension_constants.h" |
| 49 #include "chrome/common/extensions/extension_icon_set.h" | 50 #include "chrome/common/extensions/extension_icon_set.h" |
| 50 #include "chrome/common/extensions/extension_set.h" | 51 #include "chrome/common/extensions/extension_set.h" |
| 51 #include "chrome/common/extensions/feature_switch.h" | 52 #include "chrome/common/extensions/feature_switch.h" |
| 52 #include "chrome/common/extensions/manifest_url_handler.h" | 53 #include "chrome/common/extensions/manifest_url_handler.h" |
| 53 #include "chrome/common/pref_names.h" | 54 #include "chrome/common/pref_names.h" |
| 54 #include "chrome/common/url_constants.h" | 55 #include "chrome/common/url_constants.h" |
| 55 #include "content/public/browser/notification_service.h" | 56 #include "content/public/browser/notification_service.h" |
| 56 #include "content/public/browser/notification_source.h" | 57 #include "content/public/browser/notification_source.h" |
| (...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 967 process_manager(); | 968 process_manager(); |
| 968 GetInspectablePagesForExtensionProcess( | 969 GetInspectablePagesForExtensionProcess( |
| 969 process_manager->GetRenderViewHostsForExtension(extension->id()), | 970 process_manager->GetRenderViewHostsForExtension(extension->id()), |
| 970 &result); | 971 &result); |
| 971 | 972 |
| 972 // Get shell window views | 973 // Get shell window views |
| 973 GetShellWindowPagesForExtensionProfile(extension, | 974 GetShellWindowPagesForExtensionProfile(extension, |
| 974 extension_service_->profile(), &result); | 975 extension_service_->profile(), &result); |
| 975 | 976 |
| 976 // Include a link to start the lazy background page, if applicable. | 977 // Include a link to start the lazy background page, if applicable. |
| 977 if (extension->has_lazy_background_page() && extension_is_enabled && | 978 if (extensions::BackgroundInfo::HasLazyBackgroundPage(extension) && |
| 979 extension_is_enabled && |
| 978 !process_manager->GetBackgroundHostForExtension(extension->id())) { | 980 !process_manager->GetBackgroundHostForExtension(extension->id())) { |
| 979 result.push_back( | 981 result.push_back( |
| 980 ExtensionPage(extension->GetBackgroundURL(), -1, -1, false)); | 982 ExtensionPage(extensions::BackgroundInfo::GetBackgroundURL(extension), |
| 983 -1, -1, false)); |
| 981 } | 984 } |
| 982 | 985 |
| 983 // Repeat for the incognito process, if applicable. Don't try to get | 986 // Repeat for the incognito process, if applicable. Don't try to get |
| 984 // shell windows for incognito processes. | 987 // shell windows for incognito processes. |
| 985 if (extension_service_->profile()->HasOffTheRecordProfile() && | 988 if (extension_service_->profile()->HasOffTheRecordProfile() && |
| 986 extension->incognito_split_mode()) { | 989 extension->incognito_split_mode()) { |
| 987 ExtensionProcessManager* process_manager = | 990 ExtensionProcessManager* process_manager = |
| 988 extensions::ExtensionSystem::Get(extension_service_->profile()-> | 991 extensions::ExtensionSystem::Get(extension_service_->profile()-> |
| 989 GetOffTheRecordProfile())->process_manager(); | 992 GetOffTheRecordProfile())->process_manager(); |
| 990 GetInspectablePagesForExtensionProcess( | 993 GetInspectablePagesForExtensionProcess( |
| 991 process_manager->GetRenderViewHostsForExtension(extension->id()), | 994 process_manager->GetRenderViewHostsForExtension(extension->id()), |
| 992 &result); | 995 &result); |
| 993 | 996 |
| 994 if (extension->has_lazy_background_page() && extension_is_enabled && | 997 if (extensions::BackgroundInfo::HasLazyBackgroundPage(extension) |
| 998 && extension_is_enabled && |
| 995 !process_manager->GetBackgroundHostForExtension(extension->id())) { | 999 !process_manager->GetBackgroundHostForExtension(extension->id())) { |
| 996 result.push_back( | 1000 result.push_back( |
| 997 ExtensionPage(extension->GetBackgroundURL(), -1, -1, true)); | 1001 ExtensionPage(extensions::BackgroundInfo::GetBackgroundURL(extension), |
| 1002 -1, -1, true)); |
| 998 } | 1003 } |
| 999 } | 1004 } |
| 1000 | 1005 |
| 1001 return result; | 1006 return result; |
| 1002 } | 1007 } |
| 1003 | 1008 |
| 1004 void ExtensionSettingsHandler::GetInspectablePagesForExtensionProcess( | 1009 void ExtensionSettingsHandler::GetInspectablePagesForExtensionProcess( |
| 1005 const std::set<RenderViewHost*>& views, | 1010 const std::set<RenderViewHost*>& views, |
| 1006 std::vector<ExtensionPage>* result) { | 1011 std::vector<ExtensionPage>* result) { |
| 1007 for (std::set<RenderViewHost*>::const_iterator iter = views.begin(); | 1012 for (std::set<RenderViewHost*>::const_iterator iter = views.begin(); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1067 std::vector<std::string> requirement_errors) { | 1072 std::vector<std::string> requirement_errors) { |
| 1068 if (requirement_errors.empty()) { | 1073 if (requirement_errors.empty()) { |
| 1069 extension_service_->EnableExtension(extension_id); | 1074 extension_service_->EnableExtension(extension_id); |
| 1070 } else { | 1075 } else { |
| 1071 ExtensionErrorReporter::GetInstance()->ReportError( | 1076 ExtensionErrorReporter::GetInstance()->ReportError( |
| 1072 UTF8ToUTF16(JoinString(requirement_errors, ' ')), | 1077 UTF8ToUTF16(JoinString(requirement_errors, ' ')), |
| 1073 true /* be noisy */); | 1078 true /* be noisy */); |
| 1074 } | 1079 } |
| 1075 requirements_checker_.reset(); | 1080 requirements_checker_.reset(); |
| 1076 } | 1081 } |
| OLD | NEW |