OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_BACKGROUND_BACKGROUND_MODE_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_BACKGROUND_BACKGROUND_MODE_MANAGER_H_ |
6 #define CHROME_BROWSER_BACKGROUND_BACKGROUND_MODE_MANAGER_H_ | 6 #define CHROME_BROWSER_BACKGROUND_BACKGROUND_MODE_MANAGER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... | |
38 // | 38 // |
39 // When Chrome is in background mode, it will continue running even after the | 39 // When Chrome is in background mode, it will continue running even after the |
40 // last browser window is closed, until the user explicitly exits the app. | 40 // last browser window is closed, until the user explicitly exits the app. |
41 // Additionally, when in background mode, Chrome will launch on OS login with | 41 // Additionally, when in background mode, Chrome will launch on OS login with |
42 // no open windows to allow apps with the "background" permission to run in the | 42 // no open windows to allow apps with the "background" permission to run in the |
43 // background. | 43 // background. |
44 class BackgroundModeManager | 44 class BackgroundModeManager |
45 : public content::NotificationObserver, | 45 : public content::NotificationObserver, |
46 public BackgroundApplicationListModel::Observer, | 46 public BackgroundApplicationListModel::Observer, |
47 public ProfileInfoCacheObserver, | 47 public ProfileInfoCacheObserver, |
48 public ProfileKeyedService, | |
49 public ui::SimpleMenuModel::Delegate { | 48 public ui::SimpleMenuModel::Delegate { |
50 public: | 49 public: |
51 BackgroundModeManager(CommandLine* command_line, | 50 BackgroundModeManager(CommandLine* command_line, |
52 ProfileInfoCache* profile_cache); | 51 ProfileInfoCache* profile_cache); |
53 virtual ~BackgroundModeManager(); | 52 virtual ~BackgroundModeManager(); |
54 | 53 |
55 static void RegisterPrefs(PrefService* prefs); | 54 static void RegisterPrefs(PrefService* prefs); |
56 | 55 |
57 virtual void RegisterProfile(Profile* profile); | 56 virtual void RegisterProfile(Profile* profile); |
58 | 57 |
59 static void LaunchBackgroundApplication(Profile* profile, | 58 static void LaunchBackgroundApplication(Profile* profile, |
60 const Extension* extension); | 59 const Extension* extension); |
61 | 60 |
61 // Returns true if background mode is active. Used only by tests. | |
62 bool IsBackgroundModeActiveForTest(); | |
63 | |
62 // For testing purposes. | 64 // For testing purposes. |
63 int NumberOfBackgroundModeData(); | 65 int NumberOfBackgroundModeData(); |
64 | 66 |
65 private: | 67 private: |
68 friend class AppBackgroundPageApiTest; | |
Mihai Parparita -not on Chrome
2012/05/03 00:54:11
Given this friend declaration, does IsBackgroundMo
Andrew T Wilson (Slow)
2012/05/03 07:42:56
Agreed, it can be private.
| |
69 friend class BackgroundModeManagerTest; | |
66 friend class TestBackgroundModeManager; | 70 friend class TestBackgroundModeManager; |
67 friend class BackgroundModeManagerTest; | |
68 FRIEND_TEST_ALL_PREFIXES(BackgroundModeManagerTest, | 71 FRIEND_TEST_ALL_PREFIXES(BackgroundModeManagerTest, |
69 BackgroundAppLoadUnload); | 72 BackgroundAppLoadUnload); |
70 FRIEND_TEST_ALL_PREFIXES(BackgroundModeManagerTest, | 73 FRIEND_TEST_ALL_PREFIXES(BackgroundModeManagerTest, |
71 BackgroundLaunchOnStartup); | 74 BackgroundLaunchOnStartup); |
72 FRIEND_TEST_ALL_PREFIXES(BackgroundModeManagerTest, | 75 FRIEND_TEST_ALL_PREFIXES(BackgroundModeManagerTest, |
73 BackgroundAppInstallUninstallWhileDisabled); | 76 BackgroundAppInstallUninstallWhileDisabled); |
74 FRIEND_TEST_ALL_PREFIXES(BackgroundModeManagerTest, | 77 FRIEND_TEST_ALL_PREFIXES(BackgroundModeManagerTest, |
75 EnableAfterBackgroundAppInstall); | 78 EnableAfterBackgroundAppInstall); |
76 FRIEND_TEST_ALL_PREFIXES(BackgroundModeManagerTest, | 79 FRIEND_TEST_ALL_PREFIXES(BackgroundModeManagerTest, |
77 MultiProfile); | 80 MultiProfile); |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
288 // app). | 291 // app). |
289 bool keep_alive_for_test_; | 292 bool keep_alive_for_test_; |
290 | 293 |
291 // Provides a command id for each profile as they are created. | 294 // Provides a command id for each profile as they are created. |
292 int current_command_id_; | 295 int current_command_id_; |
293 | 296 |
294 DISALLOW_COPY_AND_ASSIGN(BackgroundModeManager); | 297 DISALLOW_COPY_AND_ASSIGN(BackgroundModeManager); |
295 }; | 298 }; |
296 | 299 |
297 #endif // CHROME_BROWSER_BACKGROUND_BACKGROUND_MODE_MANAGER_H_ | 300 #endif // CHROME_BROWSER_BACKGROUND_BACKGROUND_MODE_MANAGER_H_ |
OLD | NEW |