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

Side by Side Diff: chrome/browser/extensions/api/web_navigation/web_navigation_api.cc

Issue 11682005: Remove some Profile-keyed factory boilerplate: management omnibox preference push_messaging. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 11 months 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
OLDNEW
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698