OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/extension_service.h" | 5 #include "chrome/browser/extensions/extension_service.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <iterator> | 10 #include <iterator> |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 #include "chrome/browser/extensions/updater/extension_updater.h" | 54 #include "chrome/browser/extensions/updater/extension_updater.h" |
55 #include "chrome/browser/google/google_brand.h" | 55 #include "chrome/browser/google/google_brand.h" |
56 #include "chrome/browser/profiles/profile.h" | 56 #include "chrome/browser/profiles/profile.h" |
57 #include "chrome/browser/search/thumbnail_source.h" | 57 #include "chrome/browser/search/thumbnail_source.h" |
58 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 58 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
59 #include "chrome/browser/ui/webui/favicon_source.h" | 59 #include "chrome/browser/ui/webui/favicon_source.h" |
60 #include "chrome/browser/ui/webui/theme_source.h" | 60 #include "chrome/browser/ui/webui/theme_source.h" |
61 #include "chrome/common/chrome_switches.h" | 61 #include "chrome/common/chrome_switches.h" |
62 #include "chrome/common/crash_keys.h" | 62 #include "chrome/common/crash_keys.h" |
63 #include "chrome/common/extensions/extension_constants.h" | 63 #include "chrome/common/extensions/extension_constants.h" |
| 64 #include "chrome/common/features.h" |
64 #include "chrome/common/url_constants.h" | 65 #include "chrome/common/url_constants.h" |
65 #include "components/content_settings/core/browser/host_content_settings_map.h" | 66 #include "components/content_settings/core/browser/host_content_settings_map.h" |
66 #include "components/crx_file/id_util.h" | 67 #include "components/crx_file/id_util.h" |
67 #include "content/public/browser/devtools_agent_host.h" | 68 #include "content/public/browser/devtools_agent_host.h" |
68 #include "content/public/browser/notification_service.h" | 69 #include "content/public/browser/notification_service.h" |
69 #include "content/public/browser/render_process_host.h" | 70 #include "content/public/browser/render_process_host.h" |
70 #include "content/public/browser/storage_partition.h" | 71 #include "content/public/browser/storage_partition.h" |
71 #include "extensions/browser/app_sorting.h" | 72 #include "extensions/browser/app_sorting.h" |
72 #include "extensions/browser/event_router.h" | 73 #include "extensions/browser/event_router.h" |
73 #include "extensions/browser/extension_host.h" | 74 #include "extensions/browser/extension_host.h" |
(...skipping 14 matching lines...) Expand all Loading... |
88 #include "extensions/common/features/feature_channel.h" | 89 #include "extensions/common/features/feature_channel.h" |
89 #include "extensions/common/file_util.h" | 90 #include "extensions/common/file_util.h" |
90 #include "extensions/common/manifest_constants.h" | 91 #include "extensions/common/manifest_constants.h" |
91 #include "extensions/common/manifest_handlers/background_info.h" | 92 #include "extensions/common/manifest_handlers/background_info.h" |
92 #include "extensions/common/manifest_url_handlers.h" | 93 #include "extensions/common/manifest_url_handlers.h" |
93 #include "extensions/common/one_shot_event.h" | 94 #include "extensions/common/one_shot_event.h" |
94 #include "extensions/common/permissions/api_permission.h" | 95 #include "extensions/common/permissions/api_permission.h" |
95 #include "extensions/common/permissions/permission_message_provider.h" | 96 #include "extensions/common/permissions/permission_message_provider.h" |
96 #include "extensions/common/permissions/permissions_data.h" | 97 #include "extensions/common/permissions/permissions_data.h" |
97 | 98 |
98 #if defined(ENABLE_SUPERVISED_USERS) | 99 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
99 #include "chrome/browser/supervised_user/supervised_user_service.h" | 100 #include "chrome/browser/supervised_user/supervised_user_service.h" |
100 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" | 101 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
101 #endif | 102 #endif |
102 | 103 |
103 #if defined(OS_CHROMEOS) | 104 #if defined(OS_CHROMEOS) |
104 #include "chrome/browser/chromeos/extensions/install_limiter.h" | 105 #include "chrome/browser/chromeos/extensions/install_limiter.h" |
105 #include "storage/browser/fileapi/file_system_backend.h" | 106 #include "storage/browser/fileapi/file_system_backend.h" |
106 #include "storage/browser/fileapi/file_system_context.h" | 107 #include "storage/browser/fileapi/file_system_context.h" |
107 #endif | 108 #endif |
108 | 109 |
(...skipping 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1677 // Extension has changed permissions significantly. Disable it. A | 1678 // Extension has changed permissions significantly. Disable it. A |
1678 // notification should be sent by the caller. If the extension is already | 1679 // notification should be sent by the caller. If the extension is already |
1679 // disabled because it was installed remotely, don't add another disable | 1680 // disabled because it was installed remotely, don't add another disable |
1680 // reason. | 1681 // reason. |
1681 if (is_privilege_increase && | 1682 if (is_privilege_increase && |
1682 !(disable_reasons & Extension::DISABLE_REMOTE_INSTALL)) { | 1683 !(disable_reasons & Extension::DISABLE_REMOTE_INSTALL)) { |
1683 disable_reasons |= Extension::DISABLE_PERMISSIONS_INCREASE; | 1684 disable_reasons |= Extension::DISABLE_PERMISSIONS_INCREASE; |
1684 if (!extension_prefs_->DidExtensionEscalatePermissions(extension->id())) | 1685 if (!extension_prefs_->DidExtensionEscalatePermissions(extension->id())) |
1685 RecordPermissionMessagesHistogram(extension, "AutoDisable"); | 1686 RecordPermissionMessagesHistogram(extension, "AutoDisable"); |
1686 | 1687 |
1687 #if defined(ENABLE_SUPERVISED_USERS) | 1688 #if BUILDFLAG(ENABLE_SUPERVISED_USERS) |
1688 // If a custodian-installed extension is disabled for a supervised user due | 1689 // If a custodian-installed extension is disabled for a supervised user due |
1689 // to a permissions increase, send a request to the custodian. | 1690 // to a permissions increase, send a request to the custodian. |
1690 if (extensions::util::IsExtensionSupervised(extension, profile_) && | 1691 if (extensions::util::IsExtensionSupervised(extension, profile_) && |
1691 !ExtensionSyncService::Get(profile_)->HasPendingReenable( | 1692 !ExtensionSyncService::Get(profile_)->HasPendingReenable( |
1692 extension->id(), *extension->version())) { | 1693 extension->id(), *extension->version())) { |
1693 SupervisedUserService* supervised_user_service = | 1694 SupervisedUserService* supervised_user_service = |
1694 SupervisedUserServiceFactory::GetForProfile(profile_); | 1695 SupervisedUserServiceFactory::GetForProfile(profile_); |
1695 supervised_user_service->AddExtensionUpdateRequest(extension->id(), | 1696 supervised_user_service->AddExtensionUpdateRequest(extension->id(), |
1696 *extension->version()); | 1697 *extension->version()); |
1697 } | 1698 } |
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2476 } | 2477 } |
2477 | 2478 |
2478 void ExtensionService::OnProfileDestructionStarted() { | 2479 void ExtensionService::OnProfileDestructionStarted() { |
2479 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); | 2480 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); |
2480 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); | 2481 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); |
2481 it != ids_to_unload.end(); | 2482 it != ids_to_unload.end(); |
2482 ++it) { | 2483 ++it) { |
2483 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); | 2484 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); |
2484 } | 2485 } |
2485 } | 2486 } |
OLD | NEW |