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

Side by Side Diff: chrome/browser/android/vr_shell/ui_interface.cc

Issue 2536223002: Omnibox improvements and fixes. (Closed)
Patch Set: Rebase. Created 4 years 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 unified diff | Download patch
OLDNEW
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(Mode initial_mode) { 12 UiInterface::UiInterface(Mode initial_mode, bool fullscreen) {
13 SetMode(initial_mode); 13 SetMode(initial_mode);
14 SetFullscreen(fullscreen);
14 } 15 }
15 16
16 UiInterface::~UiInterface() {} 17 UiInterface::~UiInterface() {}
17 18
18 void UiInterface::SetMode(Mode mode) { 19 void UiInterface::SetMode(Mode mode) {
19 mode_ = mode; 20 mode_ = mode;
20 FlushModeState(); 21 FlushModeState();
21 } 22 }
22 23
23 void UiInterface::SetMenuMode(bool enabled) { 24 void UiInterface::SetMenuMode(bool enabled) {
24 menu_mode_ = enabled; 25 menu_mode_ = enabled;
25 FlushModeState(); 26 FlushModeState();
26 } 27 }
27 28
28 void UiInterface::SetCinemaMode(bool enabled) { 29 void UiInterface::SetFullscreen(bool enabled) {
29 cinema_mode_ = enabled; 30 fullscreen_ = enabled;
30 FlushModeState(); 31 FlushModeState();
31 } 32 }
32 33
33 void UiInterface::FlushModeState() { 34 void UiInterface::FlushModeState() {
34 updates_.SetInteger("mode", static_cast<int>(mode_)); 35 updates_.SetInteger("mode", static_cast<int>(mode_));
35 updates_.SetBoolean("menuMode", menu_mode_); 36 updates_.SetBoolean("menuMode", menu_mode_);
36 updates_.SetBoolean("cinemaMode", cinema_mode_); 37 updates_.SetBoolean("fullscreen", fullscreen_);
37 FlushUpdates(); 38 FlushUpdates();
38 } 39 }
39 40
40 void UiInterface::SetSecureOrigin(bool secure) { 41 void UiInterface::SetSecurityLevel(int level) {
41 updates_.SetBoolean("secureOrigin", secure); 42 updates_.SetInteger("securityLevel", level);
42 FlushUpdates(); 43 FlushUpdates();
43 } 44 }
44 45
46 void UiInterface::SetWebVRSecureOrigin(bool secure) {
47 updates_.SetBoolean("webVRSecureOrigin", secure);
48 FlushUpdates();
49 }
50
45 void UiInterface::SetLoading(bool loading) { 51 void UiInterface::SetLoading(bool loading) {
46 updates_.SetBoolean("loading", loading); 52 updates_.SetBoolean("loading", loading);
47 FlushUpdates(); 53 FlushUpdates();
48 } 54 }
49 55
50 void UiInterface::SetURL(const GURL& url) { 56 void UiInterface::SetURL(const GURL& url) {
51 std::unique_ptr<base::DictionaryValue> details(new base::DictionaryValue); 57 std::unique_ptr<base::DictionaryValue> details(new base::DictionaryValue);
52 details->SetString("host", url.host()); 58 details->SetString("host", url.host());
53 details->SetString("path", url.path()); 59 details->SetString("path", url.path());
54 60
(...skipping 14 matching lines...) Expand all
69 } 75 }
70 76
71 void UiInterface::FlushUpdates() { 77 void UiInterface::FlushUpdates() {
72 if (loaded_ && handler_) { 78 if (loaded_ && handler_) {
73 handler_->SendCommandToUi(updates_); 79 handler_->SendCommandToUi(updates_);
74 updates_.Clear(); 80 updates_.Clear();
75 } 81 }
76 } 82 }
77 83
78 } // namespace vr_shell 84 } // namespace vr_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698