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

Unified Diff: chrome/browser/android/vr_shell/vr_shell.cc

Issue 2694903003: Handle basic navigation controls without webcontents in VR Shell. (Closed)
Patch Set: Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellImpl.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/vr_shell/vr_shell.cc
diff --git a/chrome/browser/android/vr_shell/vr_shell.cc b/chrome/browser/android/vr_shell/vr_shell.cc
index 2e8fba0709b366f185af5a76031929bcea3cb4e0..974f167258de82f2deaad5885a55e2c0f81286ae 100644
--- a/chrome/browser/android/vr_shell/vr_shell.cc
+++ b/chrome/browser/android/vr_shell/vr_shell.cc
@@ -408,6 +408,7 @@ void VrShell::UpdateScene(const base::ListValue* args) {
void VrShell::DoUiAction(const UiAction action,
const base::DictionaryValue* arguments) {
+ // Actions that can be handled natively.
switch (action) {
case OMNIBOX_CONTENT:
html_interface_->HandleOmniboxInput(*arguments);
@@ -418,50 +419,48 @@ void VrShell::DoUiAction(const UiAction action,
SetContentPaused(paused);
return;
}
+ case HISTORY_BACK:
+ if (main_contents_ && main_contents_->IsFullscreen()) {
+ main_contents_->ExitFullscreen(false);
+ return;
+ }
+ // Otherwise handle in java.
+ break;
+ case ZOOM_OUT: // Not handled yet.
+ case ZOOM_IN: // Not handled yet.
+ return;
+#if defined(ENABLE_VR_SHELL_UI_DEV)
+ case RELOAD_UI:
+ ui_contents_->GetController().Reload(content::ReloadType::NORMAL, false);
+ html_interface_.reset(new UiInterface(UiInterface::Mode::STANDARD));
+ SetUiState();
+ vr_web_contents_observer_->SetUiInterface(html_interface_.get());
+ return;
+#endif
default:
break;
}
- // TODO(mthiesse): Handles these in java through the Tab.
- if (!main_contents_)
- return;
- content::NavigationController& controller = main_contents_->GetController();
+ // Actions that are handled in java.
+ JNIEnv* env = base::android::AttachCurrentThread();
switch (action) {
case HISTORY_BACK:
- if (main_contents_->IsFullscreen()) {
- main_contents_->ExitFullscreen(false);
- } else if (controller.CanGoBack()) {
- controller.GoBack();
- }
+ Java_VrShellImpl_navigateBack(env, j_vr_shell_.obj());
break;
case HISTORY_FORWARD:
- if (controller.CanGoForward())
- controller.GoForward();
+ Java_VrShellImpl_navigateForward(env, j_vr_shell_.obj());
break;
case RELOAD:
- controller.Reload(content::ReloadType::NORMAL, false);
+ Java_VrShellImpl_reload(env, j_vr_shell_.obj());
break;
case LOAD_URL: {
- std::string url_string;
+ base::string16 url_string;
CHECK(arguments->GetString("url", &url_string));
- GURL url(url_string);
- // TODO(crbug.com/683344): Sanitize the URL and prefix, and pass the
- // proper transition type down from the UI.
- controller.LoadURL(url, content::Referrer(),
- ui::PageTransition::PAGE_TRANSITION_AUTO_TOPLEVEL,
- std::string(""));
+ base::android::ScopedJavaLocalRef<jstring> string =
+ base::android::ConvertUTF16ToJavaString(env, url_string);
+ Java_VrShellImpl_loadURL(env, j_vr_shell_.obj(), string,
+ ui::PageTransition::PAGE_TRANSITION_TYPED);
break;
}
-#if defined(ENABLE_VR_SHELL_UI_DEV)
- case RELOAD_UI:
- ui_contents_->GetController().Reload(content::ReloadType::NORMAL, false);
- html_interface_.reset(new UiInterface(UiInterface::Mode::STANDARD));
- SetUiState();
- vr_web_contents_observer_->SetUiInterface(html_interface_.get());
- break;
-#endif
- case ZOOM_OUT: // Not handled yet.
- case ZOOM_IN: // Not handled yet.
- break;
default:
NOTREACHED();
}
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellImpl.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698