| 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 "android_webview/native/aw_contents.h" | 5 #include "android_webview/native/aw_contents.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "android_webview/browser/aw_browser_context.h" | 9 #include "android_webview/browser/aw_browser_context.h" |
| 10 #include "android_webview/browser/aw_browser_main_parts.h" | 10 #include "android_webview/browser/aw_browser_main_parts.h" |
| (...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 } | 726 } |
| 727 | 727 |
| 728 void AwContents::SetWindowVisibility(JNIEnv* env, jobject obj, bool visible) { | 728 void AwContents::SetWindowVisibility(JNIEnv* env, jobject obj, bool visible) { |
| 729 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 729 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 730 browser_view_renderer_->SetWindowVisibility(visible); | 730 browser_view_renderer_->SetWindowVisibility(visible); |
| 731 } | 731 } |
| 732 | 732 |
| 733 void AwContents::SetIsPaused(JNIEnv* env, jobject obj, bool paused) { | 733 void AwContents::SetIsPaused(JNIEnv* env, jobject obj, bool paused) { |
| 734 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 734 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 735 browser_view_renderer_->SetIsPaused(paused); | 735 browser_view_renderer_->SetIsPaused(paused); |
| 736 if (paused) { | 736 ContentViewCore* cvc = |
| 737 ContentViewCore* cvc = | |
| 738 ContentViewCore::FromWebContents(web_contents_.get()); | 737 ContentViewCore::FromWebContents(web_contents_.get()); |
| 739 if (cvc) | 738 if (!cvc) |
| 740 cvc->PauseVideo(); | 739 return; |
| 741 } | 740 |
| 741 if (paused) |
| 742 cvc->PauseVideo(); |
| 743 else |
| 744 cvc->ResumeFullscreenVideo(); |
| 742 } | 745 } |
| 743 | 746 |
| 744 void AwContents::OnAttachedToWindow(JNIEnv* env, jobject obj, int w, int h) { | 747 void AwContents::OnAttachedToWindow(JNIEnv* env, jobject obj, int w, int h) { |
| 745 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 748 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 746 browser_view_renderer_->OnAttachedToWindow(w, h); | 749 browser_view_renderer_->OnAttachedToWindow(w, h); |
| 747 } | 750 } |
| 748 | 751 |
| 749 void AwContents::OnDetachedFromWindow(JNIEnv* env, jobject obj) { | 752 void AwContents::OnDetachedFromWindow(JNIEnv* env, jobject obj) { |
| 750 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 753 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 751 browser_view_renderer_->OnDetachedFromWindow(); | 754 browser_view_renderer_->OnDetachedFromWindow(); |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 981 void AwContents::TrimMemory(JNIEnv* env, jobject obj, jint level) { | 984 void AwContents::TrimMemory(JNIEnv* env, jobject obj, jint level) { |
| 982 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 985 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 983 browser_view_renderer_->TrimMemory(level); | 986 browser_view_renderer_->TrimMemory(level); |
| 984 } | 987 } |
| 985 | 988 |
| 986 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { | 989 void SetShouldDownloadFavicons(JNIEnv* env, jclass jclazz) { |
| 987 g_should_download_favicons = true; | 990 g_should_download_favicons = true; |
| 988 } | 991 } |
| 989 | 992 |
| 990 } // namespace android_webview | 993 } // namespace android_webview |
| OLD | NEW |