| 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 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 ProfileInfoCache* profile_cache); | 53 ProfileInfoCache* profile_cache); |
| 54 virtual ~BackgroundModeManager(); | 54 virtual ~BackgroundModeManager(); |
| 55 | 55 |
| 56 static void RegisterPrefs(PrefRegistrySimple* registry); | 56 static void RegisterPrefs(PrefRegistrySimple* registry); |
| 57 | 57 |
| 58 virtual void RegisterProfile(Profile* profile); | 58 virtual void RegisterProfile(Profile* profile); |
| 59 | 59 |
| 60 static void LaunchBackgroundApplication(Profile* profile, | 60 static void LaunchBackgroundApplication(Profile* profile, |
| 61 const extensions::Extension* extension); | 61 const extensions::Extension* extension); |
| 62 | 62 |
| 63 // Returns true if background mode is active. |
| 64 virtual bool IsBackgroundModeActive(); |
| 65 |
| 63 // For testing purposes. | 66 // For testing purposes. |
| 64 int NumberOfBackgroundModeData(); | 67 int NumberOfBackgroundModeData(); |
| 65 | 68 |
| 66 private: | 69 private: |
| 67 friend class AppBackgroundPageApiTest; | 70 friend class AppBackgroundPageApiTest; |
| 68 friend class BackgroundModeManagerTest; | 71 friend class BackgroundModeManagerTest; |
| 69 friend class TestBackgroundModeManager; | 72 friend class TestBackgroundModeManager; |
| 70 FRIEND_TEST_ALL_PREFIXES(BackgroundModeManagerTest, | 73 FRIEND_TEST_ALL_PREFIXES(BackgroundModeManagerTest, |
| 71 BackgroundAppLoadUnload); | 74 BackgroundAppLoadUnload); |
| 72 FRIEND_TEST_ALL_PREFIXES(BackgroundModeManagerTest, | 75 FRIEND_TEST_ALL_PREFIXES(BackgroundModeManagerTest, |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 // Returns the iterator associated with a particular profile name. | 242 // Returns the iterator associated with a particular profile name. |
| 240 // This should not be used to iterate over the background mode data. It is | 243 // This should not be used to iterate over the background mode data. It is |
| 241 // used to efficiently delete an item from the background mode data map. | 244 // used to efficiently delete an item from the background mode data map. |
| 242 BackgroundModeInfoMap::iterator GetBackgroundModeIterator( | 245 BackgroundModeInfoMap::iterator GetBackgroundModeIterator( |
| 243 const string16& profile_name); | 246 const string16& profile_name); |
| 244 | 247 |
| 245 // Returns true if the "Let chrome run in the background" pref is checked. | 248 // Returns true if the "Let chrome run in the background" pref is checked. |
| 246 // (virtual to allow overriding in tests). | 249 // (virtual to allow overriding in tests). |
| 247 virtual bool IsBackgroundModePrefEnabled() const; | 250 virtual bool IsBackgroundModePrefEnabled() const; |
| 248 | 251 |
| 249 // Returns true if background mode is active. Used only by tests. | |
| 250 bool IsBackgroundModeActiveForTest(); | |
| 251 | |
| 252 // Turns off background mode if it's currently enabled. | 252 // Turns off background mode if it's currently enabled. |
| 253 void DisableBackgroundMode(); | 253 void DisableBackgroundMode(); |
| 254 | 254 |
| 255 // Turns on background mode if it's currently disabled. | 255 // Turns on background mode if it's currently disabled. |
| 256 void EnableBackgroundMode(); | 256 void EnableBackgroundMode(); |
| 257 | 257 |
| 258 // Returns the number of background apps in the system (virtual to allow | 258 // Returns the number of background apps in the system (virtual to allow |
| 259 // overriding in unit tests). | 259 // overriding in unit tests). |
| 260 virtual int GetBackgroundAppCount() const; | 260 virtual int GetBackgroundAppCount() const; |
| 261 | 261 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 // app). | 302 // app). |
| 303 bool keep_alive_for_test_; | 303 bool keep_alive_for_test_; |
| 304 | 304 |
| 305 // Provides a command id for each profile as they are created. | 305 // Provides a command id for each profile as they are created. |
| 306 int current_command_id_; | 306 int current_command_id_; |
| 307 | 307 |
| 308 DISALLOW_COPY_AND_ASSIGN(BackgroundModeManager); | 308 DISALLOW_COPY_AND_ASSIGN(BackgroundModeManager); |
| 309 }; | 309 }; |
| 310 | 310 |
| 311 #endif // CHROME_BROWSER_BACKGROUND_BACKGROUND_MODE_MANAGER_H_ | 311 #endif // CHROME_BROWSER_BACKGROUND_BACKGROUND_MODE_MANAGER_H_ |
| OLD | NEW |