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

Side by Side Diff: chrome/browser/apps/ephemeral_app_service.h

Issue 1497193002: Remove all the ephemeral apps code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Self review, Devlin review. Created 5 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
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 #ifndef CHROME_BROWSER_APPS_EPHEMERAL_APP_SERVICE_H_
6 #define CHROME_BROWSER_APPS_EPHEMERAL_APP_SERVICE_H_
7
8 #include <set>
9
10 #include "apps/app_lifetime_monitor.h"
11 #include "base/memory/weak_ptr.h"
12 #include "base/scoped_observer.h"
13 #include "components/keyed_service/core/keyed_service.h"
14 #include "extensions/browser/extension_registry_observer.h"
15
16 class Profile;
17
18 namespace extensions {
19 class Extension;
20 class ExtensionRegistry;
21 } // namespace extensions
22
23 // Delete cached ephemeral apps at startup.
24 // TODO(benwells): Remove this system. https://crbug.com/517735.
25 class EphemeralAppService : public KeyedService,
26 public extensions::ExtensionRegistryObserver,
27 public apps::AppLifetimeMonitor::Observer {
28 public:
29 // Returns the instance for the given profile. This is a convenience wrapper
30 // around EphemeralAppServiceFactory::GetForProfile.
31 static EphemeralAppService* Get(Profile* profile);
32
33 explicit EphemeralAppService(Profile* profile);
34 ~EphemeralAppService() override;
35
36 // Clears the ephemeral app cache. Removes all idle ephemeral apps.
37 void ClearCachedApps();
38
39 void set_disable_delay_for_test(int delay) {
40 disable_idle_app_delay_ = delay;
41 }
42
43 private:
44 // extensions::ExtensionRegistryObserver.
45 void OnExtensionWillBeInstalled(content::BrowserContext* browser_context,
46 const extensions::Extension* extension,
47 bool is_update,
48 bool from_ephemeral,
49 const std::string& old_name) override;
50
51 // apps::AppLifetimeMonitor::Observer implementation.
52 void OnAppStop(Profile* profile, const std::string& app_id) override;
53 void OnChromeTerminating() override;
54
55 void Init();
56
57 void DisableEphemeralApp(const std::string& app_id);
58
59 void HandleEphemeralAppPromoted(const extensions::Extension* app);
60
61 Profile* profile_;
62
63 ScopedObserver<extensions::ExtensionRegistry,
64 extensions::ExtensionRegistryObserver>
65 extension_registry_observer_;
66 ScopedObserver<apps::AppLifetimeMonitor, apps::AppLifetimeMonitor::Observer>
67 app_lifetime_monitor_observer_;
68
69 // Number of seconds before disabling idle ephemeral apps.
70 // Overridden in tests.
71 int disable_idle_app_delay_;
72
73 base::WeakPtrFactory<EphemeralAppService> weak_ptr_factory_;
74
75 friend class EphemeralAppServiceBrowserTest;
76
77 DISALLOW_COPY_AND_ASSIGN(EphemeralAppService);
78 };
79
80 #endif // CHROME_BROWSER_APPS_EPHEMERAL_APP_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/apps/ephemeral_app_browsertest.cc ('k') | chrome/browser/apps/ephemeral_app_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698