| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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_view_core_impl.h" | 5 #include "content/browser/android/content_view_core_impl.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
| 9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
| 10 #include "base/android/scoped_java_ref.h" | 10 #include "base/android/scoped_java_ref.h" |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 void ContentViewCoreImpl::OnHide(JNIEnv* env, jobject obj) { | 323 void ContentViewCoreImpl::OnHide(JNIEnv* env, jobject obj) { |
| 324 Hide(); | 324 Hide(); |
| 325 } | 325 } |
| 326 | 326 |
| 327 void ContentViewCoreImpl::OnShow(JNIEnv* env, jobject obj) { | 327 void ContentViewCoreImpl::OnShow(JNIEnv* env, jobject obj) { |
| 328 Show(); | 328 Show(); |
| 329 } | 329 } |
| 330 | 330 |
| 331 void ContentViewCoreImpl::Show() { | 331 void ContentViewCoreImpl::Show() { |
| 332 GetWebContents()->WasShown(); | 332 GetWebContents()->WasShown(); |
| 333 ResumeVideo(); |
| 333 } | 334 } |
| 334 | 335 |
| 335 void ContentViewCoreImpl::Hide() { | 336 void ContentViewCoreImpl::Hide() { |
| 336 GetWebContents()->WasHidden(); | 337 GetWebContents()->WasHidden(); |
| 337 PauseVideo(); | 338 PauseVideo(); |
| 338 } | 339 } |
| 339 | 340 |
| 340 void ContentViewCoreImpl::PauseVideo() { | 341 void ContentViewCoreImpl::PauseVideo() { |
| 341 RenderViewHost* host = web_contents_->GetRenderViewHost(); | 342 RenderViewHost* host = web_contents_->GetRenderViewHost(); |
| 342 if (host) | 343 if (host) |
| 343 host->Send(new ViewMsg_PauseVideo(host->GetRoutingID())); | 344 host->Send(new ViewMsg_PauseVideo(host->GetRoutingID())); |
| 344 } | 345 } |
| 345 | 346 |
| 347 void ContentViewCoreImpl::ResumeVideo() { |
| 348 RenderViewHost* host = web_contents_->GetRenderViewHost(); |
| 349 if (host) |
| 350 host->Send(new ViewMsg_ResumeVideo(host->GetRoutingID())); |
| 351 } |
| 352 |
| 346 void ContentViewCoreImpl::OnTabCrashed() { | 353 void ContentViewCoreImpl::OnTabCrashed() { |
| 347 JNIEnv* env = AttachCurrentThread(); | 354 JNIEnv* env = AttachCurrentThread(); |
| 348 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 355 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
| 349 if (obj.is_null()) | 356 if (obj.is_null()) |
| 350 return; | 357 return; |
| 351 Java_ContentViewCore_resetVSyncNotification(env, obj.obj()); | 358 Java_ContentViewCore_resetVSyncNotification(env, obj.obj()); |
| 352 } | 359 } |
| 353 | 360 |
| 354 // All positions and sizes are in CSS pixels. | 361 // All positions and sizes are in CSS pixels. |
| 355 // Note that viewport_width/height is a best effort based. | 362 // Note that viewport_width/height is a best effort based. |
| (...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1639 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1646 reinterpret_cast<ui::ViewAndroid*>(view_android), |
| 1640 reinterpret_cast<ui::WindowAndroid*>(window_android)); | 1647 reinterpret_cast<ui::WindowAndroid*>(window_android)); |
| 1641 return reinterpret_cast<intptr_t>(view); | 1648 return reinterpret_cast<intptr_t>(view); |
| 1642 } | 1649 } |
| 1643 | 1650 |
| 1644 bool RegisterContentViewCore(JNIEnv* env) { | 1651 bool RegisterContentViewCore(JNIEnv* env) { |
| 1645 return RegisterNativesImpl(env); | 1652 return RegisterNativesImpl(env); |
| 1646 } | 1653 } |
| 1647 | 1654 |
| 1648 } // namespace content | 1655 } // namespace content |
| OLD | NEW |