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" |
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" | |
25 #include "base/threading/thread_restrictions.h" | 24 #include "base/threading/thread_restrictions.h" |
26 #include "base/time.h" | 25 #include "base/time.h" |
27 #include "base/utf_string_conversions.h" | 26 #include "base/utf_string_conversions.h" |
28 #include "base/values.h" | 27 #include "base/values.h" |
29 #include "base/version.h" | 28 #include "base/version.h" |
30 #include "chrome/browser/accessibility/accessibility_extension_api.h" | 29 #include "chrome/browser/accessibility/accessibility_extension_api.h" |
31 #include "chrome/browser/bookmarks/bookmark_extension_api.h" | 30 #include "chrome/browser/bookmarks/bookmark_extension_api.h" |
32 #include "chrome/browser/browser_process.h" | 31 #include "chrome/browser/browser_process.h" |
33 #include "chrome/browser/chrome_plugin_service_filter.h" | 32 #include "chrome/browser/chrome_plugin_service_filter.h" |
34 #include "chrome/browser/download/download_extension_api.h" | 33 #include "chrome/browser/download/download_extension_api.h" |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 } | 479 } |
481 | 480 |
482 // TODO(miket): if we find ourselves adding more and more per-API | 481 // TODO(miket): if we find ourselves adding more and more per-API |
483 // controllers, we should manage them all with an | 482 // controllers, we should manage them all with an |
484 // APIControllerController (still working on that name). | 483 // APIControllerController (still working on that name). |
485 if (socket_controller_) { | 484 if (socket_controller_) { |
486 // If this check failed, then a unit test was using sockets but didn't | 485 // If this check failed, then a unit test was using sockets but didn't |
487 // provide the IO thread message loop needed for those sockets to do their | 486 // provide the IO thread message loop needed for those sockets to do their |
488 // job (including destroying themselves at shutdown). | 487 // job (including destroying themselves at shutdown). |
489 DCHECK(BrowserThread::IsMessageLoopValid(BrowserThread::IO)); | 488 DCHECK(BrowserThread::IsMessageLoopValid(BrowserThread::IO)); |
490 BrowserThread::PostTask( | 489 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, socket_controller_); |
491 BrowserThread::IO, FROM_HERE, | |
492 new DeleteTask<extensions::SocketController>(socket_controller_)); | |
493 } | 490 } |
494 } | 491 } |
495 | 492 |
496 void ExtensionService::InitEventRoutersAfterImport() { | 493 void ExtensionService::InitEventRoutersAfterImport() { |
497 RegisterForImportFinished(); | 494 RegisterForImportFinished(); |
498 } | 495 } |
499 | 496 |
500 void ExtensionService::RegisterForImportFinished() { | 497 void ExtensionService::RegisterForImportFinished() { |
501 if (!registrar_.IsRegistered(this, chrome::NOTIFICATION_IMPORT_FINISHED, | 498 if (!registrar_.IsRegistered(this, chrome::NOTIFICATION_IMPORT_FINISHED, |
502 content::Source<Profile>(profile_))) { | 499 content::Source<Profile>(profile_))) { |
(...skipping 2161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2664 // | 2661 // |
2665 // To coexist with certain unit tests that don't have an IO thread message | 2662 // To coexist with certain unit tests that don't have an IO thread message |
2666 // loop available at ExtensionService shutdown, we lazy-initialize this | 2663 // loop available at ExtensionService shutdown, we lazy-initialize this |
2667 // object so that those cases neither create nor destroy a SocketController. | 2664 // object so that those cases neither create nor destroy a SocketController. |
2668 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 2665 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
2669 if (!socket_controller_) { | 2666 if (!socket_controller_) { |
2670 socket_controller_ = new extensions::SocketController(); | 2667 socket_controller_ = new extensions::SocketController(); |
2671 } | 2668 } |
2672 return socket_controller_; | 2669 return socket_controller_; |
2673 } | 2670 } |
OLD | NEW |