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

Side by Side Diff: chrome/browser/extensions/api/runtime/runtime_api_factory.cc

Issue 168253002: Cleanup many APIs to use ProfileKeyedAPI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 9 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
(Empty)
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/extensions/api/runtime/runtime_api_factory.h"
6
7 #include "chrome/browser/extensions/api/runtime/runtime_api.h"
8 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h"
9 #include "extensions/browser/extension_system_provider.h"
10 #include "extensions/browser/extensions_browser_client.h"
11
12 namespace extensions {
13
14 // static
15 RuntimeAPI* RuntimeAPIFactory::GetForBrowserContext(
16 content::BrowserContext* context) {
17 return static_cast<RuntimeAPI*>(
18 GetInstance()->GetServiceForBrowserContext(context, true));
19 }
20
21 // static
22 RuntimeAPIFactory* RuntimeAPIFactory::GetInstance() {
23 return Singleton<RuntimeAPIFactory>::get();
24 }
25
26 RuntimeAPIFactory::RuntimeAPIFactory()
27 : BrowserContextKeyedServiceFactory(
28 "RuntimeAPI",
29 BrowserContextDependencyManager::GetInstance()) {
30 DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory());
31 }
32
33 RuntimeAPIFactory::~RuntimeAPIFactory() {
34 }
35
36 BrowserContextKeyedService* RuntimeAPIFactory::BuildServiceInstanceFor(
37 content::BrowserContext* context) const {
38 return new RuntimeAPI(context);
39 }
40
41 content::BrowserContext* RuntimeAPIFactory::GetBrowserContextToUse(
42 content::BrowserContext* context) const {
43 // Instance is shared between incognito and regular profiles.
44 return ExtensionsBrowserClient::Get()->GetOriginalContext(context);
45 }
46
47 bool RuntimeAPIFactory::ServiceIsCreatedWithBrowserContext() const {
48 return true;
49 }
50
51 bool RuntimeAPIFactory::ServiceIsNULLWhileTesting() const {
52 return true;
53 }
54
55 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698