| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/developer_private/show_permissions_dialo
g_helper.h" | 5 #include "chrome/browser/extensions/api/developer_private/show_permissions_dialo
g_helper.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "apps/app_load_service.h" | 9 #include "apps/app_load_service.h" |
| 8 #include "apps/saved_files_service.h" | 10 #include "apps/saved_files_service.h" |
| 9 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/ui/apps/app_info_dialog.h" | 13 #include "chrome/browser/ui/apps/app_info_dialog.h" |
| 12 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
| 13 #include "extensions/browser/api/device_permissions_manager.h" | 15 #include "extensions/browser/api/device_permissions_manager.h" |
| 14 #include "extensions/browser/extension_registry.h" | 16 #include "extensions/browser/extension_registry.h" |
| 15 #include "extensions/common/extension.h" | 17 #include "extensions/common/extension.h" |
| 16 #include "extensions/common/permissions/permissions_data.h" | 18 #include "extensions/common/permissions/permissions_data.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 if (extension->permissions_data()->HasAPIPermission(APIPermission::kUsb)) { | 76 if (extension->permissions_data()->HasAPIPermission(APIPermission::kUsb)) { |
| 75 retained_device_messages = | 77 retained_device_messages = |
| 76 DevicePermissionsManager::Get(profile_) | 78 DevicePermissionsManager::Get(profile_) |
| 77 ->GetPermissionMessageStrings(extension_id_); | 79 ->GetPermissionMessageStrings(extension_id_); |
| 78 } | 80 } |
| 79 scoped_ptr<ExtensionInstallPrompt::Prompt> prompt( | 81 scoped_ptr<ExtensionInstallPrompt::Prompt> prompt( |
| 80 new ExtensionInstallPrompt::Prompt( | 82 new ExtensionInstallPrompt::Prompt( |
| 81 ExtensionInstallPrompt::POST_INSTALL_PERMISSIONS_PROMPT)); | 83 ExtensionInstallPrompt::POST_INSTALL_PERMISSIONS_PROMPT)); |
| 82 prompt->set_retained_files(retained_file_paths); | 84 prompt->set_retained_files(retained_file_paths); |
| 83 prompt->set_retained_device_messages(retained_device_messages); | 85 prompt->set_retained_device_messages(retained_device_messages); |
| 84 prompt_->ShowDialog(this, extension, nullptr, prompt.Pass(), | 86 prompt_->ShowDialog(this, extension, nullptr, std::move(prompt), |
| 85 ExtensionInstallPrompt::GetDefaultShowDialogCallback()); | 87 ExtensionInstallPrompt::GetDefaultShowDialogCallback()); |
| 86 } | 88 } |
| 87 | 89 |
| 88 // This is called when the user clicks "Revoke File Access." | 90 // This is called when the user clicks "Revoke File Access." |
| 89 void ShowPermissionsDialogHelper::InstallUIProceed() { | 91 void ShowPermissionsDialogHelper::InstallUIProceed() { |
| 90 const Extension* extension = | 92 const Extension* extension = |
| 91 ExtensionRegistry::Get(profile_)->GetExtensionById( | 93 ExtensionRegistry::Get(profile_)->GetExtensionById( |
| 92 extension_id_, ExtensionRegistry::EVERYTHING); | 94 extension_id_, ExtensionRegistry::EVERYTHING); |
| 93 | 95 |
| 94 if (extension) | 96 if (extension) |
| 95 apps::SavedFilesService::Get(profile_)->ClearQueue(extension); | 97 apps::SavedFilesService::Get(profile_)->ClearQueue(extension); |
| 96 apps::AppLoadService::Get(profile_) | 98 apps::AppLoadService::Get(profile_) |
| 97 ->RestartApplicationIfRunning(extension_id_); | 99 ->RestartApplicationIfRunning(extension_id_); |
| 98 | 100 |
| 99 on_complete_.Run(); | 101 on_complete_.Run(); |
| 100 | 102 |
| 101 delete this; | 103 delete this; |
| 102 } | 104 } |
| 103 | 105 |
| 104 void ShowPermissionsDialogHelper::InstallUIAbort(bool user_initiated) { | 106 void ShowPermissionsDialogHelper::InstallUIAbort(bool user_initiated) { |
| 105 on_complete_.Run(); | 107 on_complete_.Run(); |
| 106 | 108 |
| 107 delete this; | 109 delete this; |
| 108 } | 110 } |
| 109 | 111 |
| 110 } // namespace extensions | 112 } // namespace extensions |
| OLD | NEW |