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

Side by Side Diff: chrome/browser/extensions/api/managed_mode/managed_mode_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 // Implementation of the Chrome Extensions Managed Mode API. 5 // Implementation of the Chrome Extensions Managed Mode API.
6 6
7 #include "chrome/browser/extensions/api/managed_mode/managed_mode_api.h" 7 #include "chrome/browser/extensions/api/managed_mode/managed_mode_api.h"
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 this, kChangeEventName); 130 this, kChangeEventName);
131 } 131 }
132 132
133 ManagedModeAPI::~ManagedModeAPI() { 133 ManagedModeAPI::~ManagedModeAPI() {
134 } 134 }
135 135
136 void ManagedModeAPI::Shutdown() { 136 void ManagedModeAPI::Shutdown() {
137 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); 137 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this);
138 } 138 }
139 139
140 static base::LazyInstance<ProfileKeyedAPIFactory<ManagedModeAPI> >
141 g_factory = LAZY_INSTANCE_INITIALIZER;
142
143 // static
144 ProfileKeyedAPIFactory<ManagedModeAPI>* ManagedModeAPI::GetFactoryInstance() {
145 return &g_factory.Get();
146 }
147
140 void ManagedModeAPI::OnListenerAdded( 148 void ManagedModeAPI::OnListenerAdded(
141 const extensions::EventListenerInfo& details) { 149 const extensions::EventListenerInfo& details) {
142 managed_mode_event_router_.reset(new ManagedModeEventRouter(profile_)); 150 managed_mode_event_router_.reset(new ManagedModeEventRouter(profile_));
143 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); 151 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this);
144 } 152 }
145 153
146 static base::LazyInstance<ProfileKeyedAPIFactory<ManagedModeAPI> >
147 g_factory = LAZY_INSTANCE_INITIALIZER;
148
149 template <>
150 ProfileKeyedAPIFactory<ManagedModeAPI>*
151 ProfileKeyedAPIFactory<ManagedModeAPI>::GetInstance() {
152 return &g_factory.Get();
153 }
154
155 } // namespace extensions 154 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698