| 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 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 NOTREACHED(); | 466 NOTREACHED(); |
| 467 } | 467 } |
| 468 } | 468 } |
| 469 | 469 |
| 470 void VrShell::RenderViewHostChanged(content::RenderViewHost* old_host, | 470 void VrShell::RenderViewHostChanged(content::RenderViewHost* old_host, |
| 471 content::RenderViewHost* new_host) { | 471 content::RenderViewHost* new_host) { |
| 472 new_host->GetWidget()->GetView()->SetBackgroundColor(SK_ColorTRANSPARENT); | 472 new_host->GetWidget()->GetView()->SetBackgroundColor(SK_ColorTRANSPARENT); |
| 473 } | 473 } |
| 474 | 474 |
| 475 void VrShell::MainFrameWasResized(bool width_changed) { | 475 void VrShell::MainFrameWasResized(bool width_changed) { |
| 476 display::Display display = display::Screen::GetScreen() | 476 display::Display display = |
| 477 ->GetDisplayNearestWindow(ui_contents_->GetNativeView()); | 477 display::Screen::GetScreen()->GetDisplayNearestWindow( |
| 478 ui_contents_->GetNativeView()->GetWindowAndroid()); |
| 478 PostToGlThreadWhenReady( | 479 PostToGlThreadWhenReady( |
| 479 base::Bind(&VrShellGl::UIBoundsChanged, gl_thread_->GetVrShellGl(), | 480 base::Bind(&VrShellGl::UIBoundsChanged, gl_thread_->GetVrShellGl(), |
| 480 display.size().width(), display.size().height())); | 481 display.size().width(), display.size().height())); |
| 481 } | 482 } |
| 482 | 483 |
| 483 void VrShell::ContentFrameWasResized(bool width_changed) { | 484 void VrShell::ContentFrameWasResized(bool width_changed) { |
| 484 display::Display display = | 485 display::Display display = |
| 485 display::Screen::GetScreen()->GetDisplayNearestWindow(content_window_); | 486 display::Screen::GetScreen()->GetDisplayNearestWindow(content_window_); |
| 486 PostToGlThreadWhenReady( | 487 PostToGlThreadWhenReady( |
| 487 base::Bind(&VrShellGl::ContentBoundsChanged, gl_thread_->GetVrShellGl(), | 488 base::Bind(&VrShellGl::ContentBoundsChanged, gl_thread_->GetVrShellGl(), |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 jboolean reprojected_rendering) { | 652 jboolean reprojected_rendering) { |
| 652 return reinterpret_cast<intptr_t>(new VrShell( | 653 return reinterpret_cast<intptr_t>(new VrShell( |
| 653 env, obj, reinterpret_cast<ui::WindowAndroid*>(content_window_android), | 654 env, obj, reinterpret_cast<ui::WindowAndroid*>(content_window_android), |
| 654 content::WebContents::FromJavaWebContents(ui_web_contents), | 655 content::WebContents::FromJavaWebContents(ui_web_contents), |
| 655 reinterpret_cast<ui::WindowAndroid*>(ui_window_android), for_web_vr, | 656 reinterpret_cast<ui::WindowAndroid*>(ui_window_android), for_web_vr, |
| 656 VrShellDelegate::GetNativeVrShellDelegate(env, delegate), | 657 VrShellDelegate::GetNativeVrShellDelegate(env, delegate), |
| 657 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering)); | 658 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering)); |
| 658 } | 659 } |
| 659 | 660 |
| 660 } // namespace vr_shell | 661 } // namespace vr_shell |
| OLD | NEW |