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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 | 335 |
336 void ContentViewCoreImpl::Show() { | 336 void ContentViewCoreImpl::Show() { |
337 GetWebContents()->WasShown(); | 337 GetWebContents()->WasShown(); |
338 // Displaying WebContents may trigger a lazy reload, spawning a new renderer | 338 // Displaying WebContents may trigger a lazy reload, spawning a new renderer |
339 // for the tab. | 339 // for the tab. |
340 UpdateTabCrashedFlag(); | 340 UpdateTabCrashedFlag(); |
341 } | 341 } |
342 | 342 |
343 void ContentViewCoreImpl::Hide() { | 343 void ContentViewCoreImpl::Hide() { |
344 GetWebContents()->WasHidden(); | 344 GetWebContents()->WasHidden(); |
| 345 PauseVideo(); |
| 346 } |
| 347 |
| 348 void ContentViewCoreImpl::PauseVideo() { |
| 349 RenderViewHost* host = web_contents_->GetRenderViewHost(); |
| 350 if (host) |
| 351 host->Send(new ViewMsg_PauseVideo(host->GetRoutingID())); |
345 } | 352 } |
346 | 353 |
347 void ContentViewCoreImpl::OnTabCrashed() { | 354 void ContentViewCoreImpl::OnTabCrashed() { |
348 JNIEnv* env = AttachCurrentThread(); | 355 JNIEnv* env = AttachCurrentThread(); |
349 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); | 356 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
350 if (obj.is_null()) | 357 if (obj.is_null()) |
351 return; | 358 return; |
352 Java_ContentViewCore_resetVSyncNotification(env, obj.obj()); | 359 Java_ContentViewCore_resetVSyncNotification(env, obj.obj()); |
353 | 360 |
354 // If |tab_crashed_| is already true, just return. e.g. if two tabs share the | 361 // If |tab_crashed_| is already true, just return. e.g. if two tabs share the |
(...skipping 1247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1602 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1609 reinterpret_cast<ui::ViewAndroid*>(view_android), |
1603 reinterpret_cast<ui::WindowAndroid*>(window_android)); | 1610 reinterpret_cast<ui::WindowAndroid*>(window_android)); |
1604 return reinterpret_cast<jint>(view); | 1611 return reinterpret_cast<jint>(view); |
1605 } | 1612 } |
1606 | 1613 |
1607 bool RegisterContentViewCore(JNIEnv* env) { | 1614 bool RegisterContentViewCore(JNIEnv* env) { |
1608 return RegisterNativesImpl(env); | 1615 return RegisterNativesImpl(env); |
1609 } | 1616 } |
1610 | 1617 |
1611 } // namespace content | 1618 } // namespace content |
OLD | NEW |