OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 #include "content/browser/wake_lock/wake_lock_service_context.h" | 5 #include "content/browser/wake_lock/wake_lock_service_context.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
11 #include "content/public/browser/browser_thread.h" | 11 #include "content/public/browser/browser_thread.h" |
12 #include "content/public/browser/render_frame_host.h" | 12 #include "content/public/browser/render_frame_host.h" |
13 #include "content/public/browser/render_process_host.h" | 13 #include "content/public/browser/render_process_host.h" |
14 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
15 #include "content/public/common/service_registry.h" | |
16 #include "device/power_save_blocker/power_save_blocker.h" | 15 #include "device/power_save_blocker/power_save_blocker.h" |
17 | 16 |
18 namespace content { | 17 namespace content { |
19 | 18 |
20 WakeLockServiceContext::WakeLockServiceContext(WebContents* web_contents) | 19 WakeLockServiceContext::WakeLockServiceContext(WebContents* web_contents) |
21 : WebContentsObserver(web_contents), weak_factory_(this) {} | 20 : WebContentsObserver(web_contents), weak_factory_(this) {} |
22 | 21 |
23 WakeLockServiceContext::~WakeLockServiceContext() {} | 22 WakeLockServiceContext::~WakeLockServiceContext() {} |
24 | 23 |
25 void WakeLockServiceContext::CreateService( | 24 void WakeLockServiceContext::CreateService( |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 if (!frames_requesting_lock_.empty()) { | 93 if (!frames_requesting_lock_.empty()) { |
95 if (!wake_lock_) | 94 if (!wake_lock_) |
96 CreateWakeLock(); | 95 CreateWakeLock(); |
97 } else { | 96 } else { |
98 if (wake_lock_) | 97 if (wake_lock_) |
99 RemoveWakeLock(); | 98 RemoveWakeLock(); |
100 } | 99 } |
101 } | 100 } |
102 | 101 |
103 } // namespace content | 102 } // namespace content |
OLD | NEW |