Chromium Code Reviews| Index: content/browser/wake_lock/wake_lock_service_context.cc |
| diff --git a/content/browser/wake_lock/wake_lock_service_context.cc b/content/browser/wake_lock/wake_lock_service_context.cc |
| index 7a706e8582da83c58305cda7e8ceb5517e97495a..3ebf18ac35b301da01f1f380a48fad744b2e0690 100644 |
| --- a/content/browser/wake_lock/wake_lock_service_context.cc |
| +++ b/content/browser/wake_lock/wake_lock_service_context.cc |
| @@ -13,6 +13,7 @@ |
| #include "content/public/browser/power_save_blocker_factory.h" |
| #include "content/public/browser/render_frame_host.h" |
| #include "content/public/browser/render_process_host.h" |
| +#include "content/public/browser/web_contents.h" |
| #include "content/public/common/service_registry.h" |
| namespace content { |
| @@ -36,6 +37,15 @@ void WakeLockServiceContext::RenderFrameDeleted( |
| render_frame_host->GetRoutingID()); |
| } |
| +void WakeLockServiceContext::WebContentsDestroyed() { |
| +#if defined(OS_ANDROID) |
| + if (wake_lock_) { |
| + static_cast<PowerSaveBlockerImpl*>(wake_lock_.get()) |
| + ->ClearViewForSleepBlocker(); |
|
ncarter (slow)
2016/06/01 22:01:11
Now that there are 2 downcasts, consider making wa
ncarter (slow)
2016/06/01 22:02:57
Or don't -- downcasting while assigning a unique_p
|
| + } |
| +#endif |
| +} |
| + |
| void WakeLockServiceContext::RequestWakeLock(int render_process_id, |
| int render_frame_id) { |
| DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| @@ -70,7 +80,7 @@ void WakeLockServiceContext::CreateWakeLock() { |
| DCHECK(web_contents()); |
| static_cast<PowerSaveBlockerImpl*>(wake_lock_.get()) |
| - ->InitDisplaySleepBlocker(web_contents()); |
| + ->InitDisplaySleepBlocker(web_contents()->GetNativeView()); |
| #endif |
| } |