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 961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
972 const Extension* extension, const char* histogram) { | 972 const Extension* extension, const char* histogram) { |
973 // Since this is called from multiple sources, and since the histogram macros | 973 // Since this is called from multiple sources, and since the histogram macros |
974 // use statics, we need to manually lookup the histogram ourselves. | 974 // use statics, we need to manually lookup the histogram ourselves. |
975 base::HistogramBase* counter = base::LinearHistogram::FactoryGet( | 975 base::HistogramBase* counter = base::LinearHistogram::FactoryGet( |
976 histogram, | 976 histogram, |
977 1, | 977 1, |
978 PermissionMessage::kEnumBoundary, | 978 PermissionMessage::kEnumBoundary, |
979 PermissionMessage::kEnumBoundary + 1, | 979 PermissionMessage::kEnumBoundary + 1, |
980 base::HistogramBase::kUmaTargetedHistogramFlag); | 980 base::HistogramBase::kUmaTargetedHistogramFlag); |
981 | 981 |
982 PermissionMessages permissions = extensions::PermissionsData::ForExtension( | 982 PermissionMessages permissions = |
983 extension)->GetPermissionMessages(); | 983 extension->permissions_data()->GetPermissionMessages(); |
984 if (permissions.empty()) { | 984 if (permissions.empty()) { |
985 counter->Add(PermissionMessage::kNone); | 985 counter->Add(PermissionMessage::kNone); |
986 } else { | 986 } else { |
987 for (PermissionMessages::iterator it = permissions.begin(); | 987 for (PermissionMessages::iterator it = permissions.begin(); |
988 it != permissions.end(); ++it) | 988 it != permissions.end(); ++it) |
989 counter->Add(it->id()); | 989 counter->Add(it->id()); |
990 } | 990 } |
991 } | 991 } |
992 | 992 |
993 void ExtensionService::NotifyExtensionLoaded(const Extension* extension) { | 993 void ExtensionService::NotifyExtensionLoaded(const Extension* extension) { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1037 // BrowserContextKeyedService and use ExtensionRegistryObserver. | 1037 // BrowserContextKeyedService and use ExtensionRegistryObserver. |
1038 profile_->GetExtensionSpecialStoragePolicy()-> | 1038 profile_->GetExtensionSpecialStoragePolicy()-> |
1039 GrantRightsForExtension(extension); | 1039 GrantRightsForExtension(extension); |
1040 | 1040 |
1041 // TODO(kalman): This is broken. The crash reporter is process-wide so doesn't | 1041 // TODO(kalman): This is broken. The crash reporter is process-wide so doesn't |
1042 // work properly multi-profile. Besides which, it should be using | 1042 // work properly multi-profile. Besides which, it should be using |
1043 // ExtensionRegistryObserver. See http://crbug.com/355029. | 1043 // ExtensionRegistryObserver. See http://crbug.com/355029. |
1044 UpdateActiveExtensionsInCrashReporter(); | 1044 UpdateActiveExtensionsInCrashReporter(); |
1045 | 1045 |
1046 const extensions::PermissionsData* permissions_data = | 1046 const extensions::PermissionsData* permissions_data = |
1047 extensions::PermissionsData::ForExtension(extension); | 1047 extension->permissions_data(); |
1048 | 1048 |
1049 // If the extension has permission to load chrome://favicon/ resources we need | 1049 // If the extension has permission to load chrome://favicon/ resources we need |
1050 // to make sure that the FaviconSource is registered with the | 1050 // to make sure that the FaviconSource is registered with the |
1051 // ChromeURLDataManager. | 1051 // ChromeURLDataManager. |
1052 if (permissions_data->HasHostPermission(GURL(chrome::kChromeUIFaviconURL))) { | 1052 if (permissions_data->HasHostPermission(GURL(chrome::kChromeUIFaviconURL))) { |
1053 FaviconSource* favicon_source = new FaviconSource(profile_, | 1053 FaviconSource* favicon_source = new FaviconSource(profile_, |
1054 FaviconSource::FAVICON); | 1054 FaviconSource::FAVICON); |
1055 content::URLDataSource::Add(profile_, favicon_source); | 1055 content::URLDataSource::Add(profile_, favicon_source); |
1056 } | 1056 } |
1057 | 1057 |
(...skipping 1491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2549 } | 2549 } |
2550 | 2550 |
2551 void ExtensionService::OnProfileDestructionStarted() { | 2551 void ExtensionService::OnProfileDestructionStarted() { |
2552 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); | 2552 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); |
2553 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); | 2553 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); |
2554 it != ids_to_unload.end(); | 2554 it != ids_to_unload.end(); |
2555 ++it) { | 2555 ++it) { |
2556 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); | 2556 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); |
2557 } | 2557 } |
2558 } | 2558 } |
OLD | NEW |