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

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

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

Powered by Google App Engine
This is Rietveld 408576698