Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 13 matching lines...) Expand all Loading... | |
| 24 #include "base/threading/thread_restrictions.h" | 24 #include "base/threading/thread_restrictions.h" |
| 25 #include "base/time.h" | 25 #include "base/time.h" |
| 26 #include "base/utf_string_conversions.h" | 26 #include "base/utf_string_conversions.h" |
| 27 #include "base/values.h" | 27 #include "base/values.h" |
| 28 #include "base/version.h" | 28 #include "base/version.h" |
| 29 #include "chrome/browser/accessibility/accessibility_extension_api.h" | 29 #include "chrome/browser/accessibility/accessibility_extension_api.h" |
| 30 #include "chrome/browser/bookmarks/bookmark_extension_api.h" | 30 #include "chrome/browser/bookmarks/bookmark_extension_api.h" |
| 31 #include "chrome/browser/browser_process.h" | 31 #include "chrome/browser/browser_process.h" |
| 32 #include "chrome/browser/chrome_plugin_service_filter.h" | 32 #include "chrome/browser/chrome_plugin_service_filter.h" |
| 33 #include "chrome/browser/download/download_extension_api.h" | 33 #include "chrome/browser/download/download_extension_api.h" |
| 34 #include "chrome/browser/extensions/api/socket/socket_api_controller.h" | |
| 34 #include "chrome/browser/extensions/app_notification_manager.h" | 35 #include "chrome/browser/extensions/app_notification_manager.h" |
| 35 #include "chrome/browser/extensions/apps_promo.h" | 36 #include "chrome/browser/extensions/apps_promo.h" |
| 36 #include "chrome/browser/extensions/component_loader.h" | 37 #include "chrome/browser/extensions/component_loader.h" |
| 37 #include "chrome/browser/extensions/crx_installer.h" | 38 #include "chrome/browser/extensions/crx_installer.h" |
| 38 #include "chrome/browser/extensions/default_apps_trial.h" | 39 #include "chrome/browser/extensions/default_apps_trial.h" |
| 39 #include "chrome/browser/extensions/extension_browser_event_router.h" | 40 #include "chrome/browser/extensions/extension_browser_event_router.h" |
| 40 #include "chrome/browser/extensions/extension_cookies_api.h" | 41 #include "chrome/browser/extensions/extension_cookies_api.h" |
| 41 #include "chrome/browser/extensions/extension_data_deleter.h" | 42 #include "chrome/browser/extensions/extension_data_deleter.h" |
| 42 #include "chrome/browser/extensions/extension_error_reporter.h" | 43 #include "chrome/browser/extensions/extension_error_reporter.h" |
| 43 #include "chrome/browser/extensions/extension_global_error.h" | 44 #include "chrome/browser/extensions/extension_global_error.h" |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 379 install_directory_(install_directory), | 380 install_directory_(install_directory), |
| 380 extensions_enabled_(extensions_enabled), | 381 extensions_enabled_(extensions_enabled), |
| 381 show_extensions_prompts_(true), | 382 show_extensions_prompts_(true), |
| 382 ready_(false), | 383 ready_(false), |
| 383 toolbar_model_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), | 384 toolbar_model_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), |
| 384 menu_manager_(profile), | 385 menu_manager_(profile), |
| 385 app_notification_manager_(new AppNotificationManager(profile)), | 386 app_notification_manager_(new AppNotificationManager(profile)), |
| 386 permissions_manager_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), | 387 permissions_manager_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), |
| 387 apps_promo_(profile->GetPrefs()), | 388 apps_promo_(profile->GetPrefs()), |
| 388 event_routers_initialized_(false), | 389 event_routers_initialized_(false), |
| 389 extension_warnings_(profile) { | 390 extension_warnings_(profile), |
| 391 socket_controller_(new extensions::SocketController()) { | |
| 390 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 392 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 391 | 393 |
| 392 // Figure out if extension installation should be enabled. | 394 // Figure out if extension installation should be enabled. |
| 393 if (command_line->HasSwitch(switches::kDisableExtensions)) { | 395 if (command_line->HasSwitch(switches::kDisableExtensions)) { |
| 394 extensions_enabled_ = false; | 396 extensions_enabled_ = false; |
| 395 } else if (profile->GetPrefs()->GetBoolean(prefs::kDisableExtensions)) { | 397 } else if (profile->GetPrefs()->GetBoolean(prefs::kDisableExtensions)) { |
| 396 extensions_enabled_ = false; | 398 extensions_enabled_ = false; |
| 397 } | 399 } |
| 398 | 400 |
| 399 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, | 401 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 463 ExtensionService::~ExtensionService() { | 465 ExtensionService::~ExtensionService() { |
| 464 // No need to unload extensions here because they are profile-scoped, and the | 466 // No need to unload extensions here because they are profile-scoped, and the |
| 465 // profile is in the process of being deleted. | 467 // profile is in the process of being deleted. |
| 466 | 468 |
| 467 ProviderCollection::const_iterator i; | 469 ProviderCollection::const_iterator i; |
| 468 for (i = external_extension_providers_.begin(); | 470 for (i = external_extension_providers_.begin(); |
| 469 i != external_extension_providers_.end(); ++i) { | 471 i != external_extension_providers_.end(); ++i) { |
| 470 ExternalExtensionProviderInterface* provider = i->get(); | 472 ExternalExtensionProviderInterface* provider = i->get(); |
| 471 provider->ServiceShutdown(); | 473 provider->ServiceShutdown(); |
| 472 } | 474 } |
| 475 | |
| 476 // TODO(miket): if we find ourselves adding more and more per-API | |
| 477 // controllers, we should manage them all with an | |
| 478 // APIControllerController (still working on that name). | |
|
Aaron Boodman
2011/12/08 00:43:20
FYI, see crbug.com/104095.
asargent_no_longer_on_chrome
2011/12/08 01:00:05
Re:APIControllerController, you might be able to u
| |
| 479 BrowserThread::PostTask( | |
| 480 BrowserThread::IO, FROM_HERE, | |
| 481 base::Bind(&ExtensionService::DeleteSocketController, | |
| 482 socket_controller_)); | |
| 483 } | |
| 484 | |
| 485 // static | |
| 486 void ExtensionService::DeleteSocketController( | |
| 487 extensions::SocketController* socket_controller) { | |
| 488 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | |
| 489 delete socket_controller; | |
| 473 } | 490 } |
| 474 | 491 |
| 475 void ExtensionService::InitEventRoutersAfterImport() { | 492 void ExtensionService::InitEventRoutersAfterImport() { |
| 476 registrar_.Add(this, chrome::NOTIFICATION_IMPORT_FINISHED, | 493 registrar_.Add(this, chrome::NOTIFICATION_IMPORT_FINISHED, |
| 477 content::Source<Profile>(profile_)); | 494 content::Source<Profile>(profile_)); |
| 478 } | 495 } |
| 479 | 496 |
| 480 void ExtensionService::InitEventRouters() { | 497 void ExtensionService::InitEventRouters() { |
| 481 if (event_routers_initialized_) | 498 if (event_routers_initialized_) |
| 482 return; | 499 return; |
| (...skipping 2022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2505 | 2522 |
| 2506 ExtensionService::NaClModuleInfoList::iterator | 2523 ExtensionService::NaClModuleInfoList::iterator |
| 2507 ExtensionService::FindNaClModule(const GURL& url) { | 2524 ExtensionService::FindNaClModule(const GURL& url) { |
| 2508 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); | 2525 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); |
| 2509 iter != nacl_module_list_.end(); ++iter) { | 2526 iter != nacl_module_list_.end(); ++iter) { |
| 2510 if (iter->url == url) | 2527 if (iter->url == url) |
| 2511 return iter; | 2528 return iter; |
| 2512 } | 2529 } |
| 2513 return nacl_module_list_.end(); | 2530 return nacl_module_list_.end(); |
| 2514 } | 2531 } |
| OLD | NEW |