| 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 "chrome/browser/ui/webui/vr_shell/vr_shell_ui_message_handler.h" | 7 #include "chrome/browser/ui/webui/vr_shell/vr_shell_ui_message_handler.h" |
| 8 #include "url/gurl.h" | 8 #include "url/gurl.h" |
| 9 | 9 |
| 10 namespace vr_shell { | 10 namespace vr_shell { |
| 11 | 11 |
| 12 UiInterface::UiInterface() { | 12 UiInterface::UiInterface() { |
| 13 SetMode(Mode::STANDARD); | 13 SetMode(Mode::STANDARD); |
| 14 } | 14 } |
| 15 | 15 |
| 16 UiInterface::~UiInterface() {} | 16 UiInterface::~UiInterface() {} |
| 17 | 17 |
| 18 void UiInterface::SetMode(Mode mode) { | 18 void UiInterface::SetMode(Mode mode) { |
| 19 mode_ = mode; | 19 mode_ = mode; |
| 20 updates_.SetInteger("mode", static_cast<int>(mode)); | 20 updates_.SetInteger("mode", static_cast<int>(mode)); |
| 21 FlushUpdates(); | 21 FlushUpdates(); |
| 22 } | 22 } |
| 23 | 23 |
| 24 void UiInterface::SetSecureOrigin(bool secure) { | 24 void UiInterface::SetSecurityLevel(int level) { |
| 25 updates_.SetBoolean("secureOrigin", secure); | 25 updates_.SetInteger("securityLevel", level); |
| 26 FlushUpdates(); | 26 FlushUpdates(); |
| 27 } | 27 } |
| 28 | 28 |
| 29 void UiInterface::SetWebVRSecureOrigin(bool secure) { |
| 30 updates_.SetBoolean("webVRSecureOrigin", secure); |
| 31 FlushUpdates(); |
| 32 } |
| 33 |
| 29 void UiInterface::SetLoading(bool loading) { | 34 void UiInterface::SetLoading(bool loading) { |
| 30 updates_.SetBoolean("loading", loading); | 35 updates_.SetBoolean("loading", loading); |
| 31 FlushUpdates(); | 36 FlushUpdates(); |
| 32 } | 37 } |
| 33 | 38 |
| 34 void UiInterface::SetURL(const GURL& url) { | 39 void UiInterface::SetURL(const GURL& url) { |
| 35 std::unique_ptr<base::DictionaryValue> details(new base::DictionaryValue); | 40 std::unique_ptr<base::DictionaryValue> details(new base::DictionaryValue); |
| 36 details->SetString("host", url.host()); | 41 details->SetString("host", url.host()); |
| 37 details->SetString("path", url.path()); | 42 details->SetString("path", url.path()); |
| 38 | 43 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 53 } | 58 } |
| 54 | 59 |
| 55 void UiInterface::FlushUpdates() { | 60 void UiInterface::FlushUpdates() { |
| 56 if (loaded_ && handler_) { | 61 if (loaded_ && handler_) { |
| 57 handler_->SendCommandToUi(updates_); | 62 handler_->SendCommandToUi(updates_); |
| 58 updates_.Clear(); | 63 updates_.Clear(); |
| 59 } | 64 } |
| 60 } | 65 } |
| 61 | 66 |
| 62 } // namespace vr_shell | 67 } // namespace vr_shell |
| OLD | NEW |