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

Side by Side Diff: content/browser/android/content_video_view.cc

Issue 606633002: [WebView] Create PowerSaveBlocker for fullscreen video. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/android/content_video_view.h" 5 #include "content/browser/android/content_video_view.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 env, 255 env,
256 Java_ContentVideoView_createContentVideoView( 256 Java_ContentVideoView_createContentVideoView(
257 env, 257 env,
258 content_view_core->GetContext().obj(), 258 content_view_core->GetContext().obj(),
259 reinterpret_cast<intptr_t>(this), 259 reinterpret_cast<intptr_t>(this),
260 content_view_core->GetContentVideoViewClient().obj(), 260 content_view_core->GetContentVideoViewClient().obj(),
261 legacyMode).obj()); 261 legacyMode).obj());
262 } 262 }
263 263
264 void ContentVideoView::CreatePowerSaveBlocker() { 264 void ContentVideoView::CreatePowerSaveBlocker() {
265 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( 265 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
Ignacio Solla 2014/09/25 10:36:02 Some context: kDisableOverlayFullscreenVideoSubtit
266 switches::kDisableOverlayFullscreenVideoSubtitle)) { 266 switches::kEnableContentVideoViewPowerSaveBlocker)) {
267 return; 267 // In fullscreen Clank reuses the power save blocker attached to the
268 // container view that was created for embedded video. The WebView cannot
269 // reuse that so we create a new blocker instead.
270 if (power_save_blocker_) return;
271
272 power_save_blocker_ = PowerSaveBlocker::Create(
273 PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep,
274 "Playing video").Pass();
275 static_cast<PowerSaveBlockerImpl*>(power_save_blocker_.get())->
276 InitDisplaySleepBlocker(GetNativeView());
268 } 277 }
269
270 if (power_save_blocker_) return;
271
272 power_save_blocker_ = PowerSaveBlocker::Create(
273 PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep,
274 "Playing video").Pass();
275 static_cast<PowerSaveBlockerImpl*>(power_save_blocker_.get())->
276 InitDisplaySleepBlocker(GetNativeView());
277 } 278 }
278 279
279 } // namespace content 280 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698