OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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_LIFETIME_BROWSER_KEEP_ALIVE_H_ |
| 6 #define CHROME_BROWSER_LIFETIME_BROWSER_KEEP_ALIVE_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 |
| 10 namespace browser_lifetime { |
| 11 |
| 12 // A class that can be put in a scoped_ptr to represent a "keep alive" resource. |
| 13 // Prefer this over IncrementKeepAliveCount() / DecrementKeepAliveCount() |
| 14 // whenever possible. |
| 15 class ScopedKeepAlive { |
| 16 public: |
| 17 ScopedKeepAlive(); |
| 18 ~ScopedKeepAlive(); |
| 19 |
| 20 private: |
| 21 DISALLOW_COPY_AND_ASSIGN(ScopedKeepAlive); |
| 22 }; |
| 23 |
| 24 // Tells the BrowserList to keep the application alive after the last Browser |
| 25 // closes. This is implemented as a count, so callers should pair their calls |
| 26 // to IncrementKeepAliveCount() with matching calls to DecrementKeepAliveCount() |
| 27 // when they no |
| 28 // longer need to keep the application running. |
| 29 void IncrementKeepAliveCount(); |
| 30 |
| 31 // Stops keeping the application alive after the last Browser is closed. |
| 32 // Should match a previous call to IncrementKeepAliveCount(). |
| 33 void DecrementKeepAliveCount(); |
| 34 |
| 35 // Returns true if application will continue running after the last Browser |
| 36 // closes. |
| 37 bool WillKeepAlive(); |
| 38 |
| 39 // Disable browser shutdown for unit tests. |
| 40 void DisableShutdownForTesting(bool disable_shutdown_for_testing); |
| 41 |
| 42 } // namespace browser_lifetime |
| 43 |
| 44 #endif // CHROME_BROWSER_LIFETIME_BROWSER_KEEP_ALIVE_H_ |
| 45 |
OLD | NEW |