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

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

Issue 2872773002: VR: Render the current URL and security level on the URL bar. (Closed)
Patch Set: Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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_scene_manager.h" 5 #include "chrome/browser/android/vr_shell/ui_scene_manager.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "chrome/browser/android/vr_shell/textures/ui_texture.h" 8 #include "chrome/browser/android/vr_shell/textures/ui_texture.h"
9 #include "chrome/browser/android/vr_shell/ui_elements/permanent_security_warning .h" 9 #include "chrome/browser/android/vr_shell/ui_elements/permanent_security_warning .h"
10 #include "chrome/browser/android/vr_shell/ui_elements/transient_security_warning .h" 10 #include "chrome/browser/android/vr_shell/ui_elements/transient_security_warning .h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 scene_->SetBackgroundColor(horizon); 181 scene_->SetBackgroundColor(horizon);
182 } 182 }
183 183
184 void UiSceneManager::CreateUrlBar() { 184 void UiSceneManager::CreateUrlBar() {
185 // TODO(cjgrant): Incorporate final size and position. 185 // TODO(cjgrant): Incorporate final size and position.
186 // TODO(cjgrant): Add the loading progress indicator element. 186 // TODO(cjgrant): Add the loading progress indicator element.
187 auto element = base::MakeUnique<UrlBar>(512); 187 auto element = base::MakeUnique<UrlBar>(512);
188 element->set_id(AllocateId()); 188 element->set_id(AllocateId());
189 element->set_translation({0, -0.9, -1.8}); 189 element->set_translation({0, -0.9, -1.8});
190 element->set_size({0.9, 0, 1}); 190 element->set_size({0.9, 0, 1});
191 element->SetBackButtonCallback(
192 base::Bind(&UiSceneManager::OnBackButtonClicked, base::Unretained(this)));
191 url_bar_ = element.get(); 193 url_bar_ = element.get();
192 browser_ui_elements_.push_back(element.get()); 194 browser_ui_elements_.push_back(element.get());
193 scene_->AddUiElement(std::move(element)); 195 scene_->AddUiElement(std::move(element));
194 } 196 }
195 197
196 base::WeakPtr<UiSceneManager> UiSceneManager::GetWeakPtr() { 198 base::WeakPtr<UiSceneManager> UiSceneManager::GetWeakPtr() {
197 return weak_ptr_factory_.GetWeakPtr(); 199 return weak_ptr_factory_.GetWeakPtr();
198 } 200 }
199 201
200 void UiSceneManager::SetWebVrMode(bool web_vr) { 202 void UiSceneManager::SetWebVrMode(bool web_vr) {
201 web_vr_mode_ = web_vr; 203 web_vr_mode_ = web_vr;
202 204
203 // Make all VR scene UI elements visible if not in WebVR. 205 // Make all VR scene UI elements visible if not in WebVR.
204 for (UiElement* element : browser_ui_elements_) { 206 for (UiElement* element : browser_ui_elements_) {
205 element->set_visible(!web_vr_mode_); 207 element->set_visible(!web_vr_mode_);
206 } 208 }
209 url_bar_->SetEnabled(!web_vr);
207 210
208 ConfigureSecurityWarnings(); 211 ConfigureSecurityWarnings();
209 } 212 }
210 213
211 void UiSceneManager::SetWebVrSecureOrigin(bool secure) { 214 void UiSceneManager::SetWebVrSecureOrigin(bool secure) {
212 secure_origin_ = secure; 215 secure_origin_ = secure;
213 ConfigureSecurityWarnings(); 216 ConfigureSecurityWarnings();
214 } 217 }
215 218
216 void UiSceneManager::OnAppButtonClicked() { 219 void UiSceneManager::OnAppButtonClicked() {
(...skipping 17 matching lines...) Expand all
234 &UiSceneManager::OnSecurityWarningTimer); 237 &UiSceneManager::OnSecurityWarningTimer);
235 } else { 238 } else {
236 security_warning_timer_.Stop(); 239 security_warning_timer_.Stop();
237 } 240 }
238 } 241 }
239 242
240 void UiSceneManager::OnSecurityWarningTimer() { 243 void UiSceneManager::OnSecurityWarningTimer() {
241 transient_security_warning_->set_visible(false); 244 transient_security_warning_->set_visible(false);
242 } 245 }
243 246
247 void UiSceneManager::OnBackButtonClicked() {
248 browser_->NavigateBack();
249 }
250
244 void UiSceneManager::SetURL(const GURL& gurl) { 251 void UiSceneManager::SetURL(const GURL& gurl) {
245 url_bar_->SetURL(gurl); 252 url_bar_->SetURL(gurl);
246 } 253 }
247 254
248 void UiSceneManager::SetFullscreen(bool enabled) {} 255 void UiSceneManager::SetFullscreen(bool enabled) {}
249 256
250 void UiSceneManager::SetSecurityLevel(int level) {} 257 void UiSceneManager::SetSecurityLevel(int level) {
258 url_bar_->SetSecurityLevel(level);
259 }
251 260
252 void UiSceneManager::SetLoading(bool loading) {} 261 void UiSceneManager::SetLoading(bool loading) {}
253 262
254 void UiSceneManager::SetLoadProgress(double progress) {} 263 void UiSceneManager::SetLoadProgress(double progress) {}
255 264
256 void UiSceneManager::SetHistoryButtonsEnabled(bool can_go_back, 265 void UiSceneManager::SetHistoryButtonsEnabled(bool can_go_back,
257 bool can_go_forward) {} 266 bool can_go_forward) {}
258 267
259 int UiSceneManager::AllocateId() { 268 int UiSceneManager::AllocateId() {
260 return next_available_id_++; 269 return next_available_id_++;
261 } 270 }
262 271
263 } // namespace vr_shell 272 } // namespace vr_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698