blob: 282b389273d0dfe961085c7af8ea43f1adbb2747 [file] [log] [blame]
kmarshall24b29b22015-04-29 01:41:471// 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 EXTENSIONS_BROWSER_EVENT_PAGE_TRACKER_H_
6#define EXTENSIONS_BROWSER_EVENT_PAGE_TRACKER_H_
7
8#include <string>
9
10#include "base/callback.h"
11
12namespace extensions {
13
kmarshall24b29b22015-04-29 01:41:4714// Tracks an extension's event page suspend state.
15class EventPageTracker {
16 public:
17 // Returns true if an extension's event page is active,
18 // or false if it is suspended.
19 virtual bool IsEventPageSuspended(const std::string& extension_id) = 0;
20
21 // Wakes an extension's event page from a suspended state and calls
22 // |callback| after it is reactivated.
23 //
24 // |callback| will be passed true if the extension was reactivated
25 // successfully, or false if an error occurred.
26 //
27 // Returns true if a wake operation was scheduled successfully,
28 // or false if the event page was already awake.
29 // Callback will be run asynchronously if true, and never run if false.
30 virtual bool WakeEventPage(const std::string& extension_id,
31 const base::Callback<void(bool)>& callback) = 0;
32};
33
34} // namespace extensions
35
36#endif // EXTENSIONS_BROWSER_EVENT_PAGE_TRACKER_H_