| 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/extension_service.h" | 5 #include "chrome/browser/extensions/extension_service.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 base::FieldTrialList::TrialExists(kDefaultAppsTrialName); | 802 base::FieldTrialList::TrialExists(kDefaultAppsTrialName); |
| 803 if (default_apps_trial_exists) { | 803 if (default_apps_trial_exists) { |
| 804 UMA_HISTOGRAM_ENUMERATION( | 804 UMA_HISTOGRAM_ENUMERATION( |
| 805 base::FieldTrial::MakeName("Extensions.ExtensionUninstalled", | 805 base::FieldTrial::MakeName("Extensions.ExtensionUninstalled", |
| 806 kDefaultAppsTrialName), | 806 kDefaultAppsTrialName), |
| 807 1, 2); | 807 1, 2); |
| 808 } | 808 } |
| 809 | 809 |
| 810 // Uninstalling one extension might have solved the problems of others. | 810 // Uninstalling one extension might have solved the problems of others. |
| 811 // Therefore, we clear warnings of this type for all extensions. | 811 // Therefore, we clear warnings of this type for all extensions. |
| 812 std::set<ExtensionWarningSet::WarningType> warnings; | 812 std::set<ExtensionWarning::WarningType> warning_types; |
| 813 extension_warnings_.GetWarningsAffectingExtension(extension_id, &warnings); | 813 extension_warnings_.GetWarningTypesAffectingExtension(extension_id, |
| 814 extension_warnings_.ClearWarnings(warnings); | 814 &warning_types); |
| 815 extension_warnings_.ClearWarnings(warning_types); |
| 815 | 816 |
| 816 return true; | 817 return true; |
| 817 } | 818 } |
| 818 | 819 |
| 819 bool ExtensionService::IsExtensionEnabled( | 820 bool ExtensionService::IsExtensionEnabled( |
| 820 const std::string& extension_id) const { | 821 const std::string& extension_id) const { |
| 821 if (extensions_.Contains(extension_id) || | 822 if (extensions_.Contains(extension_id) || |
| 822 terminated_extensions_.Contains(extension_id)) { | 823 terminated_extensions_.Contains(extension_id)) { |
| 823 return true; | 824 return true; |
| 824 } | 825 } |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 extensions_.Remove(extension->id()); | 904 extensions_.Remove(extension->id()); |
| 904 else | 905 else |
| 905 terminated_extensions_.Remove(extension->id()); | 906 terminated_extensions_.Remove(extension->id()); |
| 906 | 907 |
| 907 NotifyExtensionUnloaded(extension, extension_misc::UNLOAD_REASON_DISABLE); | 908 NotifyExtensionUnloaded(extension, extension_misc::UNLOAD_REASON_DISABLE); |
| 908 | 909 |
| 909 SyncExtensionChangeIfNeeded(*extension); | 910 SyncExtensionChangeIfNeeded(*extension); |
| 910 | 911 |
| 911 // Deactivating one extension might have solved the problems of others. | 912 // Deactivating one extension might have solved the problems of others. |
| 912 // Therefore, we clear warnings of this type for all extensions. | 913 // Therefore, we clear warnings of this type for all extensions. |
| 913 std::set<ExtensionWarningSet::WarningType> warnings; | 914 std::set<ExtensionWarning::WarningType> warning_types; |
| 914 extension_warnings_.GetWarningsAffectingExtension(extension_id, &warnings); | 915 extension_warnings_.GetWarningTypesAffectingExtension(extension_id, |
| 915 extension_warnings_.ClearWarnings(warnings); | 916 &warning_types); |
| 917 extension_warnings_.ClearWarnings(warning_types); |
| 916 } | 918 } |
| 917 | 919 |
| 918 void ExtensionService::GrantPermissionsAndEnableExtension( | 920 void ExtensionService::GrantPermissionsAndEnableExtension( |
| 919 const Extension* extension, bool record_oauth2_grant) { | 921 const Extension* extension, bool record_oauth2_grant) { |
| 920 GrantPermissions(extension, record_oauth2_grant); | 922 GrantPermissions(extension, record_oauth2_grant); |
| 921 RecordPermissionMessagesHistogram( | 923 RecordPermissionMessagesHistogram( |
| 922 extension, "Extensions.Permissions_ReEnable"); | 924 extension, "Extensions.Permissions_ReEnable"); |
| 923 extension_prefs_->SetDidExtensionEscalatePermissions(extension, false); | 925 extension_prefs_->SetDidExtensionEscalatePermissions(extension, false); |
| 924 EnableExtension(extension->id()); | 926 EnableExtension(extension->id()); |
| 925 } | 927 } |
| (...skipping 1698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2624 extensions::ExtensionHost* extension_host) { | 2626 extensions::ExtensionHost* extension_host) { |
| 2625 if (!extension_host) | 2627 if (!extension_host) |
| 2626 return; | 2628 return; |
| 2627 | 2629 |
| 2628 #if !defined(OS_ANDROID) | 2630 #if !defined(OS_ANDROID) |
| 2629 extensions::LaunchPlatformApp(extension_host->profile(), | 2631 extensions::LaunchPlatformApp(extension_host->profile(), |
| 2630 extension_host->extension(), | 2632 extension_host->extension(), |
| 2631 NULL, FilePath()); | 2633 NULL, FilePath()); |
| 2632 #endif | 2634 #endif |
| 2633 } | 2635 } |
| OLD | NEW |