| OLD | NEW |
| 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/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "chrome/browser/android/vr_shell/textures/close_button_texture.h" | 9 #include "chrome/browser/android/vr_shell/textures/close_button_texture.h" |
| 10 #include "chrome/browser/android/vr_shell/textures/ui_texture.h" | 10 #include "chrome/browser/android/vr_shell/textures/ui_texture.h" |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 void UiSceneManager::CreateBackground() { | 223 void UiSceneManager::CreateBackground() { |
| 224 std::unique_ptr<UiElement> element; | 224 std::unique_ptr<UiElement> element; |
| 225 | 225 |
| 226 // Floor. | 226 // Floor. |
| 227 element = base::MakeUnique<UiElement>(); | 227 element = base::MakeUnique<UiElement>(); |
| 228 element->set_debug_id(kFloor); | 228 element->set_debug_id(kFloor); |
| 229 element->set_id(AllocateId()); | 229 element->set_id(AllocateId()); |
| 230 element->set_size({kSceneSize, kSceneSize, 1.0}); | 230 element->set_size({kSceneSize, kSceneSize, 1.0}); |
| 231 element->set_translation({0.0, -kSceneHeight / 2, 0.0}); | 231 element->set_translation({0.0, -kSceneHeight / 2, 0.0}); |
| 232 element->set_rotation({1.0, 0.0, 0.0, -M_PI / 2.0}); | 232 element->set_rotation({1.0, 0.0, 0.0, -M_PI / 2.0}); |
| 233 element->set_fill(vr_shell::Fill::OPAQUE_GRADIENT); | 233 element->set_fill(vr_shell::Fill::GRID_GRADIENT); |
| 234 element->set_draw_phase(0); | 234 element->set_draw_phase(0); |
| 235 element->set_gridline_count(kFloorGridlineCount); |
| 235 floor_ = element.get(); | 236 floor_ = element.get(); |
| 236 content_elements_.push_back(element.get()); | 237 content_elements_.push_back(element.get()); |
| 237 scene_->AddUiElement(std::move(element)); | 238 scene_->AddUiElement(std::move(element)); |
| 238 | 239 |
| 239 // Ceiling. | 240 // Ceiling. |
| 240 element = base::MakeUnique<UiElement>(); | 241 element = base::MakeUnique<UiElement>(); |
| 241 element->set_debug_id(kCeiling); | 242 element->set_debug_id(kCeiling); |
| 242 element->set_id(AllocateId()); | 243 element->set_id(AllocateId()); |
| 243 element->set_fill(vr_shell::Fill::OPAQUE_GRADIENT); | |
| 244 element->set_size({kSceneSize, kSceneSize, 1.0}); | 244 element->set_size({kSceneSize, kSceneSize, 1.0}); |
| 245 element->set_translation({0.0, kSceneHeight / 2, 0.0}); | 245 element->set_translation({0.0, kSceneHeight / 2, 0.0}); |
| 246 element->set_rotation({1.0, 0.0, 0.0, M_PI / 2}); | 246 element->set_rotation({1.0, 0.0, 0.0, M_PI / 2}); |
| 247 element->set_fill(vr_shell::Fill::OPAQUE_GRADIENT); | 247 element->set_fill(vr_shell::Fill::OPAQUE_GRADIENT); |
| 248 element->set_draw_phase(0); | 248 element->set_draw_phase(0); |
| 249 ceiling_ = element.get(); | 249 ceiling_ = element.get(); |
| 250 content_elements_.push_back(element.get()); | 250 content_elements_.push_back(element.get()); |
| 251 scene_->AddUiElement(std::move(element)); | 251 scene_->AddUiElement(std::move(element)); |
| 252 | 252 |
| 253 // Floor grid. | |
| 254 element = base::MakeUnique<UiElement>(); | |
| 255 element->set_debug_id(kFloorGrid); | |
| 256 element->set_id(AllocateId()); | |
| 257 element->set_size({kSceneSize, kSceneSize, 1.0}); | |
| 258 element->set_translation({0.0, -kSceneHeight / 2 + kTextureOffset, 0.0}); | |
| 259 element->set_rotation({1.0, 0.0, 0.0, -M_PI / 2}); | |
| 260 element->set_fill(vr_shell::Fill::GRID_GRADIENT); | |
| 261 element->set_gridline_count(kFloorGridlineCount); | |
| 262 element->set_draw_phase(0); | |
| 263 floor_grid_ = element.get(); | |
| 264 content_elements_.push_back(element.get()); | |
| 265 scene_->AddUiElement(std::move(element)); | |
| 266 | |
| 267 UpdateBackgroundColor(); | 253 UpdateBackgroundColor(); |
| 268 } | 254 } |
| 269 | 255 |
| 270 void UiSceneManager::CreateUrlBar() { | 256 void UiSceneManager::CreateUrlBar() { |
| 271 // TODO(cjgrant): Incorporate final size and position. | 257 // TODO(cjgrant): Incorporate final size and position. |
| 272 auto url_bar = base::MakeUnique<UrlBar>( | 258 auto url_bar = base::MakeUnique<UrlBar>( |
| 273 512, | 259 512, |
| 274 base::Bind(&UiSceneManager::OnUnsupportedMode, base::Unretained(this))); | 260 base::Bind(&UiSceneManager::OnUnsupportedMode, base::Unretained(this))); |
| 275 url_bar->set_debug_id(kUrlBar); | 261 url_bar->set_debug_id(kUrlBar); |
| 276 url_bar->set_id(AllocateId()); | 262 url_bar->set_id(AllocateId()); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 UpdateBackgroundColor(); | 344 UpdateBackgroundColor(); |
| 359 } | 345 } |
| 360 | 346 |
| 361 void UiSceneManager::UpdateBackgroundColor() { | 347 void UiSceneManager::UpdateBackgroundColor() { |
| 362 // TODO(vollick): it would be nice if ceiling, floor and the grid were | 348 // TODO(vollick): it would be nice if ceiling, floor and the grid were |
| 363 // UiElement subclasses and could respond to the OnSetMode signal. | 349 // UiElement subclasses and could respond to the OnSetMode signal. |
| 364 ceiling_->set_center_color(color_scheme().ceiling); | 350 ceiling_->set_center_color(color_scheme().ceiling); |
| 365 ceiling_->set_edge_color(color_scheme().horizon); | 351 ceiling_->set_edge_color(color_scheme().horizon); |
| 366 floor_->set_center_color(color_scheme().floor); | 352 floor_->set_center_color(color_scheme().floor); |
| 367 floor_->set_edge_color(color_scheme().horizon); | 353 floor_->set_edge_color(color_scheme().horizon); |
| 368 floor_grid_->set_center_color(color_scheme().floor_grid); | 354 floor_->set_grid_color(color_scheme().floor_grid); |
| 369 SkColor floor_grid_edge_color = SkColorSetA(color_scheme().floor_grid, 0); | |
| 370 floor_grid_->set_edge_color(floor_grid_edge_color); | |
| 371 } | 355 } |
| 372 | 356 |
| 373 void UiSceneManager::SetAudioCapturingIndicator(bool enabled) { | 357 void UiSceneManager::SetAudioCapturingIndicator(bool enabled) { |
| 374 audio_capturing_ = enabled; | 358 audio_capturing_ = enabled; |
| 375 audio_capture_indicator_->set_visible(enabled && !web_vr_mode_); | 359 audio_capture_indicator_->set_visible(enabled && !web_vr_mode_); |
| 376 } | 360 } |
| 377 | 361 |
| 378 void UiSceneManager::SetVideoCapturingIndicator(bool enabled) { | 362 void UiSceneManager::SetVideoCapturingIndicator(bool enabled) { |
| 379 video_capturing_ = enabled; | 363 video_capturing_ = enabled; |
| 380 video_capture_indicator_->set_visible(enabled && !web_vr_mode_); | 364 video_capture_indicator_->set_visible(enabled && !web_vr_mode_); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 if (fullscreen_) | 462 if (fullscreen_) |
| 479 return ColorScheme::kModeFullscreen; | 463 return ColorScheme::kModeFullscreen; |
| 480 return ColorScheme::kModeNormal; | 464 return ColorScheme::kModeNormal; |
| 481 } | 465 } |
| 482 | 466 |
| 483 const ColorScheme& UiSceneManager::color_scheme() const { | 467 const ColorScheme& UiSceneManager::color_scheme() const { |
| 484 return ColorScheme::GetColorScheme(mode()); | 468 return ColorScheme::GetColorScheme(mode()); |
| 485 } | 469 } |
| 486 | 470 |
| 487 } // namespace vr_shell | 471 } // namespace vr_shell |
| OLD | NEW |