| 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 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 SyncExtensionChangeIfNeeded(*extension); | 881 SyncExtensionChangeIfNeeded(*extension); |
| 882 | 882 |
| 883 // Deactivating one extension might have solved the problems of others. | 883 // Deactivating one extension might have solved the problems of others. |
| 884 // Therefore, we clear warnings of this type for all extensions. | 884 // Therefore, we clear warnings of this type for all extensions. |
| 885 std::set<ExtensionWarningSet::WarningType> warnings; | 885 std::set<ExtensionWarningSet::WarningType> warnings; |
| 886 extension_warnings_.GetWarningsAffectingExtension(extension_id, &warnings); | 886 extension_warnings_.GetWarningsAffectingExtension(extension_id, &warnings); |
| 887 extension_warnings_.ClearWarnings(warnings); | 887 extension_warnings_.ClearWarnings(warnings); |
| 888 } | 888 } |
| 889 | 889 |
| 890 void ExtensionService::GrantPermissionsAndEnableExtension( | 890 void ExtensionService::GrantPermissionsAndEnableExtension( |
| 891 const Extension* extension) { | 891 const Extension* extension, bool record_oauth2_grant) { |
| 892 CHECK(extension); | 892 CHECK(extension); |
| 893 RecordPermissionMessagesHistogram( | 893 RecordPermissionMessagesHistogram( |
| 894 extension, "Extensions.Permissions_ReEnable"); | 894 extension, "Extensions.Permissions_ReEnable"); |
| 895 extensions::PermissionsUpdater perms_updater(profile()); | 895 extensions::PermissionsUpdater perms_updater(profile()); |
| 896 perms_updater.GrantActivePermissions(extension); | 896 perms_updater.GrantActivePermissions(extension, record_oauth2_grant); |
| 897 extension_prefs_->SetDidExtensionEscalatePermissions(extension, false); | 897 extension_prefs_->SetDidExtensionEscalatePermissions(extension, false); |
| 898 EnableExtension(extension->id()); | 898 EnableExtension(extension->id()); |
| 899 } | 899 } |
| 900 | 900 |
| 901 // static | 901 // static |
| 902 void ExtensionService::RecordPermissionMessagesHistogram( | 902 void ExtensionService::RecordPermissionMessagesHistogram( |
| 903 const Extension* e, const char* histogram) { | 903 const Extension* e, const char* histogram) { |
| 904 // Since this is called from multiple sources, and since the Histogram macros | 904 // Since this is called from multiple sources, and since the Histogram macros |
| 905 // use statics, we need to manually lookup the Histogram ourselves. | 905 // use statics, we need to manually lookup the Histogram ourselves. |
| 906 base::Histogram* counter = base::LinearHistogram::FactoryGet( | 906 base::Histogram* counter = base::LinearHistogram::FactoryGet( |
| (...skipping 1653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2560 | 2560 |
| 2561 // To coexist with certain unit tests that don't have a work-thread message | 2561 // To coexist with certain unit tests that don't have a work-thread message |
| 2562 // loop available at ExtensionService shutdown, we lazy-initialize this | 2562 // loop available at ExtensionService shutdown, we lazy-initialize this |
| 2563 // object so that those cases neither create nor destroy an | 2563 // object so that those cases neither create nor destroy an |
| 2564 // APIResourceController. | 2564 // APIResourceController. |
| 2565 if (!api_resource_controller_.get()) { | 2565 if (!api_resource_controller_.get()) { |
| 2566 api_resource_controller_.reset(new extensions::APIResourceController()); | 2566 api_resource_controller_.reset(new extensions::APIResourceController()); |
| 2567 } | 2567 } |
| 2568 return api_resource_controller_.get(); | 2568 return api_resource_controller_.get(); |
| 2569 } | 2569 } |
| OLD | NEW |