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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 return JavaObjectWeakGlobalRef( | 252 return JavaObjectWeakGlobalRef( |
253 env, | 253 env, |
254 Java_ContentVideoView_createContentVideoView( | 254 Java_ContentVideoView_createContentVideoView( |
255 env, | 255 env, |
256 content_view_core->GetContext().obj(), | 256 content_view_core->GetJavaObject().obj(), |
257 reinterpret_cast<intptr_t>(this), | 257 reinterpret_cast<intptr_t>(this)).obj()); |
258 content_view_core->GetContentVideoViewClient().obj()).obj()); | |
259 } | 258 } |
260 | 259 |
261 void ContentVideoView::CreatePowerSaveBlocker() { | 260 void ContentVideoView::CreatePowerSaveBlocker() { |
262 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 261 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
263 switches::kEnableContentVideoViewPowerSaveBlocker)) { | 262 switches::kEnableContentVideoViewPowerSaveBlocker)) { |
264 // In fullscreen Clank reuses the power save blocker attached to the | 263 // In fullscreen Clank reuses the power save blocker attached to the |
265 // container view that was created for embedded video. The WebView cannot | 264 // container view that was created for embedded video. The WebView cannot |
266 // reuse that so we create a new blocker instead. | 265 // reuse that so we create a new blocker instead. |
267 if (power_save_blocker_) return; | 266 if (power_save_blocker_) return; |
268 power_save_blocker_ = PowerSaveBlocker::Create( | 267 power_save_blocker_ = PowerSaveBlocker::Create( |
269 PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, | 268 PowerSaveBlocker::kPowerSaveBlockPreventDisplaySleep, |
270 "Playing video").Pass(); | 269 "Playing video").Pass(); |
271 static_cast<PowerSaveBlockerImpl*>(power_save_blocker_.get())-> | 270 static_cast<PowerSaveBlockerImpl*>(power_save_blocker_.get())-> |
272 InitDisplaySleepBlocker(GetNativeView()); | 271 InitDisplaySleepBlocker(GetNativeView()); |
273 } | 272 } |
274 } | 273 } |
275 | 274 |
276 } // namespace content | 275 } // namespace content |
OLD | NEW |