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

Side by Side Diff: chrome/browser/extensions/platform_app_service.cc

Issue 11117011: Keep browser process alive while there are platform apps with background pages running. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: And another test Created 8 years 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 (c) 2012 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/platform_app_service.h"
6
7 #include "chrome/browser/extensions/extension_host.h"
8 #include "chrome/common/chrome_notification_types.h"
9 #include "chrome/common/extensions/extension.h"
10 #include "content/public/browser/browser_context.h"
11 #include "content/public/browser/notification_details.h"
12 #include "content/public/browser/notification_service.h"
13 #include "content/public/browser/notification_types.h"
14
15 namespace extensions {
16
17 PlatformAppService::PlatformAppService(Profile* profile) {
18 #if !defined(OS_CHROMEOS)
19 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_CREATED,
20 content::Source<content::BrowserContext>(profile));
21 #endif
22 }
23
24 PlatformAppService::~PlatformAppService() {}
25
26 void PlatformAppService::Observe(int type,
27 const content::NotificationSource& source,
28 const content::NotificationDetails& details) {
29 switch (type) {
30 case chrome::NOTIFICATION_EXTENSION_HOST_CREATED: {
31 // This code causes problems at logout for ChromeOS, and is not necessary anyway
32 // as the browser process lifetime is defined by the session.
33 #if !defined(OS_CHROMEOS)
34 ExtensionHost* host = content::Details<ExtensionHost>(details).ptr();
35 if (host->extension()->is_platform_app())
36 host->SetKeepsBrowserProcessAlive();
37 #endif
38 break;
39 }
40 default:
41 NOTREACHED();
42 }
43 }
44
45 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/platform_app_service.h ('k') | chrome/browser/extensions/platform_app_service_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698