OLD | NEW |
---|---|
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 "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "content/public/browser/power_save_blocker.h" | 9 #include "content/public/browser/power_save_blocker.h" |
10 #include "ui/gfx/native_widget_types.h" | 10 #include "ui/gfx/native_widget_types.h" |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 | 13 |
14 class WebContents; | |
joth
2013/08/08 21:48:57
not needed now
michaelbai
2013/08/09 17:46:51
Done.
| |
15 | |
14 class PowerSaveBlockerImpl : public PowerSaveBlocker { | 16 class PowerSaveBlockerImpl : public PowerSaveBlocker { |
15 public: | 17 public: |
16 PowerSaveBlockerImpl(PowerSaveBlockerType type, const std::string& reason); | 18 PowerSaveBlockerImpl(PowerSaveBlockerType type, const std::string& reason); |
17 virtual ~PowerSaveBlockerImpl(); | 19 virtual ~PowerSaveBlockerImpl(); |
18 | 20 |
19 #if defined(OS_ANDROID) | 21 #if defined(OS_ANDROID) |
20 // In Android platform, the |native_window| is needed to create the | 22 // In Android platform, the kPowerSaveBlockPreventDisplaySleep type of |
21 // kPowerSaveBlockPreventDisplaySleep type of PowerSaveBlocker | 23 // PowerSaveBlocker should associated with the ViewAndroid, |
22 // so the blocker could be removed by platform if the window isn't in the | 24 // so the blocker could be removed by platform if the view isn't visble |
23 // foreground. | 25 void InitDisplaySleepBlocker(gfx::NativeView view_android); |
24 void InitDisplaySleepBlocker(gfx::NativeWindow native_window); | |
25 #endif | 26 #endif |
26 | 27 |
27 private: | 28 private: |
28 class Delegate; | 29 class Delegate; |
29 | 30 |
30 // Implementations of this class may need a second object with different | 31 // Implementations of this class may need a second object with different |
31 // lifetime than the RAII container, or additional storage. This member is | 32 // lifetime than the RAII container, or additional storage. This member is |
32 // here for that purpose. If not used, just define the class as an empty | 33 // here for that purpose. If not used, just define the class as an empty |
33 // RefCounted (or RefCountedThreadSafe) like so to make it compile: | 34 // RefCounted (or RefCountedThreadSafe) like so to make it compile: |
34 // class PowerSaveBlocker::Delegate | 35 // class PowerSaveBlocker::Delegate |
35 // : public base::RefCounted<PowerSaveBlocker::Delegate> { | 36 // : public base::RefCounted<PowerSaveBlocker::Delegate> { |
36 // private: | 37 // private: |
37 // friend class base::RefCounted<Delegate>; | 38 // friend class base::RefCounted<Delegate>; |
38 // ~Delegate() {} | 39 // ~Delegate() {} |
39 // }; | 40 // }; |
40 scoped_refptr<Delegate> delegate_; | 41 scoped_refptr<Delegate> delegate_; |
41 | 42 |
42 DISALLOW_COPY_AND_ASSIGN(PowerSaveBlockerImpl); | 43 DISALLOW_COPY_AND_ASSIGN(PowerSaveBlockerImpl); |
43 }; | 44 }; |
44 | 45 |
45 } // namespace content | 46 } // namespace content |
46 | 47 |
47 #endif // CONTENT_BROWSER_POWER_SAVE_BLOCKER_IMPL_H_ | 48 #endif // CONTENT_BROWSER_POWER_SAVE_BLOCKER_IMPL_H_ |
OLD | NEW |