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