OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 EXTENSIONS_BROWSER_EVENT_PAGE_TRACKER_H_ | 5 #ifndef EXTENSIONS_BROWSER_EVENT_PAGE_TRACKER_H_ |
6 #define EXTENSIONS_BROWSER_EVENT_PAGE_TRACKER_H_ | 6 #define EXTENSIONS_BROWSER_EVENT_PAGE_TRACKER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 | 11 |
12 namespace extensions { | 12 namespace extensions { |
13 | 13 |
14 class Extension; | |
15 class ExtensionHost; | |
16 | |
17 // Tracks an extension's event page suspend state. | 14 // Tracks an extension's event page suspend state. |
18 class EventPageTracker { | 15 class EventPageTracker { |
19 public: | 16 public: |
20 // Returns true if an extension's event page is active, | 17 // Returns true if an extension's event page is active, |
21 // or false if it is suspended. | 18 // or false if it is suspended. |
22 virtual bool IsEventPageSuspended(const std::string& extension_id) = 0; | 19 virtual bool IsEventPageSuspended(const std::string& extension_id) = 0; |
23 | 20 |
24 // Wakes an extension's event page from a suspended state and calls | 21 // Wakes an extension's event page from a suspended state and calls |
25 // |callback| after it is reactivated. | 22 // |callback| after it is reactivated. |
26 // | 23 // |
27 // |callback| will be passed true if the extension was reactivated | 24 // |callback| will be passed true if the extension was reactivated |
28 // successfully, or false if an error occurred. | 25 // successfully, or false if an error occurred. |
29 // | 26 // |
30 // Returns true if a wake operation was scheduled successfully, | 27 // Returns true if a wake operation was scheduled successfully, |
31 // or false if the event page was already awake. | 28 // or false if the event page was already awake. |
32 // Callback will be run asynchronously if true, and never run if false. | 29 // Callback will be run asynchronously if true, and never run if false. |
33 virtual bool WakeEventPage(const std::string& extension_id, | 30 virtual bool WakeEventPage(const std::string& extension_id, |
34 const base::Callback<void(bool)>& callback) = 0; | 31 const base::Callback<void(bool)>& callback) = 0; |
35 }; | 32 }; |
36 | 33 |
37 } // namespace extensions | 34 } // namespace extensions |
38 | 35 |
39 #endif // EXTENSIONS_BROWSER_EVENT_PAGE_TRACKER_H_ | 36 #endif // EXTENSIONS_BROWSER_EVENT_PAGE_TRACKER_H_ |
OLD | NEW |