Roll src/third_party/WebKit 63beae6:7fa8deb (svn 201790:201791)
[chromium-blink-merge.git] / extensions / browser / event_page_tracker.h
blobfd5eb6b8e54f75ab30b7958423293fa0a904e07d
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.
5 #ifndef EXTENSIONS_BROWSER_EVENT_PAGE_TRACKER_H_
6 #define EXTENSIONS_BROWSER_EVENT_PAGE_TRACKER_H_
8 #include <string>
10 #include "base/callback.h"
12 namespace extensions {
14 class Extension;
15 class ExtensionHost;
17 // Tracks an extension's event page suspend state.
18 class EventPageTracker {
19 public:
20 // Returns true if an extension's event page is active,
21 // or false if it is suspended.
22 virtual bool IsEventPageSuspended(const std::string& extension_id) = 0;
24 // Wakes an extension's event page from a suspended state and calls
25 // |callback| after it is reactivated.
27 // |callback| will be passed true if the extension was reactivated
28 // successfully, or false if an error occurred.
30 // Returns true if a wake operation was scheduled successfully,
31 // or false if the event page was already awake.
32 // Callback will be run asynchronously if true, and never run if false.
33 virtual bool WakeEventPage(const std::string& extension_id,
34 const base::Callback<void(bool)>& callback) = 0;
37 } // namespace extensions
39 #endif // EXTENSIONS_BROWSER_EVENT_PAGE_TRACKER_H_