Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(692)

Side by Side Diff: content/browser/power_save_blocker_impl.h

Issue 2075153002: Reland of 'Move content/browser/power_save_blocker to //device/power_save_blocker' (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: missing libs for component mac Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2013 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 CONTENT_BROWSER_POWER_SAVE_BLOCKER_IMPL_H_
6 #define CONTENT_BROWSER_POWER_SAVE_BLOCKER_IMPL_H_
7
8 #include <string>
9
10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/memory/weak_ptr.h"
13 #include "base/sequenced_task_runner.h"
14 #include "base/single_thread_task_runner.h"
15 #include "build/build_config.h"
16 #include "content/public/browser/power_save_blocker.h"
17
18 #if defined(OS_ANDROID)
19 #include "ui/android/view_android.h"
20 #endif // OS_ANDROID
21
22 namespace content {
23
24 class WebContents;
25
26 class PowerSaveBlockerImpl : public PowerSaveBlocker {
27 public:
28 PowerSaveBlockerImpl(
29 PowerSaveBlockerType type,
30 Reason reason,
31 const std::string& description,
32 scoped_refptr<base::SequencedTaskRunner> ui_task_runner,
33 scoped_refptr<base::SingleThreadTaskRunner> blocking_task_runner);
34 ~PowerSaveBlockerImpl() override;
35
36 #if defined(OS_ANDROID)
37 // On Android, the kPowerSaveBlockPreventDisplaySleep type of
38 // PowerSaveBlocker should associated with a View, so the blocker can be
39 // removed by the platform.
40 void InitDisplaySleepBlocker(
41 const base::WeakPtr<ui::ViewAndroid>& view_android);
42 #endif
43
44 private:
45 class Delegate;
46
47 // Implementations of this class may need a second object with different
48 // lifetime than the RAII container, or additional storage. This member is
49 // here for that purpose. If not used, just define the class as an empty
50 // RefCounted (or RefCountedThreadSafe) like so to make it compile:
51 // class PowerSaveBlocker::Delegate
52 // : public base::RefCounted<PowerSaveBlocker::Delegate> {
53 // private:
54 // friend class base::RefCounted<Delegate>;
55 // ~Delegate() {}
56 // };
57 scoped_refptr<Delegate> delegate_;
58
59 #if defined(USE_X11)
60 // Since display sleep prevention also implies system suspend prevention, for
61 // the Linux FreeDesktop API case, there needs to be a second delegate to
62 // block system suspend when screen saver / display sleep is blocked.
63 scoped_refptr<Delegate> freedesktop_suspend_delegate_;
64 #endif
65
66 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_;
67 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
68
69 DISALLOW_COPY_AND_ASSIGN(PowerSaveBlockerImpl);
70 };
71
72 } // namespace content
73
74 #endif // CONTENT_BROWSER_POWER_SAVE_BLOCKER_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/power_save_blocker_factory.cc ('k') | content/browser/power_save_blocker_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698