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 <thread> | 7 #include <thread> |
8 | 8 |
9 #include "chrome/browser/android/vr_shell/ui_scene.h" | 9 #include "chrome/browser/android/vr_shell/ui_scene.h" |
10 #include "chrome/browser/android/vr_shell/vr_compositor.h" | 10 #include "chrome/browser/android/vr_shell/vr_compositor.h" |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 glDepthMask(GL_FALSE); | 438 glDepthMask(GL_FALSE); |
439 glDisable(GL_DEPTH_TEST); | 439 glDisable(GL_DEPTH_TEST); |
440 glDisable(GL_SCISSOR_TEST); | 440 glDisable(GL_SCISSOR_TEST); |
441 glDisable(GL_BLEND); | 441 glDisable(GL_BLEND); |
442 glDisable(GL_POLYGON_OFFSET_FILL); | 442 glDisable(GL_POLYGON_OFFSET_FILL); |
443 | 443 |
444 // Don't need to clear, since we're drawing over the entire render target. | 444 // Don't need to clear, since we're drawing over the entire render target. |
445 | 445 |
446 glViewport(0, 0, render_size_.width, render_size_.height); | 446 glViewport(0, 0, render_size_.width, render_size_.height); |
447 vr_shell_renderer_->GetWebVrRenderer()->Draw(content_texture_id_); | 447 vr_shell_renderer_->GetWebVrRenderer()->Draw(content_texture_id_); |
| 448 |
| 449 if (!webvr_secure_origin_) { |
| 450 // TODO(klausw): Draw the insecure origin warning here. |
| 451 } |
448 } | 452 } |
449 | 453 |
450 void VrShell::OnPause(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 454 void VrShell::OnPause(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
451 if (gvr_api_ == nullptr) | 455 if (gvr_api_ == nullptr) |
452 return; | 456 return; |
453 gvr_api_->PauseTracking(); | 457 gvr_api_->PauseTracking(); |
454 } | 458 } |
455 | 459 |
456 void VrShell::OnResume(JNIEnv* env, const JavaParamRef<jobject>& obj) { | 460 void VrShell::OnResume(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
457 if (gvr_api_ == nullptr) | 461 if (gvr_api_ == nullptr) |
(...skipping 20 matching lines...) Expand all Loading... |
478 ui_tex_width_ = width; | 482 ui_tex_width_ = width; |
479 ui_tex_height_ = height; | 483 ui_tex_height_ = height; |
480 } | 484 } |
481 | 485 |
482 void VrShell::SetWebVrMode(JNIEnv* env, | 486 void VrShell::SetWebVrMode(JNIEnv* env, |
483 const base::android::JavaParamRef<jobject>& obj, | 487 const base::android::JavaParamRef<jobject>& obj, |
484 bool enabled) { | 488 bool enabled) { |
485 webvr_mode_ = enabled; | 489 webvr_mode_ = enabled; |
486 } | 490 } |
487 | 491 |
| 492 void VrShell::SetWebVRSecureOrigin(bool secure_origin) { |
| 493 webvr_secure_origin_ = secure_origin; |
| 494 } |
| 495 |
488 void VrShell::SubmitWebVRFrame() { | 496 void VrShell::SubmitWebVRFrame() { |
489 } | 497 } |
490 | 498 |
491 void VrShell::UpdateWebVRTextureBounds( | 499 void VrShell::UpdateWebVRTextureBounds( |
492 int eye, float left, float top, float width, float height) { | 500 int eye, float left, float top, float width, float height) { |
493 gvr::Rectf bounds = { left, top, width, height }; | 501 gvr::Rectf bounds = { left, top, width, height }; |
494 vr_shell_renderer_->GetWebVrRenderer()->UpdateTextureBounds(eye, bounds); | 502 vr_shell_renderer_->GetWebVrRenderer()->UpdateTextureBounds(eye, bounds); |
495 } | 503 } |
496 | 504 |
497 gvr::GvrApi* VrShell::gvr_api() { | 505 gvr::GvrApi* VrShell::gvr_api() { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 content::WebContents::FromJavaWebContents(content_web_contents)); | 562 content::WebContents::FromJavaWebContents(content_web_contents)); |
555 content::ContentViewCore* ui_core = content::ContentViewCore::FromWebContents( | 563 content::ContentViewCore* ui_core = content::ContentViewCore::FromWebContents( |
556 content::WebContents::FromJavaWebContents(ui_web_contents)); | 564 content::WebContents::FromJavaWebContents(ui_web_contents)); |
557 return reinterpret_cast<intptr_t>(new VrShell( | 565 return reinterpret_cast<intptr_t>(new VrShell( |
558 env, obj, c_core, | 566 env, obj, c_core, |
559 reinterpret_cast<ui::WindowAndroid*>(content_window_android), ui_core, | 567 reinterpret_cast<ui::WindowAndroid*>(content_window_android), ui_core, |
560 reinterpret_cast<ui::WindowAndroid*>(ui_window_android))); | 568 reinterpret_cast<ui::WindowAndroid*>(ui_window_android))); |
561 } | 569 } |
562 | 570 |
563 } // namespace vr_shell | 571 } // namespace vr_shell |
OLD | NEW |