Index: chrome/browser/lifetime/scoped_keep_alive.h |
diff --git a/chrome/browser/lifetime/scoped_keep_alive.h b/chrome/browser/lifetime/scoped_keep_alive.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a6aac206252b0683dbae2196a38a72758c5c21f9 |
--- /dev/null |
+++ b/chrome/browser/lifetime/scoped_keep_alive.h |
@@ -0,0 +1,28 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_LIFETIME_SCOPED_KEEP_ALIVE_H_ |
+#define CHROME_BROWSER_LIFETIME_SCOPED_KEEP_ALIVE_H_ |
+ |
+#include <string> |
+ |
+#include "base/macros.h" |
+#include "chrome/browser/lifetime/keep_alive_registry.h" |
+ |
+struct KeepAliveOptions; |
+ |
+// Registers with KeepAliveRegistry on creation and unregisters them |
+// on destruction. Use these objects with a scoped_ptr for easy management. |
+class ScopedKeepAlive { |
+ public: |
+ explicit ScopedKeepAlive(const KeepAliveOptions* options); |
+ ~ScopedKeepAlive(); |
+ |
+ private: |
+ const KeepAliveOptions* options_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ScopedKeepAlive); |
+}; |
+ |
+#endif // CHROME_BROWSER_LIFETIME_SCOPED_KEEP_ALIVE_H_ |