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 // Implements the Chrome Extensions WebNavigation API. | 5 // Implements the Chrome Extensions WebNavigation API. |
6 | 6 |
7 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h" | 7 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h" |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api_consta
nts.h" | 10 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api_consta
nts.h" |
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 this, keys::kOnTabReplaced); | 755 this, keys::kOnTabReplaced); |
756 } | 756 } |
757 | 757 |
758 WebNavigationAPI::~WebNavigationAPI() { | 758 WebNavigationAPI::~WebNavigationAPI() { |
759 } | 759 } |
760 | 760 |
761 void WebNavigationAPI::Shutdown() { | 761 void WebNavigationAPI::Shutdown() { |
762 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); | 762 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); |
763 } | 763 } |
764 | 764 |
| 765 static base::LazyInstance<ProfileKeyedAPIFactory<WebNavigationAPI> > |
| 766 g_factory = LAZY_INSTANCE_INITIALIZER; |
| 767 |
| 768 // static |
| 769 ProfileKeyedAPIFactory<WebNavigationAPI>* |
| 770 WebNavigationAPI::GetFactoryInstance() { |
| 771 return &g_factory.Get(); |
| 772 } |
| 773 |
765 void WebNavigationAPI::OnListenerAdded( | 774 void WebNavigationAPI::OnListenerAdded( |
766 const extensions::EventListenerInfo& details) { | 775 const extensions::EventListenerInfo& details) { |
767 web_navigation_event_router_.reset(new WebNavigationEventRouter(profile_)); | 776 web_navigation_event_router_.reset(new WebNavigationEventRouter(profile_)); |
768 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); | 777 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); |
769 } | 778 } |
770 | 779 |
771 static base::LazyInstance<ProfileKeyedAPIFactory<WebNavigationAPI> > | |
772 g_factory = LAZY_INSTANCE_INITIALIZER; | |
773 | |
774 template <> | |
775 ProfileKeyedAPIFactory<WebNavigationAPI>* | |
776 ProfileKeyedAPIFactory<WebNavigationAPI>::GetInstance() { | |
777 return &g_factory.Get(); | |
778 } | |
779 | |
780 } // namespace extensions | 780 } // namespace extensions |
OLD | NEW |