| 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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 case HISTORY_BACK: | 422 case HISTORY_BACK: |
| 423 if (main_contents_ && main_contents_->IsFullscreen()) { | 423 if (main_contents_ && main_contents_->IsFullscreen()) { |
| 424 main_contents_->ExitFullscreen(false); | 424 main_contents_->ExitFullscreen(false); |
| 425 return; | 425 return; |
| 426 } | 426 } |
| 427 // Otherwise handle in java. | 427 // Otherwise handle in java. |
| 428 break; | 428 break; |
| 429 case ZOOM_OUT: // Not handled yet. | 429 case ZOOM_OUT: // Not handled yet. |
| 430 case ZOOM_IN: // Not handled yet. | 430 case ZOOM_IN: // Not handled yet. |
| 431 return; | 431 return; |
| 432 case SHOW_TAB: { |
| 433 int id; |
| 434 CHECK(arguments->GetInteger("id", &id)); |
| 435 delegate_provider_->ShowTab(id); |
| 436 break; |
| 437 } |
| 432 #if defined(ENABLE_VR_SHELL_UI_DEV) | 438 #if defined(ENABLE_VR_SHELL_UI_DEV) |
| 433 case RELOAD_UI: | 439 case RELOAD_UI: |
| 434 ui_contents_->GetController().Reload(content::ReloadType::NORMAL, false); | 440 ui_contents_->GetController().Reload(content::ReloadType::NORMAL, false); |
| 435 html_interface_.reset(new UiInterface(UiInterface::Mode::STANDARD)); | 441 html_interface_.reset(new UiInterface(UiInterface::Mode::STANDARD)); |
| 436 SetUiState(); | 442 SetUiState(); |
| 437 vr_web_contents_observer_->SetUiInterface(html_interface_.get()); | 443 vr_web_contents_observer_->SetUiInterface(html_interface_.get()); |
| 438 return; | 444 return; |
| 439 #endif | 445 #endif |
| 440 default: | 446 default: |
| 441 break; | 447 break; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 454 break; | 460 break; |
| 455 case LOAD_URL: { | 461 case LOAD_URL: { |
| 456 base::string16 url_string; | 462 base::string16 url_string; |
| 457 CHECK(arguments->GetString("url", &url_string)); | 463 CHECK(arguments->GetString("url", &url_string)); |
| 458 base::android::ScopedJavaLocalRef<jstring> string = | 464 base::android::ScopedJavaLocalRef<jstring> string = |
| 459 base::android::ConvertUTF16ToJavaString(env, url_string); | 465 base::android::ConvertUTF16ToJavaString(env, url_string); |
| 460 Java_VrShellImpl_loadURL(env, j_vr_shell_.obj(), string, | 466 Java_VrShellImpl_loadURL(env, j_vr_shell_.obj(), string, |
| 461 ui::PageTransition::PAGE_TRANSITION_TYPED); | 467 ui::PageTransition::PAGE_TRANSITION_TYPED); |
| 462 break; | 468 break; |
| 463 } | 469 } |
| 470 case SHOW_TAB: |
| 471 // Not handled in Java. |
| 472 break; |
| 464 default: | 473 default: |
| 465 NOTREACHED(); | 474 NOTREACHED(); |
| 466 } | 475 } |
| 467 } | 476 } |
| 468 | 477 |
| 469 void VrShell::RenderViewHostChanged(content::RenderViewHost* old_host, | 478 void VrShell::RenderViewHostChanged(content::RenderViewHost* old_host, |
| 470 content::RenderViewHost* new_host) { | 479 content::RenderViewHost* new_host) { |
| 471 new_host->GetWidget()->GetView()->SetBackgroundColor(SK_ColorTRANSPARENT); | 480 new_host->GetWidget()->GetView()->SetBackgroundColor(SK_ColorTRANSPARENT); |
| 472 } | 481 } |
| 473 | 482 |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 jboolean reprojected_rendering) { | 659 jboolean reprojected_rendering) { |
| 651 return reinterpret_cast<intptr_t>(new VrShell( | 660 return reinterpret_cast<intptr_t>(new VrShell( |
| 652 env, obj, reinterpret_cast<ui::WindowAndroid*>(content_window_android), | 661 env, obj, reinterpret_cast<ui::WindowAndroid*>(content_window_android), |
| 653 content::WebContents::FromJavaWebContents(ui_web_contents), | 662 content::WebContents::FromJavaWebContents(ui_web_contents), |
| 654 reinterpret_cast<ui::WindowAndroid*>(ui_window_android), for_web_vr, | 663 reinterpret_cast<ui::WindowAndroid*>(ui_window_android), for_web_vr, |
| 655 VrShellDelegate::GetNativeVrShellDelegate(env, delegate), | 664 VrShellDelegate::GetNativeVrShellDelegate(env, delegate), |
| 656 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering)); | 665 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering)); |
| 657 } | 666 } |
| 658 | 667 |
| 659 } // namespace vr_shell | 668 } // namespace vr_shell |
| OLD | NEW |