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

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

Issue 2003803002: Remove dependency of power_save_blocker_android on various content bits (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@power-save-task-runners
Patch Set: . 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
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 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 CONTENT_BROWSER_POWER_SAVE_BLOCKER_IMPL_H_ 5 #ifndef CONTENT_BROWSER_POWER_SAVE_BLOCKER_IMPL_H_
6 #define CONTENT_BROWSER_POWER_SAVE_BLOCKER_IMPL_H_ 6 #define CONTENT_BROWSER_POWER_SAVE_BLOCKER_IMPL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/sequenced_task_runner.h" 12 #include "base/sequenced_task_runner.h"
13 #include "base/single_thread_task_runner.h" 13 #include "base/single_thread_task_runner.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "content/public/browser/power_save_blocker.h" 15 #include "content/public/browser/power_save_blocker.h"
16 16
17 #if defined(OS_ANDROID)
18 #include "ui/android/view_android.h"
19 #endif // OS_ANDROID
20
17 namespace content { 21 namespace content {
18 22
19 class WebContents; 23 class WebContents;
20 24
21 class PowerSaveBlockerImpl : public PowerSaveBlocker { 25 class PowerSaveBlockerImpl : public PowerSaveBlocker {
22 public: 26 public:
23 PowerSaveBlockerImpl( 27 PowerSaveBlockerImpl(
24 PowerSaveBlockerType type, 28 PowerSaveBlockerType type,
25 Reason reason, 29 Reason reason,
26 const std::string& description, 30 const std::string& description,
27 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, 31 scoped_refptr<base::SequencedTaskRunner> ui_task_runner,
28 scoped_refptr<base::SingleThreadTaskRunner> blocking_task_runner); 32 scoped_refptr<base::SingleThreadTaskRunner> blocking_task_runner);
29 ~PowerSaveBlockerImpl() override; 33 ~PowerSaveBlockerImpl() override;
30 34
31 #if defined(OS_ANDROID) 35 #if defined(OS_ANDROID)
32 // In Android platform, the kPowerSaveBlockPreventDisplaySleep type of 36 // On Android, the kPowerSaveBlockPreventDisplaySleep type of
33 // PowerSaveBlocker should associated with a WebContents, so the blocker 37 // PowerSaveBlocker should associated with a View, so the blocker can be
34 // could be removed by platform if the WebContents is hidden. 38 // removed by the platform.
35 void InitDisplaySleepBlocker(WebContents* web_contents); 39 void InitDisplaySleepBlocker(ui::ViewAndroid* web_contents);
36 #endif 40 #endif
37 41
38 private: 42 private:
39 class Delegate; 43 class Delegate;
40 44
41 // Implementations of this class may need a second object with different 45 // Implementations of this class may need a second object with different
42 // lifetime than the RAII container, or additional storage. This member is 46 // lifetime than the RAII container, or additional storage. This member is
43 // here for that purpose. If not used, just define the class as an empty 47 // here for that purpose. If not used, just define the class as an empty
44 // RefCounted (or RefCountedThreadSafe) like so to make it compile: 48 // RefCounted (or RefCountedThreadSafe) like so to make it compile:
45 // class PowerSaveBlocker::Delegate 49 // class PowerSaveBlocker::Delegate
(...skipping 13 matching lines...) Expand all
59 63
60 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; 64 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_;
61 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; 65 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
62 66
63 DISALLOW_COPY_AND_ASSIGN(PowerSaveBlockerImpl); 67 DISALLOW_COPY_AND_ASSIGN(PowerSaveBlockerImpl);
64 }; 68 };
65 69
66 } // namespace content 70 } // namespace content
67 71
68 #endif // CONTENT_BROWSER_POWER_SAVE_BLOCKER_IMPL_H_ 72 #endif // CONTENT_BROWSER_POWER_SAVE_BLOCKER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698