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 <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... | |
37 #include "chrome/browser/extensions/installed_loader.h" | 37 #include "chrome/browser/extensions/installed_loader.h" |
38 #include "chrome/browser/extensions/pending_extension_manager.h" | 38 #include "chrome/browser/extensions/pending_extension_manager.h" |
39 #include "chrome/browser/extensions/permissions_updater.h" | 39 #include "chrome/browser/extensions/permissions_updater.h" |
40 #include "chrome/browser/extensions/shared_module_service.h" | 40 #include "chrome/browser/extensions/shared_module_service.h" |
41 #include "chrome/browser/extensions/unpacked_installer.h" | 41 #include "chrome/browser/extensions/unpacked_installer.h" |
42 #include "chrome/browser/extensions/updater/chrome_extension_downloader_factory. h" | 42 #include "chrome/browser/extensions/updater/chrome_extension_downloader_factory. h" |
43 #include "chrome/browser/extensions/updater/extension_updater.h" | 43 #include "chrome/browser/extensions/updater/extension_updater.h" |
44 #include "chrome/browser/google/google_brand.h" | 44 #include "chrome/browser/google/google_brand.h" |
45 #include "chrome/browser/profiles/profile.h" | 45 #include "chrome/browser/profiles/profile.h" |
46 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" | 46 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" |
47 #include "chrome/browser/ui/webui/fallback_icon_source.h" | |
47 #include "chrome/browser/ui/webui/favicon_source.h" | 48 #include "chrome/browser/ui/webui/favicon_source.h" |
48 #include "chrome/browser/ui/webui/ntp/thumbnail_source.h" | 49 #include "chrome/browser/ui/webui/ntp/thumbnail_source.h" |
49 #include "chrome/browser/ui/webui/theme_source.h" | 50 #include "chrome/browser/ui/webui/theme_source.h" |
50 #include "chrome/common/chrome_switches.h" | 51 #include "chrome/common/chrome_switches.h" |
51 #include "chrome/common/crash_keys.h" | 52 #include "chrome/common/crash_keys.h" |
52 #include "chrome/common/extensions/extension_constants.h" | 53 #include "chrome/common/extensions/extension_constants.h" |
53 #include "chrome/common/extensions/features/feature_channel.h" | 54 #include "chrome/common/extensions/features/feature_channel.h" |
54 #include "chrome/common/url_constants.h" | 55 #include "chrome/common/url_constants.h" |
55 #include "components/content_settings/core/browser/host_content_settings_map.h" | 56 #include "components/content_settings/core/browser/host_content_settings_map.h" |
56 #include "components/crx_file/id_util.h" | 57 #include "components/crx_file/id_util.h" |
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1058 GrantRightsForExtension(extension, profile_); | 1059 GrantRightsForExtension(extension, profile_); |
1059 | 1060 |
1060 // TODO(kalman): This is broken. The crash reporter is process-wide so doesn't | 1061 // TODO(kalman): This is broken. The crash reporter is process-wide so doesn't |
1061 // work properly multi-profile. Besides which, it should be using | 1062 // work properly multi-profile. Besides which, it should be using |
1062 // ExtensionRegistryObserver. See http://crbug.com/355029. | 1063 // ExtensionRegistryObserver. See http://crbug.com/355029. |
1063 UpdateActiveExtensionsInCrashReporter(); | 1064 UpdateActiveExtensionsInCrashReporter(); |
1064 | 1065 |
1065 const extensions::PermissionsData* permissions_data = | 1066 const extensions::PermissionsData* permissions_data = |
1066 extension->permissions_data(); | 1067 extension->permissions_data(); |
1067 | 1068 |
1069 // If the extension has permission to load chrome://fallback-icon/ resources | |
1070 // we need to make sure that the FallbackIconSource is registered with the | |
1071 // ChromeURLDataManager. | |
1072 if (permissions_data->HasHostPermission( | |
1073 GURL(chrome::kChromeUIFallbackIconURL))) { | |
1074 FallbackIconSource* fallback_icon_source = new FallbackIconSource(); | |
1075 content::URLDataSource::Add(profile_, fallback_icon_source); | |
1076 } | |
pkotwicz
2015/01/21 19:44:14
Will there be any extensions with permission to lo
huangs
2015/01/22 01:13:27
Done.
| |
1077 | |
1068 // If the extension has permission to load chrome://favicon/ resources we need | 1078 // If the extension has permission to load chrome://favicon/ resources we need |
1069 // to make sure that the FaviconSource is registered with the | 1079 // to make sure that the FaviconSource is registered with the |
1070 // ChromeURLDataManager. | 1080 // ChromeURLDataManager. |
1071 if (permissions_data->HasHostPermission(GURL(chrome::kChromeUIFaviconURL))) { | 1081 if (permissions_data->HasHostPermission(GURL(chrome::kChromeUIFaviconURL))) { |
1072 FaviconSource* favicon_source = new FaviconSource(profile_, | 1082 FaviconSource* favicon_source = new FaviconSource(profile_, |
1073 FaviconSource::FAVICON); | 1083 FaviconSource::FAVICON); |
1074 content::URLDataSource::Add(profile_, favicon_source); | 1084 content::URLDataSource::Add(profile_, favicon_source); |
1075 } | 1085 } |
1076 | 1086 |
1077 // Same for chrome://theme/ resources. | 1087 // Same for chrome://theme/ resources. |
(...skipping 1451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2529 } | 2539 } |
2530 | 2540 |
2531 void ExtensionService::OnProfileDestructionStarted() { | 2541 void ExtensionService::OnProfileDestructionStarted() { |
2532 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); | 2542 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); |
2533 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); | 2543 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); |
2534 it != ids_to_unload.end(); | 2544 it != ids_to_unload.end(); |
2535 ++it) { | 2545 ++it) { |
2536 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); | 2546 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); |
2537 } | 2547 } |
2538 } | 2548 } |
OLD | NEW |