Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(750)

Side by Side Diff: chrome/browser/android/vr_shell/vr_shell.cc

Issue 2374153002: Expose secure origin state to WebVR renderer (Closed)
Patch Set: Add missing "RequestPresent" argument to unit test Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 glDisable(GL_DEPTH_TEST); 398 glDisable(GL_DEPTH_TEST);
399 glDisable(GL_SCISSOR_TEST); 399 glDisable(GL_SCISSOR_TEST);
400 glDisable(GL_BLEND); 400 glDisable(GL_BLEND);
401 glDisable(GL_POLYGON_OFFSET_FILL); 401 glDisable(GL_POLYGON_OFFSET_FILL);
402 402
403 // Don't need to clear, since we're drawing over the entire render target. 403 // Don't need to clear, since we're drawing over the entire render target.
404 glClear(GL_COLOR_BUFFER_BIT); 404 glClear(GL_COLOR_BUFFER_BIT);
405 405
406 glViewport(0, 0, render_size_.width, render_size_.height); 406 glViewport(0, 0, render_size_.width, render_size_.height);
407 vr_shell_renderer_->GetWebVrRenderer()->Draw(content_texture_id_); 407 vr_shell_renderer_->GetWebVrRenderer()->Draw(content_texture_id_);
408
409 if (!webvr_secure_origin_) {
410 // TODO(klausw): Draw the insecure origin warning here.
411 }
408 } 412 }
409 413
410 void VrShell::OnPause(JNIEnv* env, const JavaParamRef<jobject>& obj) { 414 void VrShell::OnPause(JNIEnv* env, const JavaParamRef<jobject>& obj) {
411 if (gvr_api_ == nullptr) 415 if (gvr_api_ == nullptr)
412 return; 416 return;
413 gvr_api_->PauseTracking(); 417 gvr_api_->PauseTracking();
414 } 418 }
415 419
416 void VrShell::OnResume(JNIEnv* env, const JavaParamRef<jobject>& obj) { 420 void VrShell::OnResume(JNIEnv* env, const JavaParamRef<jobject>& obj) {
417 if (gvr_api_ == nullptr) 421 if (gvr_api_ == nullptr)
(...skipping 20 matching lines...) Expand all
438 ui_tex_width_ = width; 442 ui_tex_width_ = width;
439 ui_tex_height_ = height; 443 ui_tex_height_ = height;
440 } 444 }
441 445
442 void VrShell::SetWebVrMode(JNIEnv* env, 446 void VrShell::SetWebVrMode(JNIEnv* env,
443 const base::android::JavaParamRef<jobject>& obj, 447 const base::android::JavaParamRef<jobject>& obj,
444 bool enabled) { 448 bool enabled) {
445 webvr_mode_ = enabled; 449 webvr_mode_ = enabled;
446 } 450 }
447 451
452 void VrShell::SetWebVRSecureOrigin(bool secure_origin) {
453 webvr_secure_origin_ = secure_origin;
454 }
455
448 void VrShell::SubmitWebVRFrame() { 456 void VrShell::SubmitWebVRFrame() {
449 } 457 }
450 458
451 void VrShell::UpdateWebVRTextureBounds( 459 void VrShell::UpdateWebVRTextureBounds(
452 int eye, float left, float top, float width, float height) { 460 int eye, float left, float top, float width, float height) {
453 gvr::Rectf bounds = { left, top, width, height }; 461 gvr::Rectf bounds = { left, top, width, height };
454 vr_shell_renderer_->GetWebVrRenderer()->UpdateTextureBounds(eye, bounds); 462 vr_shell_renderer_->GetWebVrRenderer()->UpdateTextureBounds(eye, bounds);
455 } 463 }
456 464
457 gvr::GvrApi* VrShell::gvr_api() { 465 gvr::GvrApi* VrShell::gvr_api() {
(...skipping 30 matching lines...) Expand all
488 content::WebContents::FromJavaWebContents(content_web_contents)); 496 content::WebContents::FromJavaWebContents(content_web_contents));
489 content::ContentViewCore* ui_core = content::ContentViewCore::FromWebContents( 497 content::ContentViewCore* ui_core = content::ContentViewCore::FromWebContents(
490 content::WebContents::FromJavaWebContents(ui_web_contents)); 498 content::WebContents::FromJavaWebContents(ui_web_contents));
491 return reinterpret_cast<intptr_t>(new VrShell( 499 return reinterpret_cast<intptr_t>(new VrShell(
492 env, obj, c_core, 500 env, obj, c_core,
493 reinterpret_cast<ui::WindowAndroid*>(content_window_android), ui_core, 501 reinterpret_cast<ui::WindowAndroid*>(content_window_android), ui_core,
494 reinterpret_cast<ui::WindowAndroid*>(ui_window_android))); 502 reinterpret_cast<ui::WindowAndroid*>(ui_window_android)));
495 } 503 }
496 504
497 } // namespace vr_shell 505 } // namespace vr_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698