| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/api/management/chrome_management_api_delegat
e.h" | 5 #include "chrome/browser/extensions/api/management/chrome_management_api_delegat
e.h" |
| 6 | 6 |
| 7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "chrome/browser/extensions/bookmark_app_helper.h" | 11 #include "chrome/browser/extensions/bookmark_app_helper.h" |
| 12 #include "chrome/browser/extensions/chrome_extension_function_details.h" | 12 #include "chrome/browser/extensions/chrome_extension_function_details.h" |
| 13 #include "chrome/browser/extensions/chrome_requirements_checker.h" | |
| 14 #include "chrome/browser/extensions/extension_service.h" | 13 #include "chrome/browser/extensions/extension_service.h" |
| 15 #include "chrome/browser/extensions/extension_util.h" | 14 #include "chrome/browser/extensions/extension_util.h" |
| 16 #include "chrome/browser/extensions/launch_util.h" | 15 #include "chrome/browser/extensions/launch_util.h" |
| 17 #include "chrome/browser/favicon/favicon_service_factory.h" | 16 #include "chrome/browser/favicon/favicon_service_factory.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/browser/ui/browser_dialogs.h" | 18 #include "chrome/browser/ui/browser_dialogs.h" |
| 20 #include "chrome/browser/ui/browser_finder.h" | 19 #include "chrome/browser/ui/browser_finder.h" |
| 21 #include "chrome/browser/ui/browser_window.h" | 20 #include "chrome/browser/ui/browser_window.h" |
| 22 #include "chrome/browser/ui/extensions/app_launch_params.h" | 21 #include "chrome/browser/ui/extensions/app_launch_params.h" |
| 23 #include "chrome/browser/ui/extensions/application_launch.h" | 22 #include "chrome/browser/ui/extensions/application_launch.h" |
| 24 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 23 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
| 25 #include "chrome/common/extensions/chrome_utility_extensions_messages.h" | 24 #include "chrome/common/extensions/chrome_utility_extensions_messages.h" |
| 26 #include "chrome/common/extensions/extension_metrics.h" | 25 #include "chrome/common/extensions/extension_metrics.h" |
| 27 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" | 26 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" |
| 28 #include "chrome/common/web_application_info.h" | 27 #include "chrome/common/web_application_info.h" |
| 29 #include "components/favicon/core/favicon_service.h" | 28 #include "components/favicon/core/favicon_service.h" |
| 30 #include "components/safe_json/safe_json_parser.h" | 29 #include "components/safe_json/safe_json_parser.h" |
| 31 #include "content/public/browser/browser_context.h" | 30 #include "content/public/browser/browser_context.h" |
| 32 #include "content/public/browser/utility_process_host.h" | 31 #include "content/public/browser/utility_process_host.h" |
| 33 #include "content/public/browser/utility_process_host_client.h" | 32 #include "content/public/browser/utility_process_host_client.h" |
| 34 #include "content/public/browser/web_contents.h" | 33 #include "content/public/browser/web_contents.h" |
| 35 #include "extensions/browser/api/management/management_api.h" | 34 #include "extensions/browser/api/management/management_api.h" |
| 36 #include "extensions/browser/api/management/management_api_constants.h" | 35 #include "extensions/browser/api/management/management_api_constants.h" |
| 37 #include "extensions/browser/extension_prefs.h" | 36 #include "extensions/browser/extension_prefs.h" |
| 38 #include "extensions/browser/extension_registry.h" | 37 #include "extensions/browser/extension_registry.h" |
| 39 #include "extensions/browser/extension_system.h" | 38 #include "extensions/browser/extension_system.h" |
| 39 #include "extensions/browser/requirements_checker.h" |
| 40 #include "extensions/common/constants.h" | 40 #include "extensions/common/constants.h" |
| 41 #include "extensions/common/extension.h" | 41 #include "extensions/common/extension.h" |
| 42 | 42 |
| 43 namespace { | 43 namespace { |
| 44 | 44 |
| 45 class ManagementSetEnabledFunctionInstallPromptDelegate | 45 class ManagementSetEnabledFunctionInstallPromptDelegate |
| 46 : public extensions::InstallPromptDelegate { | 46 : public extensions::InstallPromptDelegate { |
| 47 public: | 47 public: |
| 48 ManagementSetEnabledFunctionInstallPromptDelegate( | 48 ManagementSetEnabledFunctionInstallPromptDelegate( |
| 49 content::WebContents* web_contents, | 49 content::WebContents* web_contents, |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 ChromeManagementAPIDelegate::SetEnabledFunctionDelegate( | 218 ChromeManagementAPIDelegate::SetEnabledFunctionDelegate( |
| 219 content::WebContents* web_contents, | 219 content::WebContents* web_contents, |
| 220 content::BrowserContext* browser_context, | 220 content::BrowserContext* browser_context, |
| 221 const extensions::Extension* extension, | 221 const extensions::Extension* extension, |
| 222 const base::Callback<void(bool)>& callback) const { | 222 const base::Callback<void(bool)>& callback) const { |
| 223 return std::unique_ptr<ManagementSetEnabledFunctionInstallPromptDelegate>( | 223 return std::unique_ptr<ManagementSetEnabledFunctionInstallPromptDelegate>( |
| 224 new ManagementSetEnabledFunctionInstallPromptDelegate( | 224 new ManagementSetEnabledFunctionInstallPromptDelegate( |
| 225 web_contents, browser_context, extension, callback)); | 225 web_contents, browser_context, extension, callback)); |
| 226 } | 226 } |
| 227 | 227 |
| 228 std::unique_ptr<extensions::RequirementsChecker> | |
| 229 ChromeManagementAPIDelegate::CreateRequirementsChecker() const { | |
| 230 return base::MakeUnique<extensions::ChromeRequirementsChecker>(); | |
| 231 } | |
| 232 | |
| 233 std::unique_ptr<extensions::UninstallDialogDelegate> | 228 std::unique_ptr<extensions::UninstallDialogDelegate> |
| 234 ChromeManagementAPIDelegate::UninstallFunctionDelegate( | 229 ChromeManagementAPIDelegate::UninstallFunctionDelegate( |
| 235 extensions::ManagementUninstallFunctionBase* function, | 230 extensions::ManagementUninstallFunctionBase* function, |
| 236 const extensions::Extension* target_extension, | 231 const extensions::Extension* target_extension, |
| 237 bool show_programmatic_uninstall_ui) const { | 232 bool show_programmatic_uninstall_ui) const { |
| 238 return std::unique_ptr<extensions::UninstallDialogDelegate>( | 233 return std::unique_ptr<extensions::UninstallDialogDelegate>( |
| 239 new ManagementUninstallFunctionUninstallDialogDelegate( | 234 new ManagementUninstallFunctionUninstallDialogDelegate( |
| 240 function, target_extension, show_programmatic_uninstall_ui)); | 235 function, target_extension, show_programmatic_uninstall_ui)); |
| 241 } | 236 } |
| 242 | 237 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 } | 330 } |
| 336 | 331 |
| 337 GURL ChromeManagementAPIDelegate::GetIconURL( | 332 GURL ChromeManagementAPIDelegate::GetIconURL( |
| 338 const extensions::Extension* extension, | 333 const extensions::Extension* extension, |
| 339 int icon_size, | 334 int icon_size, |
| 340 ExtensionIconSet::MatchType match, | 335 ExtensionIconSet::MatchType match, |
| 341 bool grayscale) const { | 336 bool grayscale) const { |
| 342 return extensions::ExtensionIconSource::GetIconURL(extension, icon_size, | 337 return extensions::ExtensionIconSource::GetIconURL(extension, icon_size, |
| 343 match, grayscale); | 338 match, grayscale); |
| 344 } | 339 } |
| OLD | NEW |