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

Side by Side Diff: chrome/browser/extensions/api/tabs/tabs_windows_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 #include "chrome/browser/extensions/api/tabs/tabs_windows_api.h" 5 #include "chrome/browser/extensions/api/tabs/tabs_windows_api.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "chrome/browser/extensions/api/tabs/windows_event_router.h" 8 #include "chrome/browser/extensions/api/tabs/windows_event_router.h"
9 #include "chrome/browser/extensions/event_names.h" 9 #include "chrome/browser/extensions/event_names.h"
10 #include "chrome/browser/extensions/event_router.h" 10 #include "chrome/browser/extensions/event_router.h"
(...skipping 22 matching lines...) Expand all
33 WindowsEventRouter* TabsWindowsAPI::windows_event_router() { 33 WindowsEventRouter* TabsWindowsAPI::windows_event_router() {
34 if (!windows_event_router_) 34 if (!windows_event_router_)
35 windows_event_router_.reset(new WindowsEventRouter(profile_)); 35 windows_event_router_.reset(new WindowsEventRouter(profile_));
36 return windows_event_router_.get(); 36 return windows_event_router_.get();
37 } 37 }
38 38
39 void TabsWindowsAPI::Shutdown() { 39 void TabsWindowsAPI::Shutdown() {
40 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); 40 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this);
41 } 41 }
42 42
43 static base::LazyInstance<ProfileKeyedAPIFactory<TabsWindowsAPI> >
44 g_factory = LAZY_INSTANCE_INITIALIZER;
45
46 ProfileKeyedAPIFactory<TabsWindowsAPI>* TabsWindowsAPI::GetFactoryInstance() {
47 return &g_factory.Get();
48 }
49
43 void TabsWindowsAPI::OnListenerAdded( 50 void TabsWindowsAPI::OnListenerAdded(
44 const extensions::EventListenerInfo& details) { 51 const extensions::EventListenerInfo& details) {
45 windows_event_router(); 52 windows_event_router();
46 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); 53 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this);
47 } 54 }
48 55
49 static base::LazyInstance<ProfileKeyedAPIFactory<TabsWindowsAPI> >
50 g_factory = LAZY_INSTANCE_INITIALIZER;
51
52 template <>
53 ProfileKeyedAPIFactory<TabsWindowsAPI>*
54 ProfileKeyedAPIFactory<TabsWindowsAPI>::GetInstance() {
55 return &g_factory.Get();
56 }
57
58 } // namespace extensions 56 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698