| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "chrome/browser/android/vr_shell/vr_shell.h" | 5 #include "chrome/browser/android/vr_shell/vr_shell.h" |
| 6 | 6 |
| 7 #include <android/native_window_jni.h> | 7 #include <android/native_window_jni.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 567 poll_capturing_media_task_.Reset( | 567 poll_capturing_media_task_.Reset( |
| 568 base::Bind(&VrShell::PollMediaAccessFlag, base::Unretained(this))); | 568 base::Bind(&VrShell::PollMediaAccessFlag, base::Unretained(this))); |
| 569 main_thread_task_runner_->PostDelayedTask( | 569 main_thread_task_runner_->PostDelayedTask( |
| 570 FROM_HERE, poll_capturing_media_task_.callback(), | 570 FROM_HERE, poll_capturing_media_task_.callback(), |
| 571 poll_media_access_interval_); | 571 poll_media_access_interval_); |
| 572 | 572 |
| 573 scoped_refptr<MediaStreamCaptureIndicator> indicator = | 573 scoped_refptr<MediaStreamCaptureIndicator> indicator = |
| 574 MediaCaptureDevicesDispatcher::GetInstance() | 574 MediaCaptureDevicesDispatcher::GetInstance() |
| 575 ->GetMediaStreamCaptureIndicator(); | 575 ->GetMediaStreamCaptureIndicator(); |
| 576 bool is_capturing_audio = indicator->IsCapturingAudio(web_contents_); | 576 bool is_capturing_audio = indicator->IsCapturingAudio(web_contents_); |
| 577 if (is_capturing_audio != is_capturing_audio_) { | 577 if (is_capturing_audio != is_capturing_audio_) |
| 578 WaitForGlThread(); | 578 ui_->SetAudioCapturingIndicator(is_capturing_audio); |
| 579 PostToGlThread(FROM_HERE, | |
| 580 base::Bind(&VrShellGl::SetAudioCapturingWarning, | |
| 581 gl_thread_->GetVrShellGl(), is_capturing_audio)); | |
| 582 } | |
| 583 is_capturing_audio_ = is_capturing_audio; | 579 is_capturing_audio_ = is_capturing_audio; |
| 584 | 580 |
| 585 bool is_capturing_video = indicator->IsCapturingVideo(web_contents_); | 581 bool is_capturing_video = indicator->IsCapturingVideo(web_contents_); |
| 586 if (is_capturing_video != is_capturing_video_) { | 582 if (is_capturing_video != is_capturing_video_) |
| 587 WaitForGlThread(); | 583 ui_->SetVideoCapturingIndicator(is_capturing_video); |
| 588 PostToGlThread(FROM_HERE, | |
| 589 base::Bind(&VrShellGl::SetVideoCapturingWarning, | |
| 590 gl_thread_->GetVrShellGl(), is_capturing_video)); | |
| 591 } | |
| 592 is_capturing_video_ = is_capturing_video; | 584 is_capturing_video_ = is_capturing_video; |
| 593 | 585 |
| 594 bool is_capturing_screen = indicator->IsBeingMirrored(web_contents_); | 586 bool is_capturing_screen = indicator->IsBeingMirrored(web_contents_); |
| 595 if (is_capturing_screen != is_capturing_screen_) { | 587 if (is_capturing_screen != is_capturing_screen_) |
| 596 WaitForGlThread(); | 588 ui_->SetScreenCapturingIndicator(is_capturing_screen); |
| 597 PostToGlThread(FROM_HERE, | |
| 598 base::Bind(&VrShellGl::SetScreenCapturingWarning, | |
| 599 gl_thread_->GetVrShellGl(), is_capturing_screen)); | |
| 600 } | |
| 601 is_capturing_screen_ = is_capturing_screen; | 589 is_capturing_screen_ = is_capturing_screen; |
| 602 } | 590 } |
| 603 | 591 |
| 604 void VrShell::SetContentCssSize(float width, float height, float dpr) { | 592 void VrShell::SetContentCssSize(float width, float height, float dpr) { |
| 605 JNIEnv* env = base::android::AttachCurrentThread(); | 593 JNIEnv* env = base::android::AttachCurrentThread(); |
| 606 Java_VrShellImpl_setContentCssSize(env, j_vr_shell_.obj(), width, height, | 594 Java_VrShellImpl_setContentCssSize(env, j_vr_shell_.obj(), width, height, |
| 607 dpr); | 595 dpr); |
| 608 } | 596 } |
| 609 | 597 |
| 610 void VrShell::ProcessContentGesture( | 598 void VrShell::ProcessContentGesture( |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 jlong gvr_api, | 639 jlong gvr_api, |
| 652 jboolean reprojected_rendering) { | 640 jboolean reprojected_rendering) { |
| 653 return reinterpret_cast<intptr_t>(new VrShell( | 641 return reinterpret_cast<intptr_t>(new VrShell( |
| 654 env, obj, reinterpret_cast<ui::WindowAndroid*>(window_android), | 642 env, obj, reinterpret_cast<ui::WindowAndroid*>(window_android), |
| 655 for_web_vr, in_cct, | 643 for_web_vr, in_cct, |
| 656 VrShellDelegate::GetNativeVrShellDelegate(env, delegate), | 644 VrShellDelegate::GetNativeVrShellDelegate(env, delegate), |
| 657 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering)); | 645 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering)); |
| 658 } | 646 } |
| 659 | 647 |
| 660 } // namespace vr_shell | 648 } // namespace vr_shell |
| OLD | NEW |