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

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: only .reset() 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/memory/weak_ptr.h"
12 #include "base/sequenced_task_runner.h" 13 #include "base/sequenced_task_runner.h"
13 #include "base/single_thread_task_runner.h" 14 #include "base/single_thread_task_runner.h"
14 #include "build/build_config.h" 15 #include "build/build_config.h"
15 #include "content/public/browser/power_save_blocker.h" 16 #include "content/public/browser/power_save_blocker.h"
16 17
18 #if defined(OS_ANDROID)
19 #include "ui/android/view_android.h"
20 #endif // OS_ANDROID
21
17 namespace content { 22 namespace content {
18 23
19 class WebContents; 24 class WebContents;
20 25
21 class PowerSaveBlockerImpl : public PowerSaveBlocker { 26 class PowerSaveBlockerImpl : public PowerSaveBlocker {
22 public: 27 public:
23 PowerSaveBlockerImpl( 28 PowerSaveBlockerImpl(
24 PowerSaveBlockerType type, 29 PowerSaveBlockerType type,
25 Reason reason, 30 Reason reason,
26 const std::string& description, 31 const std::string& description,
27 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, 32 scoped_refptr<base::SequencedTaskRunner> ui_task_runner,
28 scoped_refptr<base::SingleThreadTaskRunner> blocking_task_runner); 33 scoped_refptr<base::SingleThreadTaskRunner> blocking_task_runner);
29 ~PowerSaveBlockerImpl() override; 34 ~PowerSaveBlockerImpl() override;
30 35
31 #if defined(OS_ANDROID) 36 #if defined(OS_ANDROID)
32 // In Android platform, the kPowerSaveBlockPreventDisplaySleep type of 37 // On Android, the kPowerSaveBlockPreventDisplaySleep type of
33 // PowerSaveBlocker should associated with a WebContents, so the blocker 38 // PowerSaveBlocker should associated with a View, so the blocker can be
34 // could be removed by platform if the WebContents is hidden. 39 // removed by the platform.
35 void InitDisplaySleepBlocker(WebContents* web_contents); 40 void InitDisplaySleepBlocker(
41 const base::WeakPtr<ui::ViewAndroid>& view_android);
36 #endif 42 #endif
37 43
38 private: 44 private:
39 class Delegate; 45 class Delegate;
40 46
41 // Implementations of this class may need a second object with different 47 // Implementations of this class may need a second object with different
42 // lifetime than the RAII container, or additional storage. This member is 48 // 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 49 // here for that purpose. If not used, just define the class as an empty
44 // RefCounted (or RefCountedThreadSafe) like so to make it compile: 50 // RefCounted (or RefCountedThreadSafe) like so to make it compile:
45 // class PowerSaveBlocker::Delegate 51 // class PowerSaveBlocker::Delegate
(...skipping 13 matching lines...) Expand all
59 65
60 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; 66 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_;
61 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; 67 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
62 68
63 DISALLOW_COPY_AND_ASSIGN(PowerSaveBlockerImpl); 69 DISALLOW_COPY_AND_ASSIGN(PowerSaveBlockerImpl);
64 }; 70 };
65 71
66 } // namespace content 72 } // namespace content
67 73
68 #endif // CONTENT_BROWSER_POWER_SAVE_BLOCKER_IMPL_H_ 74 #endif // CONTENT_BROWSER_POWER_SAVE_BLOCKER_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/power_save_blocker_android.cc ('k') | content/browser/wake_lock/wake_lock_service_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698