OLD | NEW |
---|---|
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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
242 | 242 |
243 return reinterpret_cast<gfx::NativeView>( | 243 return reinterpret_cast<gfx::NativeView>( |
244 Java_ContentVideoView_getNativeViewAndroid(env, | 244 Java_ContentVideoView_getNativeViewAndroid(env, |
245 content_video_view.obj())); | 245 content_video_view.obj())); |
246 | 246 |
247 } | 247 } |
248 | 248 |
249 JavaObjectWeakGlobalRef ContentVideoView::CreateJavaObject() { | 249 JavaObjectWeakGlobalRef ContentVideoView::CreateJavaObject() { |
250 ContentViewCoreImpl* content_view_core = manager_->GetContentViewCore(); | 250 ContentViewCoreImpl* content_view_core = manager_->GetContentViewCore(); |
251 JNIEnv* env = AttachCurrentThread(); | 251 JNIEnv* env = AttachCurrentThread(); |
252 bool legacyMode = base::CommandLine::ForCurrentProcess()->HasSwitch( | |
253 switches::kDisableOverlayFullscreenVideoSubtitle); | |
254 return JavaObjectWeakGlobalRef( | 252 return JavaObjectWeakGlobalRef( |
255 env, | 253 env, |
256 Java_ContentVideoView_createContentVideoView( | 254 Java_ContentVideoView_createContentVideoView( |
257 env, | 255 env, |
258 content_view_core->GetContext().obj(), | 256 content_view_core->GetContext().obj(), |
259 reinterpret_cast<intptr_t>(this), | 257 reinterpret_cast<intptr_t>(this), |
260 content_view_core->GetContentVideoViewClient().obj(), | 258 content_view_core->GetContentVideoViewClient().obj()).obj()); |
261 legacyMode).obj()); | |
262 } | 259 } |
263 | 260 |
264 void ContentVideoView::CreatePowerSaveBlocker() { | 261 void ContentVideoView::CreatePowerSaveBlocker() { |
265 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | |
266 switches::kDisableOverlayFullscreenVideoSubtitle)) { | |
267 return; | |
268 } | |
269 | |
270 if (power_save_blocker_) return; | |
271 | |
272 power_save_blocker_ = PowerSaveBlocker::Create( | |
273 PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, | |
274 "Playing video").Pass(); | |
mkosiba (inactive)
2014/09/24 15:38:30
intentional? how does the fullscreen html5 video v
Ignacio Solla
2014/09/25 09:36:16
Good catch, there is a bug that we didn't notice,
| |
275 static_cast<PowerSaveBlockerImpl*>(power_save_blocker_.get())-> | |
276 InitDisplaySleepBlocker(GetNativeView()); | |
277 } | 262 } |
278 | 263 |
279 } // namespace content | 264 } // namespace content |
OLD | NEW |