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

Side by Side Diff: chrome/browser/apps/ephemeral_app_service_factory.cc

Issue 344543006: Disable ephemeral apps after they stop running (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed review comments and refactoring Created 6 years, 4 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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/apps/ephemeral_app_service_factory.h" 5 #include "chrome/browser/apps/ephemeral_app_service_factory.h"
6 6
7 #include "apps/app_lifetime_monitor_factory.h"
7 #include "chrome/browser/apps/ephemeral_app_service.h" 8 #include "chrome/browser/apps/ephemeral_app_service.h"
8 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
9 #include "components/keyed_service/content/browser_context_dependency_manager.h" 10 #include "components/keyed_service/content/browser_context_dependency_manager.h"
10 #include "extensions/browser/extension_system_provider.h" 11 #include "extensions/browser/extension_system_provider.h"
11 #include "extensions/browser/extensions_browser_client.h" 12 #include "extensions/browser/extensions_browser_client.h"
12 13
13 using extensions::ExtensionsBrowserClient; 14 using extensions::ExtensionsBrowserClient;
14 15
15 // static 16 // static
16 EphemeralAppService* 17 EphemeralAppService*
17 EphemeralAppServiceFactory::GetForProfile(Profile* profile) { 18 EphemeralAppServiceFactory::GetForProfile(Profile* profile) {
18 return static_cast<EphemeralAppService*>( 19 return static_cast<EphemeralAppService*>(
19 GetInstance()->GetServiceForBrowserContext(profile, true)); 20 GetInstance()->GetServiceForBrowserContext(profile, true));
20 } 21 }
21 22
22 // static 23 // static
23 EphemeralAppServiceFactory* EphemeralAppServiceFactory::GetInstance() { 24 EphemeralAppServiceFactory* EphemeralAppServiceFactory::GetInstance() {
24 return Singleton<EphemeralAppServiceFactory>::get(); 25 return Singleton<EphemeralAppServiceFactory>::get();
25 } 26 }
26 27
27 EphemeralAppServiceFactory::EphemeralAppServiceFactory() 28 EphemeralAppServiceFactory::EphemeralAppServiceFactory()
28 : BrowserContextKeyedServiceFactory( 29 : BrowserContextKeyedServiceFactory(
29 "EphemeralAppService", 30 "EphemeralAppService",
30 BrowserContextDependencyManager::GetInstance()) { 31 BrowserContextDependencyManager::GetInstance()) {
31 DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory()); 32 DependsOn(ExtensionsBrowserClient::Get()->GetExtensionSystemFactory());
33 DependsOn(apps::AppLifetimeMonitorFactory::GetInstance());
32 } 34 }
33 35
34 EphemeralAppServiceFactory::~EphemeralAppServiceFactory() { 36 EphemeralAppServiceFactory::~EphemeralAppServiceFactory() {
35 } 37 }
36 38
37 KeyedService* EphemeralAppServiceFactory::BuildServiceInstanceFor( 39 KeyedService* EphemeralAppServiceFactory::BuildServiceInstanceFor(
38 content::BrowserContext* context) const { 40 content::BrowserContext* context) const {
39 return new EphemeralAppService(Profile::FromBrowserContext(context)); 41 return new EphemeralAppService(Profile::FromBrowserContext(context));
40 } 42 }
41 43
42 content::BrowserContext* EphemeralAppServiceFactory::GetBrowserContextToUse( 44 content::BrowserContext* EphemeralAppServiceFactory::GetBrowserContextToUse(
43 content::BrowserContext* context) const { 45 content::BrowserContext* context) const {
44 return ExtensionsBrowserClient::Get()->GetOriginalContext(context); 46 return ExtensionsBrowserClient::Get()->GetOriginalContext(context);
45 } 47 }
46 48
47 bool EphemeralAppServiceFactory::ServiceIsCreatedWithBrowserContext() const { 49 bool EphemeralAppServiceFactory::ServiceIsCreatedWithBrowserContext() const {
48 return true; 50 return true;
49 } 51 }
50 52
51 bool EphemeralAppServiceFactory::ServiceIsNULLWhileTesting() const { 53 bool EphemeralAppServiceFactory::ServiceIsNULLWhileTesting() const {
52 return true; 54 return true;
53 } 55 }
OLDNEW
« no previous file with comments | « chrome/browser/apps/ephemeral_app_service_browsertest.cc ('k') | chrome/browser/extensions/api/messaging/message_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698