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( | 262 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
266 switches::kEnableContentVideoViewPowerSaveBlocker)) { | 263 switches::kEnableContentVideoViewPowerSaveBlocker)) { |
267 // In fullscreen Clank reuses the power save blocker attached to the | 264 // In fullscreen Clank reuses the power save blocker attached to the |
268 // container view that was created for embedded video. The WebView cannot | 265 // container view that was created for embedded video. The WebView cannot |
269 // reuse that so we create a new blocker instead. | 266 // reuse that so we create a new blocker instead. |
270 if (power_save_blocker_) return; | 267 if (power_save_blocker_) return; |
271 | |
272 power_save_blocker_ = PowerSaveBlocker::Create( | 268 power_save_blocker_ = PowerSaveBlocker::Create( |
273 PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, | 269 PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, |
274 "Playing video").Pass(); | 270 "Playing video").Pass(); |
275 static_cast<PowerSaveBlockerImpl*>(power_save_blocker_.get())-> | 271 static_cast<PowerSaveBlockerImpl*>(power_save_blocker_.get())-> |
276 InitDisplaySleepBlocker(GetNativeView()); | 272 InitDisplaySleepBlocker(GetNativeView()); |
277 } | 273 } |
278 } | 274 } |
279 | 275 |
280 } // namespace content | 276 } // namespace content |
OLD | NEW |