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 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 // Idempotent, so although there is a possible race if the import | 528 // Idempotent, so although there is a possible race if the import |
529 // process finished sometime in the middle of ProfileImpl::InitExtensions, | 529 // process finished sometime in the middle of ProfileImpl::InitExtensions, |
530 // it cannot happen twice. | 530 // it cannot happen twice. |
531 InitEventRouters(); | 531 InitEventRouters(); |
532 } | 532 } |
533 | 533 |
534 void ExtensionService::InitEventRouters() { | 534 void ExtensionService::InitEventRouters() { |
535 if (event_routers_initialized_) | 535 if (event_routers_initialized_) |
536 return; | 536 return; |
537 | 537 |
| 538 #if defined(ENABLE_EXTENSIONS) |
538 downloads_event_router_.reset(new ExtensionDownloadsEventRouter(profile_)); | 539 downloads_event_router_.reset(new ExtensionDownloadsEventRouter(profile_)); |
539 history_event_router_.reset(new HistoryExtensionEventRouter()); | 540 history_event_router_.reset(new HistoryExtensionEventRouter()); |
540 history_event_router_->ObserveProfile(profile_); | 541 history_event_router_->ObserveProfile(profile_); |
541 browser_event_router_.reset(new ExtensionBrowserEventRouter(profile_)); | 542 browser_event_router_.reset(new ExtensionBrowserEventRouter(profile_)); |
542 browser_event_router_->Init(); | 543 browser_event_router_->Init(); |
543 preference_event_router_.reset(new ExtensionPreferenceEventRouter(profile_)); | 544 preference_event_router_.reset(new ExtensionPreferenceEventRouter(profile_)); |
544 bookmark_event_router_.reset(new BookmarkExtensionEventRouter( | 545 bookmark_event_router_.reset(new BookmarkExtensionEventRouter( |
545 profile_->GetBookmarkModel())); | 546 profile_->GetBookmarkModel())); |
546 bookmark_event_router_->Init(); | 547 bookmark_event_router_->Init(); |
547 cookies_event_router_.reset(new ExtensionCookiesEventRouter(profile_)); | 548 cookies_event_router_.reset(new ExtensionCookiesEventRouter(profile_)); |
(...skipping 19 matching lines...) Expand all Loading... |
567 new chromeos::ExtensionInputMethodEventRouter); | 568 new chromeos::ExtensionInputMethodEventRouter); |
568 | 569 |
569 ExtensionMediaPlayerEventRouter::GetInstance()->Init(profile_); | 570 ExtensionMediaPlayerEventRouter::GetInstance()->Init(profile_); |
570 ExtensionInputImeEventRouter::GetInstance()->Init(); | 571 ExtensionInputImeEventRouter::GetInstance()->Init(); |
571 #endif | 572 #endif |
572 | 573 |
573 #if defined(OS_CHROMEOS) && defined(USE_VIRTUAL_KEYBOARD) | 574 #if defined(OS_CHROMEOS) && defined(USE_VIRTUAL_KEYBOARD) |
574 ExtensionInputUiEventRouter::GetInstance()->Init(); | 575 ExtensionInputUiEventRouter::GetInstance()->Init(); |
575 #endif | 576 #endif |
576 | 577 |
| 578 #endif // defined(ENABLE_EXTENSIONS) |
577 event_routers_initialized_ = true; | 579 event_routers_initialized_ = true; |
578 } | 580 } |
579 | 581 |
580 const Extension* ExtensionService::GetExtensionById( | 582 const Extension* ExtensionService::GetExtensionById( |
581 const std::string& id, bool include_disabled) const { | 583 const std::string& id, bool include_disabled) const { |
582 return GetExtensionByIdInternal(id, true, include_disabled, false); | 584 return GetExtensionByIdInternal(id, true, include_disabled, false); |
583 } | 585 } |
584 | 586 |
585 void ExtensionService::Init() { | 587 void ExtensionService::Init() { |
586 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 588 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
(...skipping 2050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2637 // To coexist with certain unit tests that don't have an IO thread message | 2639 // To coexist with certain unit tests that don't have an IO thread message |
2638 // loop available at ExtensionService shutdown, we lazy-initialize this | 2640 // loop available at ExtensionService shutdown, we lazy-initialize this |
2639 // object so that those cases neither create nor destroy an | 2641 // object so that those cases neither create nor destroy an |
2640 // APIResourceController. | 2642 // APIResourceController. |
2641 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 2643 CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
2642 if (!api_resource_controller_) { | 2644 if (!api_resource_controller_) { |
2643 api_resource_controller_ = new extensions::APIResourceController(); | 2645 api_resource_controller_ = new extensions::APIResourceController(); |
2644 } | 2646 } |
2645 return api_resource_controller_; | 2647 return api_resource_controller_; |
2646 } | 2648 } |
OLD | NEW |