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

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

Issue 668903002: Standardize usage of virtual/override/final in chrome/browser/apps/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 #ifndef CHROME_BROWSER_APPS_EPHEMERAL_APP_SERVICE_H_ 5 #ifndef CHROME_BROWSER_APPS_EPHEMERAL_APP_SERVICE_H_
6 #define CHROME_BROWSER_APPS_EPHEMERAL_APP_SERVICE_H_ 6 #define CHROME_BROWSER_APPS_EPHEMERAL_APP_SERVICE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 10
(...skipping 17 matching lines...) Expand all
28 class EphemeralAppService : public KeyedService, 28 class EphemeralAppService : public KeyedService,
29 public content::NotificationObserver, 29 public content::NotificationObserver,
30 public extensions::ExtensionRegistryObserver, 30 public extensions::ExtensionRegistryObserver,
31 public apps::AppLifetimeMonitor::Observer { 31 public apps::AppLifetimeMonitor::Observer {
32 public: 32 public:
33 // Returns the instance for the given profile. This is a convenience wrapper 33 // Returns the instance for the given profile. This is a convenience wrapper
34 // around EphemeralAppServiceFactory::GetForProfile. 34 // around EphemeralAppServiceFactory::GetForProfile.
35 static EphemeralAppService* Get(Profile* profile); 35 static EphemeralAppService* Get(Profile* profile);
36 36
37 explicit EphemeralAppService(Profile* profile); 37 explicit EphemeralAppService(Profile* profile);
38 virtual ~EphemeralAppService(); 38 ~EphemeralAppService() override;
39 39
40 // Clears the ephemeral app cache. Removes all idle ephemeral apps. 40 // Clears the ephemeral app cache. Removes all idle ephemeral apps.
41 void ClearCachedApps(); 41 void ClearCachedApps();
42 42
43 int ephemeral_app_count() const { return ephemeral_app_count_; } 43 int ephemeral_app_count() const { return ephemeral_app_count_; }
44 44
45 void set_disable_delay_for_test(int delay) { 45 void set_disable_delay_for_test(int delay) {
46 disable_idle_app_delay_ = delay; 46 disable_idle_app_delay_ = delay;
47 } 47 }
48 48
49 // Constants exposed for testing purposes: 49 // Constants exposed for testing purposes:
50 50
51 // The number of days of inactivity before an ephemeral app will be removed. 51 // The number of days of inactivity before an ephemeral app will be removed.
52 static const int kAppInactiveThreshold; 52 static const int kAppInactiveThreshold;
53 // If the ephemeral app has been launched within this number of days, it will 53 // If the ephemeral app has been launched within this number of days, it will
54 // definitely not be garbage collected. 54 // definitely not be garbage collected.
55 static const int kAppKeepThreshold; 55 static const int kAppKeepThreshold;
56 // The maximum number of ephemeral apps to keep cached. Excess may be removed. 56 // The maximum number of ephemeral apps to keep cached. Excess may be removed.
57 static const int kMaxEphemeralAppsCount; 57 static const int kMaxEphemeralAppsCount;
58 58
59 private: 59 private:
60 // A map used to order the ephemeral apps by their last launch time. 60 // A map used to order the ephemeral apps by their last launch time.
61 typedef std::multimap<base::Time, std::string> LaunchTimeAppMap; 61 typedef std::multimap<base::Time, std::string> LaunchTimeAppMap;
62 62
63 // content::NotificationObserver implementation. 63 // content::NotificationObserver implementation.
64 virtual void Observe(int type, 64 void Observe(int type,
65 const content::NotificationSource& source, 65 const content::NotificationSource& source,
66 const content::NotificationDetails& details) override; 66 const content::NotificationDetails& details) override;
67 67
68 // extensions::ExtensionRegistryObserver. 68 // extensions::ExtensionRegistryObserver.
69 virtual void OnExtensionWillBeInstalled( 69 void OnExtensionWillBeInstalled(content::BrowserContext* browser_context,
70 content::BrowserContext* browser_context, 70 const extensions::Extension* extension,
71 const extensions::Extension* extension, 71 bool is_update,
72 bool is_update, 72 bool from_ephemeral,
73 bool from_ephemeral, 73 const std::string& old_name) override;
74 const std::string& old_name) override; 74 void OnExtensionUninstalled(content::BrowserContext* browser_context,
75 virtual void OnExtensionUninstalled( 75 const extensions::Extension* extension,
76 content::BrowserContext* browser_context, 76 extensions::UninstallReason reason) override;
77 const extensions::Extension* extension,
78 extensions::UninstallReason reason) override;
79 77
80 // apps::AppLifetimeMonitor::Observer implementation. 78 // apps::AppLifetimeMonitor::Observer implementation.
81 virtual void OnAppStop(Profile* profile, const std::string& app_id) override; 79 void OnAppStop(Profile* profile, const std::string& app_id) override;
82 virtual void OnChromeTerminating() override; 80 void OnChromeTerminating() override;
83 81
84 void Init(); 82 void Init();
85 void InitEphemeralAppCount(); 83 void InitEphemeralAppCount();
86 84
87 void DisableEphemeralApp(const std::string& app_id); 85 void DisableEphemeralApp(const std::string& app_id);
88 void DisableEphemeralAppsOnStartup(); 86 void DisableEphemeralAppsOnStartup();
89 87
90 void HandleEphemeralAppPromoted(const extensions::Extension* app); 88 void HandleEphemeralAppPromoted(const extensions::Extension* app);
91 89
92 // Garbage collect ephemeral apps. 90 // Garbage collect ephemeral apps.
(...skipping 23 matching lines...) Expand all
116 114
117 base::WeakPtrFactory<EphemeralAppService> weak_ptr_factory_; 115 base::WeakPtrFactory<EphemeralAppService> weak_ptr_factory_;
118 116
119 friend class EphemeralAppServiceTest; 117 friend class EphemeralAppServiceTest;
120 friend class EphemeralAppServiceBrowserTest; 118 friend class EphemeralAppServiceBrowserTest;
121 119
122 DISALLOW_COPY_AND_ASSIGN(EphemeralAppService); 120 DISALLOW_COPY_AND_ASSIGN(EphemeralAppService);
123 }; 121 };
124 122
125 #endif // CHROME_BROWSER_APPS_EPHEMERAL_APP_SERVICE_H_ 123 #endif // CHROME_BROWSER_APPS_EPHEMERAL_APP_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/apps/ephemeral_app_launcher_browsertest.cc ('k') | chrome/browser/apps/ephemeral_app_service_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698