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/extensions/api/developer_private/developer_private_api.
h" | 5 #include "chrome/browser/extensions/api/developer_private/developer_private_api.
h" |
6 | 6 |
7 #include "apps/app_load_service.h" | 7 #include "apps/app_load_service.h" |
8 #include "apps/saved_files_service.h" | 8 #include "apps/saved_files_service.h" |
9 #include "base/base64.h" | 9 #include "base/base64.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 #include "chrome/common/extensions/manifest_url_handler.h" | 39 #include "chrome/common/extensions/manifest_url_handler.h" |
40 #include "chrome/common/url_constants.h" | 40 #include "chrome/common/url_constants.h" |
41 #include "chrome/grit/generated_resources.h" | 41 #include "chrome/grit/generated_resources.h" |
42 #include "content/public/browser/browser_thread.h" | 42 #include "content/public/browser/browser_thread.h" |
43 #include "content/public/browser/notification_service.h" | 43 #include "content/public/browser/notification_service.h" |
44 #include "content/public/browser/render_process_host.h" | 44 #include "content/public/browser/render_process_host.h" |
45 #include "content/public/browser/render_view_host.h" | 45 #include "content/public/browser/render_view_host.h" |
46 #include "content/public/browser/site_instance.h" | 46 #include "content/public/browser/site_instance.h" |
47 #include "content/public/browser/storage_partition.h" | 47 #include "content/public/browser/storage_partition.h" |
48 #include "content/public/browser/web_contents.h" | 48 #include "content/public/browser/web_contents.h" |
| 49 #include "extensions/browser/api/device_permissions_manager.h" |
49 #include "extensions/browser/app_window/app_window.h" | 50 #include "extensions/browser/app_window/app_window.h" |
50 #include "extensions/browser/app_window/app_window_registry.h" | 51 #include "extensions/browser/app_window/app_window_registry.h" |
51 #include "extensions/browser/extension_error.h" | 52 #include "extensions/browser/extension_error.h" |
52 #include "extensions/browser/extension_prefs.h" | 53 #include "extensions/browser/extension_prefs.h" |
53 #include "extensions/browser/extension_registry.h" | 54 #include "extensions/browser/extension_registry.h" |
54 #include "extensions/browser/extension_system.h" | 55 #include "extensions/browser/extension_system.h" |
55 #include "extensions/browser/management_policy.h" | 56 #include "extensions/browser/management_policy.h" |
56 #include "extensions/browser/notification_types.h" | 57 #include "extensions/browser/notification_types.h" |
57 #include "extensions/browser/view_type_utils.h" | 58 #include "extensions/browser/view_type_utils.h" |
58 #include "extensions/common/constants.h" | 59 #include "extensions/common/constants.h" |
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 std::vector<base::FilePath> retained_file_paths; | 752 std::vector<base::FilePath> retained_file_paths; |
752 if (extension->permissions_data()->HasAPIPermission( | 753 if (extension->permissions_data()->HasAPIPermission( |
753 APIPermission::kFileSystem)) { | 754 APIPermission::kFileSystem)) { |
754 std::vector<apps::SavedFileEntry> retained_file_entries = | 755 std::vector<apps::SavedFileEntry> retained_file_entries = |
755 apps::SavedFilesService::Get(GetProfile()) | 756 apps::SavedFilesService::Get(GetProfile()) |
756 ->GetAllFileEntries(extension_id_); | 757 ->GetAllFileEntries(extension_id_); |
757 for (size_t i = 0; i < retained_file_entries.size(); i++) { | 758 for (size_t i = 0; i < retained_file_entries.size(); i++) { |
758 retained_file_paths.push_back(retained_file_entries[i].path); | 759 retained_file_paths.push_back(retained_file_entries[i].path); |
759 } | 760 } |
760 } | 761 } |
761 prompt_->ReviewPermissions(this, extension, retained_file_paths); | 762 std::vector<base::string16> retained_device_messages; |
| 763 if (extension->permissions_data()->HasAPIPermission(APIPermission::kUsb)) { |
| 764 retained_device_messages = |
| 765 extensions::DevicePermissionsManager::Get(GetProfile()) |
| 766 ->GetPermissionMessageStrings(extension_id_); |
| 767 } |
| 768 prompt_->ReviewPermissions( |
| 769 this, extension, retained_file_paths, retained_device_messages); |
762 return true; | 770 return true; |
763 } | 771 } |
764 | 772 |
765 DeveloperPrivateReloadFunction::~DeveloperPrivateReloadFunction() {} | 773 DeveloperPrivateReloadFunction::~DeveloperPrivateReloadFunction() {} |
766 | 774 |
767 // This is called when the user clicks "Revoke File Access." | 775 // This is called when the user clicks "Revoke File Access." |
768 void DeveloperPrivateShowPermissionsDialogFunction::InstallUIProceed() { | 776 void DeveloperPrivateShowPermissionsDialogFunction::InstallUIProceed() { |
769 Profile* profile = GetProfile(); | 777 Profile* profile = GetProfile(); |
770 const Extension* extension = ExtensionRegistry::Get( | 778 const Extension* extension = ExtensionRegistry::Get( |
771 profile)->GetExtensionById(extension_id_, ExtensionRegistry::EVERYTHING); | 779 profile)->GetExtensionById(extension_id_, ExtensionRegistry::EVERYTHING); |
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1395 } | 1403 } |
1396 | 1404 |
1397 error_ui_util::HandleOpenDevTools(dict); | 1405 error_ui_util::HandleOpenDevTools(dict); |
1398 | 1406 |
1399 return true; | 1407 return true; |
1400 } | 1408 } |
1401 | 1409 |
1402 } // namespace api | 1410 } // namespace api |
1403 | 1411 |
1404 } // namespace extensions | 1412 } // namespace extensions |
OLD | NEW |