Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Side by Side Diff: chrome/browser/extensions/extension_service.cc

Issue 8857004: Delete UDPClientSocket on same thread as creation. Also refactor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to fix hunk failure. Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/extensions/extension_service.h ('k') | tools/heapcheck/suppressions.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/file_util.h" 14 #include "base/file_util.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/metrics/field_trial.h" 16 #include "base/metrics/field_trial.h"
17 #include "base/metrics/histogram.h" 17 #include "base/metrics/histogram.h"
18 #include "base/path_service.h" 18 #include "base/path_service.h"
19 #include "base/stl_util.h" 19 #include "base/stl_util.h"
20 #include "base/string16.h" 20 #include "base/string16.h"
21 #include "base/string_number_conversions.h" 21 #include "base/string_number_conversions.h"
22 #include "base/string_util.h" 22 #include "base/string_util.h"
23 #include "base/stringprintf.h" 23 #include "base/stringprintf.h"
24 #include "base/task.h"
24 #include "base/threading/thread_restrictions.h" 25 #include "base/threading/thread_restrictions.h"
25 #include "base/time.h" 26 #include "base/time.h"
26 #include "base/utf_string_conversions.h" 27 #include "base/utf_string_conversions.h"
27 #include "base/values.h" 28 #include "base/values.h"
28 #include "base/version.h" 29 #include "base/version.h"
29 #include "chrome/browser/accessibility/accessibility_extension_api.h" 30 #include "chrome/browser/accessibility/accessibility_extension_api.h"
30 #include "chrome/browser/bookmarks/bookmark_extension_api.h" 31 #include "chrome/browser/bookmarks/bookmark_extension_api.h"
31 #include "chrome/browser/browser_process.h" 32 #include "chrome/browser/browser_process.h"
32 #include "chrome/browser/chrome_plugin_service_filter.h" 33 #include "chrome/browser/chrome_plugin_service_filter.h"
33 #include "chrome/browser/download/download_extension_api.h" 34 #include "chrome/browser/download/download_extension_api.h"
35 #include "chrome/browser/extensions/api/socket/socket_api_controller.h"
34 #include "chrome/browser/extensions/app_notification_manager.h" 36 #include "chrome/browser/extensions/app_notification_manager.h"
35 #include "chrome/browser/extensions/apps_promo.h" 37 #include "chrome/browser/extensions/apps_promo.h"
36 #include "chrome/browser/extensions/component_loader.h" 38 #include "chrome/browser/extensions/component_loader.h"
37 #include "chrome/browser/extensions/crx_installer.h" 39 #include "chrome/browser/extensions/crx_installer.h"
38 #include "chrome/browser/extensions/default_apps_trial.h" 40 #include "chrome/browser/extensions/default_apps_trial.h"
39 #include "chrome/browser/extensions/extension_browser_event_router.h" 41 #include "chrome/browser/extensions/extension_browser_event_router.h"
40 #include "chrome/browser/extensions/extension_cookies_api.h" 42 #include "chrome/browser/extensions/extension_cookies_api.h"
41 #include "chrome/browser/extensions/extension_data_deleter.h" 43 #include "chrome/browser/extensions/extension_data_deleter.h"
42 #include "chrome/browser/extensions/extension_error_reporter.h" 44 #include "chrome/browser/extensions/extension_error_reporter.h"
43 #include "chrome/browser/extensions/extension_global_error.h" 45 #include "chrome/browser/extensions/extension_global_error.h"
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 install_directory_(install_directory), 381 install_directory_(install_directory),
380 extensions_enabled_(extensions_enabled), 382 extensions_enabled_(extensions_enabled),
381 show_extensions_prompts_(true), 383 show_extensions_prompts_(true),
382 ready_(false), 384 ready_(false),
383 toolbar_model_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), 385 toolbar_model_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
384 menu_manager_(profile), 386 menu_manager_(profile),
385 app_notification_manager_(new AppNotificationManager(profile)), 387 app_notification_manager_(new AppNotificationManager(profile)),
386 permissions_manager_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), 388 permissions_manager_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
387 apps_promo_(profile->GetPrefs()), 389 apps_promo_(profile->GetPrefs()),
388 event_routers_initialized_(false), 390 event_routers_initialized_(false),
389 extension_warnings_(profile) { 391 extension_warnings_(profile),
392 socket_controller_(new extensions::SocketController()) {
390 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 393 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
391 394
392 // Figure out if extension installation should be enabled. 395 // Figure out if extension installation should be enabled.
393 if (command_line->HasSwitch(switches::kDisableExtensions)) { 396 if (command_line->HasSwitch(switches::kDisableExtensions)) {
394 extensions_enabled_ = false; 397 extensions_enabled_ = false;
395 } else if (profile->GetPrefs()->GetBoolean(prefs::kDisableExtensions)) { 398 } else if (profile->GetPrefs()->GetBoolean(prefs::kDisableExtensions)) {
396 extensions_enabled_ = false; 399 extensions_enabled_ = false;
397 } 400 }
398 401
399 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED, 402 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_PROCESS_TERMINATED,
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 ExtensionService::~ExtensionService() { 466 ExtensionService::~ExtensionService() {
464 // No need to unload extensions here because they are profile-scoped, and the 467 // No need to unload extensions here because they are profile-scoped, and the
465 // profile is in the process of being deleted. 468 // profile is in the process of being deleted.
466 469
467 ProviderCollection::const_iterator i; 470 ProviderCollection::const_iterator i;
468 for (i = external_extension_providers_.begin(); 471 for (i = external_extension_providers_.begin();
469 i != external_extension_providers_.end(); ++i) { 472 i != external_extension_providers_.end(); ++i) {
470 ExternalExtensionProviderInterface* provider = i->get(); 473 ExternalExtensionProviderInterface* provider = i->get();
471 provider->ServiceShutdown(); 474 provider->ServiceShutdown();
472 } 475 }
476
477 // TODO(miket): if we find ourselves adding more and more per-API
478 // controllers, we should manage them all with an
479 // APIControllerController (still working on that name).
480 BrowserThread::PostTask(
481 BrowserThread::IO, FROM_HERE,
482 new DeleteTask<extensions::SocketController>(socket_controller_));
473 } 483 }
474 484
475 void ExtensionService::InitEventRoutersAfterImport() { 485 void ExtensionService::InitEventRoutersAfterImport() {
476 registrar_.Add(this, chrome::NOTIFICATION_IMPORT_FINISHED, 486 registrar_.Add(this, chrome::NOTIFICATION_IMPORT_FINISHED,
477 content::Source<Profile>(profile_)); 487 content::Source<Profile>(profile_));
478 } 488 }
479 489
480 void ExtensionService::InitEventRouters() { 490 void ExtensionService::InitEventRouters() {
481 if (event_routers_initialized_) 491 if (event_routers_initialized_)
482 return; 492 return;
(...skipping 2022 matching lines...) Expand 10 before | Expand all | Expand 10 after
2505 2515
2506 ExtensionService::NaClModuleInfoList::iterator 2516 ExtensionService::NaClModuleInfoList::iterator
2507 ExtensionService::FindNaClModule(const GURL& url) { 2517 ExtensionService::FindNaClModule(const GURL& url) {
2508 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin(); 2518 for (NaClModuleInfoList::iterator iter = nacl_module_list_.begin();
2509 iter != nacl_module_list_.end(); ++iter) { 2519 iter != nacl_module_list_.end(); ++iter) {
2510 if (iter->url == url) 2520 if (iter->url == url)
2511 return iter; 2521 return iter;
2512 } 2522 }
2513 return nacl_module_list_.end(); 2523 return nacl_module_list_.end();
2514 } 2524 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service.h ('k') | tools/heapcheck/suppressions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698