| 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/ui_interface.h" | 5 #include "chrome/browser/android/vr_shell/ui_interface.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 | 108 |
| 109 updates_.Set("url", std::move(details)); | 109 updates_.Set("url", std::move(details)); |
| 110 FlushUpdates(); | 110 FlushUpdates(); |
| 111 } | 111 } |
| 112 | 112 |
| 113 void UiInterface::HandleAppButtonClicked() { | 113 void UiInterface::HandleAppButtonClicked() { |
| 114 updates_.SetBoolean("appButtonClicked", true); | 114 updates_.SetBoolean("appButtonClicked", true); |
| 115 FlushUpdates(); | 115 FlushUpdates(); |
| 116 } | 116 } |
| 117 | 117 |
| 118 void UiInterface::SetHistoryButtonsEnabled(bool can_go_back, |
| 119 bool can_go_forward) { |
| 120 updates_.SetBoolean("canGoBack", can_go_back); |
| 121 updates_.SetBoolean("canGoForward", can_go_forward); |
| 122 FlushUpdates(); |
| 123 } |
| 124 |
| 118 void UiInterface::OnDomContentsLoaded() { | 125 void UiInterface::OnDomContentsLoaded() { |
| 119 loaded_ = true; | 126 loaded_ = true; |
| 120 #if defined(ENABLE_VR_SHELL_UI_DEV) | 127 #if defined(ENABLE_VR_SHELL_UI_DEV) |
| 121 updates_.SetBoolean("enableReloadUi", true); | 128 updates_.SetBoolean("enableReloadUi", true); |
| 122 #endif | 129 #endif |
| 123 FlushUpdates(); | 130 FlushUpdates(); |
| 124 } | 131 } |
| 125 | 132 |
| 126 void UiInterface::SetUiCommandHandler(UiCommandHandler* handler) { | 133 void UiInterface::SetUiCommandHandler(UiCommandHandler* handler) { |
| 127 handler_ = handler; | 134 handler_ = handler; |
| 128 } | 135 } |
| 129 | 136 |
| 130 void UiInterface::FlushUpdates() { | 137 void UiInterface::FlushUpdates() { |
| 131 if (loaded_ && handler_) { | 138 if (loaded_ && handler_) { |
| 132 handler_->SendCommandToUi(updates_); | 139 handler_->SendCommandToUi(updates_); |
| 133 updates_.Clear(); | 140 updates_.Clear(); |
| 134 } | 141 } |
| 135 } | 142 } |
| 136 | 143 |
| 137 } // namespace vr_shell | 144 } // namespace vr_shell |
| OLD | NEW |