| 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 "content/browser/android/content_view_core_impl.h" | 10 #include "content/browser/android/content_view_core_impl.h" |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 204 |
| 205 return reinterpret_cast<gfx::NativeView>( | 205 return reinterpret_cast<gfx::NativeView>( |
| 206 Java_ContentVideoView_getNativeViewAndroid(env, | 206 Java_ContentVideoView_getNativeViewAndroid(env, |
| 207 content_video_view.obj())); | 207 content_video_view.obj())); |
| 208 | 208 |
| 209 } | 209 } |
| 210 | 210 |
| 211 JavaObjectWeakGlobalRef ContentVideoView::CreateJavaObject() { | 211 JavaObjectWeakGlobalRef ContentVideoView::CreateJavaObject() { |
| 212 ContentViewCoreImpl* content_view_core = manager_->GetContentViewCore(); | 212 ContentViewCoreImpl* content_view_core = manager_->GetContentViewCore(); |
| 213 JNIEnv* env = AttachCurrentThread(); | 213 JNIEnv* env = AttachCurrentThread(); |
| 214 bool legacyMode = CommandLine::ForCurrentProcess()->HasSwitch( | 214 bool legacyMode = base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 215 switches::kDisableOverlayFullscreenVideoSubtitle); | 215 switches::kDisableOverlayFullscreenVideoSubtitle); |
| 216 return JavaObjectWeakGlobalRef( | 216 return JavaObjectWeakGlobalRef( |
| 217 env, | 217 env, |
| 218 Java_ContentVideoView_createContentVideoView( | 218 Java_ContentVideoView_createContentVideoView( |
| 219 env, | 219 env, |
| 220 content_view_core->GetContext().obj(), | 220 content_view_core->GetContext().obj(), |
| 221 reinterpret_cast<intptr_t>(this), | 221 reinterpret_cast<intptr_t>(this), |
| 222 content_view_core->GetContentVideoViewClient().obj(), | 222 content_view_core->GetContentVideoViewClient().obj(), |
| 223 legacyMode).obj()); | 223 legacyMode).obj()); |
| 224 } | 224 } |
| 225 | 225 |
| 226 void ContentVideoView::CreatePowerSaveBlocker() { | 226 void ContentVideoView::CreatePowerSaveBlocker() { |
| 227 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 227 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 228 switches::kDisableOverlayFullscreenVideoSubtitle)) { | 228 switches::kDisableOverlayFullscreenVideoSubtitle)) { |
| 229 return; | 229 return; |
| 230 } | 230 } |
| 231 | 231 |
| 232 if (power_save_blocker_) return; | 232 if (power_save_blocker_) return; |
| 233 | 233 |
| 234 power_save_blocker_ = PowerSaveBlocker::Create( | 234 power_save_blocker_ = PowerSaveBlocker::Create( |
| 235 PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, | 235 PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, |
| 236 "Playing video").Pass(); | 236 "Playing video").Pass(); |
| 237 static_cast<PowerSaveBlockerImpl*>(power_save_blocker_.get())-> | 237 static_cast<PowerSaveBlockerImpl*>(power_save_blocker_.get())-> |
| 238 InitDisplaySleepBlocker(GetNativeView()); | 238 InitDisplaySleepBlocker(GetNativeView()); |
| 239 } | 239 } |
| 240 } // namespace content | 240 } // namespace content |
| OLD | NEW |