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

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

Issue 2461503002: Provide URL-related info to the VR HTML UI. (Closed)
Patch Set: Rebase further ahead to resolve conflict. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/android/vr_shell/ui_interface.h ('k') | chrome/browser/android/vr_shell/vr_shell.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/vr_shell/ui_interface.cc
diff --git a/chrome/browser/android/vr_shell/ui_interface.cc b/chrome/browser/android/vr_shell/ui_interface.cc
index 4ad96b4e4b73c4eacd9790cb7822221e71c628b9..10648c2835073f03ffe2ff9b2bcb8d23c582c6d1 100644
--- a/chrome/browser/android/vr_shell/ui_interface.cc
+++ b/chrome/browser/android/vr_shell/ui_interface.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/android/vr_shell/ui_interface.h"
#include "chrome/browser/ui/webui/vr_shell/vr_shell_ui_message_handler.h"
+#include "url/gurl.h"
namespace vr_shell {
@@ -14,10 +15,6 @@ UiInterface::UiInterface() {
UiInterface::~UiInterface() {}
-void UiInterface::SetUiCommandHandler(UiCommandHandler* handler) {
- handler_ = handler;
-}
-
void UiInterface::SetMode(Mode mode) {
updates_.SetInteger("mode", static_cast<int>(mode));
FlushUpdates();
@@ -28,6 +25,20 @@ void UiInterface::SetSecureOrigin(bool secure) {
FlushUpdates();
}
+void UiInterface::SetLoading(bool loading) {
+ updates_.SetBoolean("loading", loading);
+ FlushUpdates();
+}
+
+void UiInterface::SetURL(const GURL& url) {
+ std::unique_ptr<base::DictionaryValue> details(new base::DictionaryValue);
+ details->SetString("host", url.host());
+ details->SetString("path", url.path());
+
+ updates_.Set("url", std::move(details));
+ FlushUpdates();
+}
+
void UiInterface::OnDomContentsLoaded() {
loaded_ = true;
#if defined(ENABLE_VR_SHELL_UI_DEV)
@@ -36,6 +47,10 @@ void UiInterface::OnDomContentsLoaded() {
FlushUpdates();
}
+void UiInterface::SetUiCommandHandler(UiCommandHandler* handler) {
+ handler_ = handler;
+}
+
void UiInterface::FlushUpdates() {
if (loaded_ && handler_) {
handler_->SendCommandToUi(updates_);
« no previous file with comments | « chrome/browser/android/vr_shell/ui_interface.h ('k') | chrome/browser/android/vr_shell/vr_shell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698