| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 static constexpr float kContentWidth = 0.96 * kContentDistance; | 44 static constexpr float kContentWidth = 0.96 * kContentDistance; |
| 45 static constexpr float kContentHeight = 0.64 * kContentDistance; | 45 static constexpr float kContentHeight = 0.64 * kContentDistance; |
| 46 static constexpr float kContentVerticalOffset = -0.1 * kContentDistance; | 46 static constexpr float kContentVerticalOffset = -0.1 * kContentDistance; |
| 47 static constexpr float kBackplaneSize = 1000.0; | 47 static constexpr float kBackplaneSize = 1000.0; |
| 48 static constexpr float kBackgroundDistanceMultiplier = 1.414; | 48 static constexpr float kBackgroundDistanceMultiplier = 1.414; |
| 49 | 49 |
| 50 static constexpr float kUrlBarDistance = 2.4; | 50 static constexpr float kUrlBarDistance = 2.4; |
| 51 static constexpr float kUrlBarWidth = 0.672 * kUrlBarDistance; | 51 static constexpr float kUrlBarWidth = 0.672 * kUrlBarDistance; |
| 52 static constexpr float kUrlBarHeight = 0.088 * kUrlBarDistance; | 52 static constexpr float kUrlBarHeight = 0.088 * kUrlBarDistance; |
| 53 static constexpr float kUrlBarVerticalOffset = -0.516 * kUrlBarDistance; | 53 static constexpr float kUrlBarVerticalOffset = -0.516 * kUrlBarDistance; |
| 54 static constexpr float kUrlBarRotationRad = -0.175; |
| 54 | 55 |
| 55 static constexpr float kLoadingIndicatorWidth = 0.24 * kUrlBarDistance; | 56 static constexpr float kLoadingIndicatorWidth = 0.24 * kUrlBarDistance; |
| 56 static constexpr float kLoadingIndicatorHeight = 0.008 * kUrlBarDistance; | 57 static constexpr float kLoadingIndicatorHeight = 0.008 * kUrlBarDistance; |
| 57 static constexpr float kLoadingIndicatorOffset = | 58 static constexpr float kLoadingIndicatorVerticalOffset = |
| 58 -0.016 * kUrlBarDistance - kLoadingIndicatorHeight / 2; | 59 (-kUrlBarVerticalOffset + kContentVerticalOffset - kContentHeight / 2 - |
| 60 kUrlBarHeight / 2) / |
| 61 2; |
| 62 static constexpr float kLoadingIndicatorDepthOffset = |
| 63 (kUrlBarDistance - kContentDistance) / 2; |
| 59 | 64 |
| 60 static constexpr float kSceneSize = 25.0; | 65 static constexpr float kSceneSize = 25.0; |
| 61 static constexpr float kSceneHeight = 4.0; | 66 static constexpr float kSceneHeight = 4.0; |
| 62 static constexpr int kFloorGridlineCount = 40; | 67 static constexpr int kFloorGridlineCount = 40; |
| 63 | 68 |
| 64 static constexpr float kFullscreenDistance = 3; | 69 static constexpr float kFullscreenDistance = 3; |
| 65 static constexpr float kFullscreenHeight = 0.64 * kFullscreenDistance; | 70 static constexpr float kFullscreenHeight = 0.64 * kFullscreenDistance; |
| 66 static constexpr float kFullscreenWidth = 1.138 * kFullscreenDistance; | 71 static constexpr float kFullscreenWidth = 1.138 * kFullscreenDistance; |
| 67 static constexpr float kFullscreenVerticalOffset = -0.1 * kFullscreenDistance; | 72 static constexpr float kFullscreenVerticalOffset = -0.1 * kFullscreenDistance; |
| 68 | 73 |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 } | 259 } |
| 255 | 260 |
| 256 void UiSceneManager::CreateUrlBar() { | 261 void UiSceneManager::CreateUrlBar() { |
| 257 // TODO(cjgrant): Incorporate final size and position. | 262 // TODO(cjgrant): Incorporate final size and position. |
| 258 auto url_bar = base::MakeUnique<UrlBar>( | 263 auto url_bar = base::MakeUnique<UrlBar>( |
| 259 512, | 264 512, |
| 260 base::Bind(&UiSceneManager::OnUnsupportedMode, base::Unretained(this))); | 265 base::Bind(&UiSceneManager::OnUnsupportedMode, base::Unretained(this))); |
| 261 url_bar->set_debug_id(kUrlBar); | 266 url_bar->set_debug_id(kUrlBar); |
| 262 url_bar->set_id(AllocateId()); | 267 url_bar->set_id(AllocateId()); |
| 263 url_bar->set_translation({0, kUrlBarVerticalOffset, -kUrlBarDistance}); | 268 url_bar->set_translation({0, kUrlBarVerticalOffset, -kUrlBarDistance}); |
| 269 url_bar->set_rotation({1.0, 0.0, 0.0, kUrlBarRotationRad}); |
| 264 url_bar->set_size({kUrlBarWidth, kUrlBarHeight, 1}); | 270 url_bar->set_size({kUrlBarWidth, kUrlBarHeight, 1}); |
| 265 url_bar->SetBackButtonCallback( | 271 url_bar->SetBackButtonCallback( |
| 266 base::Bind(&UiSceneManager::OnBackButtonClicked, base::Unretained(this))); | 272 base::Bind(&UiSceneManager::OnBackButtonClicked, base::Unretained(this))); |
| 267 url_bar_ = url_bar.get(); | 273 url_bar_ = url_bar.get(); |
| 268 control_elements_.push_back(url_bar.get()); | 274 control_elements_.push_back(url_bar.get()); |
| 269 scene_->AddUiElement(std::move(url_bar)); | 275 scene_->AddUiElement(std::move(url_bar)); |
| 270 | 276 |
| 271 auto indicator = base::MakeUnique<LoadingIndicator>(256); | 277 auto indicator = base::MakeUnique<LoadingIndicator>(256); |
| 272 indicator->set_debug_id(kLoadingIndicator); | 278 indicator->set_debug_id(kLoadingIndicator); |
| 273 indicator->set_id(AllocateId()); | 279 indicator->set_id(AllocateId()); |
| 274 indicator->set_translation({0, 0, kLoadingIndicatorOffset}); | 280 indicator->set_translation( |
| 281 {0, kLoadingIndicatorVerticalOffset, kLoadingIndicatorDepthOffset}); |
| 275 indicator->set_size({kLoadingIndicatorWidth, kLoadingIndicatorHeight, 1}); | 282 indicator->set_size({kLoadingIndicatorWidth, kLoadingIndicatorHeight, 1}); |
| 276 indicator->set_parent_id(url_bar_->id()); | 283 indicator->set_parent_id(url_bar_->id()); |
| 277 indicator->set_y_anchoring(YAnchoring::YTOP); | 284 indicator->set_y_anchoring(YAnchoring::YTOP); |
| 278 loading_indicator_ = indicator.get(); | 285 loading_indicator_ = indicator.get(); |
| 279 control_elements_.push_back(indicator.get()); | 286 control_elements_.push_back(indicator.get()); |
| 280 scene_->AddUiElement(std::move(indicator)); | 287 scene_->AddUiElement(std::move(indicator)); |
| 281 } | 288 } |
| 282 | 289 |
| 283 void UiSceneManager::CreateCloseButton() { | 290 void UiSceneManager::CreateCloseButton() { |
| 284 std::unique_ptr<Button> element = base::MakeUnique<Button>( | 291 std::unique_ptr<Button> element = base::MakeUnique<Button>( |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 if (fullscreen_) | 471 if (fullscreen_) |
| 465 return ColorScheme::kModeFullscreen; | 472 return ColorScheme::kModeFullscreen; |
| 466 return ColorScheme::kModeNormal; | 473 return ColorScheme::kModeNormal; |
| 467 } | 474 } |
| 468 | 475 |
| 469 const ColorScheme& UiSceneManager::color_scheme() const { | 476 const ColorScheme& UiSceneManager::color_scheme() const { |
| 470 return ColorScheme::GetColorScheme(mode()); | 477 return ColorScheme::GetColorScheme(mode()); |
| 471 } | 478 } |
| 472 | 479 |
| 473 } // namespace vr_shell | 480 } // namespace vr_shell |
| OLD | NEW |