Chromium Code Reviews| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 #include "chrome/browser/extensions/default_apps_trial.h" | 43 #include "chrome/browser/extensions/default_apps_trial.h" |
| 44 #include "chrome/browser/extensions/extension_browser_event_router.h" | 44 #include "chrome/browser/extensions/extension_browser_event_router.h" |
| 45 #include "chrome/browser/extensions/extension_cookies_api.h" | 45 #include "chrome/browser/extensions/extension_cookies_api.h" |
| 46 #include "chrome/browser/extensions/extension_data_deleter.h" | 46 #include "chrome/browser/extensions/extension_data_deleter.h" |
| 47 #include "chrome/browser/extensions/extension_disabled_ui.h" | 47 #include "chrome/browser/extensions/extension_disabled_ui.h" |
| 48 #include "chrome/browser/extensions/extension_error_reporter.h" | 48 #include "chrome/browser/extensions/extension_error_reporter.h" |
| 49 #include "chrome/browser/extensions/extension_font_settings_api.h" | 49 #include "chrome/browser/extensions/extension_font_settings_api.h" |
| 50 #include "chrome/browser/extensions/extension_global_error.h" | 50 #include "chrome/browser/extensions/extension_global_error.h" |
| 51 #include "chrome/browser/extensions/extension_host.h" | 51 #include "chrome/browser/extensions/extension_host.h" |
| 52 #include "chrome/browser/extensions/extension_input_ime_api.h" | 52 #include "chrome/browser/extensions/extension_input_ime_api.h" |
| 53 #include "chrome/browser/extensions/extension_keybinding_registry.h" | |
| 53 #include "chrome/browser/extensions/extension_management_api.h" | 54 #include "chrome/browser/extensions/extension_management_api.h" |
| 54 #include "chrome/browser/extensions/extension_preference_api.h" | 55 #include "chrome/browser/extensions/extension_preference_api.h" |
| 55 #include "chrome/browser/extensions/extension_process_manager.h" | 56 #include "chrome/browser/extensions/extension_process_manager.h" |
| 56 #include "chrome/browser/extensions/extension_processes_api.h" | 57 #include "chrome/browser/extensions/extension_processes_api.h" |
| 57 #include "chrome/browser/extensions/extension_sorting.h" | 58 #include "chrome/browser/extensions/extension_sorting.h" |
| 58 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 59 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
| 59 #include "chrome/browser/extensions/extension_sync_data.h" | 60 #include "chrome/browser/extensions/extension_sync_data.h" |
| 60 #include "chrome/browser/extensions/extension_system.h" | 61 #include "chrome/browser/extensions/extension_system.h" |
| 61 #include "chrome/browser/extensions/extension_web_ui.h" | 62 #include "chrome/browser/extensions/extension_web_ui.h" |
| 62 #include "chrome/browser/extensions/external_extension_provider_impl.h" | 63 #include "chrome/browser/extensions/external_extension_provider_impl.h" |
| (...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 802 | 803 |
| 803 TemplateURLService* url_service = | 804 TemplateURLService* url_service = |
| 804 TemplateURLServiceFactory::GetForProfile(profile_); | 805 TemplateURLServiceFactory::GetForProfile(profile_); |
| 805 if (url_service) | 806 if (url_service) |
| 806 url_service->UnregisterExtensionKeyword(extension); | 807 url_service->UnregisterExtensionKeyword(extension); |
| 807 | 808 |
| 808 // Unload before doing more cleanup to ensure that nothing is hanging on to | 809 // Unload before doing more cleanup to ensure that nothing is hanging on to |
| 809 // any of these resources. | 810 // any of these resources. |
| 810 UnloadExtension(extension_id, extension_misc::UNLOAD_REASON_UNINSTALL); | 811 UnloadExtension(extension_id, extension_misc::UNLOAD_REASON_UNINSTALL); |
| 811 | 812 |
| 813 ExtensionKeybindingRegistry::RemoveKeybindingPref(profile_->GetPrefs(), | |
|
Aaron Boodman
2012/04/25 19:14:38
Please avoid adding more glue code here. Instead,
Finnur
2012/04/26 13:12:35
I thought about that. The problem is that the Exte
Aaron Boodman
2012/04/26 19:29:30
I see. In that case, I suggest a small KeybindingG
| |
| 814 extension_id); | |
| 815 | |
| 812 extension_prefs_->OnExtensionUninstalled(extension_id, extension->location(), | 816 extension_prefs_->OnExtensionUninstalled(extension_id, extension->location(), |
| 813 external_uninstall); | 817 external_uninstall); |
| 814 | 818 |
| 815 // Tell the backend to start deleting installed extensions on the file thread. | 819 // Tell the backend to start deleting installed extensions on the file thread. |
| 816 if (Extension::LOAD != extension->location()) { | 820 if (Extension::LOAD != extension->location()) { |
| 817 if (!BrowserThread::PostTask( | 821 if (!BrowserThread::PostTask( |
| 818 BrowserThread::FILE, FROM_HERE, | 822 BrowserThread::FILE, FROM_HERE, |
| 819 base::Bind( | 823 base::Bind( |
| 820 &extension_file_util::UninstallExtension, | 824 &extension_file_util::UninstallExtension, |
| 821 install_directory_, | 825 install_directory_, |
| (...skipping 1429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2251 from_webstore, | 2255 from_webstore, |
| 2252 page_ordinal); | 2256 page_ordinal); |
| 2253 | 2257 |
| 2254 // Unpacked extensions default to allowing file access, but if that has been | 2258 // Unpacked extensions default to allowing file access, but if that has been |
| 2255 // overridden, don't reset the value. | 2259 // overridden, don't reset the value. |
| 2256 if (Extension::ShouldAlwaysAllowFileAccess(extension->location()) && | 2260 if (Extension::ShouldAlwaysAllowFileAccess(extension->location()) && |
| 2257 !extension_prefs_->HasAllowFileAccessSetting(id)) { | 2261 !extension_prefs_->HasAllowFileAccessSetting(id)) { |
| 2258 extension_prefs_->SetAllowFileAccess(id, true); | 2262 extension_prefs_->SetAllowFileAccess(id, true); |
| 2259 } | 2263 } |
| 2260 | 2264 |
| 2265 ExtensionKeybindingRegistry::ResolveKeyBindings(profile_->GetPrefs(), | |
| 2266 extension); | |
|
Finnur
2012/04/26 13:12:35
Same question here. Move it to OnExtensionInstalle
| |
| 2267 | |
| 2261 // Transfer ownership of |extension| to AddExtension. | 2268 // Transfer ownership of |extension| to AddExtension. |
| 2262 if (AddExtension(scoped_extension)) { | 2269 if (AddExtension(scoped_extension)) { |
| 2263 content::NotificationService::current()->Notify( | 2270 content::NotificationService::current()->Notify( |
| 2264 chrome::NOTIFICATION_EXTENSION_INSTALLED, | 2271 chrome::NOTIFICATION_EXTENSION_INSTALLED, |
| 2265 content::Source<Profile>(profile_), | 2272 content::Source<Profile>(profile_), |
| 2266 content::Details<const Extension>(extension)); | 2273 content::Details<const Extension>(extension)); |
| 2267 } | 2274 } |
| 2268 } | 2275 } |
| 2269 | 2276 |
| 2270 const Extension* ExtensionService::GetExtensionByIdInternal( | 2277 const Extension* ExtensionService::GetExtensionByIdInternal( |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2645 // To coexist with certain unit tests that don't have an IO thread message | 2652 // To coexist with certain unit tests that don't have an IO thread message |
| 2646 // loop available at ExtensionService shutdown, we lazy-initialize this | 2653 // loop available at ExtensionService shutdown, we lazy-initialize this |
| 2647 // object so that those cases neither create nor destroy an | 2654 // object so that those cases neither create nor destroy an |
| 2648 // APIResourceController. | 2655 // APIResourceController. |
| 2649 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 2656 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 2650 if (!api_resource_controller_) { | 2657 if (!api_resource_controller_) { |
| 2651 api_resource_controller_ = new extensions::APIResourceController(); | 2658 api_resource_controller_ = new extensions::APIResourceController(); |
| 2652 } | 2659 } |
| 2653 return api_resource_controller_; | 2660 return api_resource_controller_; |
| 2654 } | 2661 } |
| OLD | NEW |