| 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 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 audio_capture_indicator_->set_visible(allowed && audio_capturing_); | 589 audio_capture_indicator_->set_visible(allowed && audio_capturing_); |
| 590 video_capture_indicator_->set_visible(allowed && video_capturing_); | 590 video_capture_indicator_->set_visible(allowed && video_capturing_); |
| 591 screen_capture_indicator_->set_visible(allowed && screen_capturing_); | 591 screen_capture_indicator_->set_visible(allowed && screen_capturing_); |
| 592 location_access_indicator_->set_visible(allowed && location_access_); | 592 location_access_indicator_->set_visible(allowed && location_access_); |
| 593 | 593 |
| 594 if (!allowed) | 594 if (!allowed) |
| 595 return; | 595 return; |
| 596 | 596 |
| 597 // Position elements dynamically relative to each other, based on which | 597 // Position elements dynamically relative to each other, based on which |
| 598 // indicators are showing, and how big each one is. | 598 // indicators are showing, and how big each one is. |
| 599 float total_width = kIndicatorGap * (system_indicators_.size() - 1); | 599 float total_width = 0; |
| 600 for (const UiElement* indicator : system_indicators_) { | 600 for (const UiElement* indicator : system_indicators_) { |
| 601 if (indicator->visible()) | 601 if (indicator->visible()) { |
| 602 if (total_width > 0) |
| 603 total_width += kIndicatorGap; |
| 602 total_width += indicator->size().x(); | 604 total_width += indicator->size().x(); |
| 605 } |
| 603 } | 606 } |
| 604 float x_position = -total_width / 2; | 607 float x_position = -total_width / 2; |
| 605 for (UiElement* indicator : system_indicators_) { | 608 for (UiElement* indicator : system_indicators_) { |
| 606 if (!indicator->visible()) | 609 if (!indicator->visible()) |
| 607 continue; | 610 continue; |
| 608 float width = indicator->size().x(); | 611 float width = indicator->size().x(); |
| 609 indicator->set_translation({x_position + width / 2, | 612 indicator->set_translation({x_position + width / 2, |
| 610 kIndicatorVerticalOffset, | 613 kIndicatorVerticalOffset, |
| 611 kIndicatorDistanceOffset}); | 614 kIndicatorDistanceOffset}); |
| 612 x_position += width + kIndicatorGap; | 615 x_position += width + kIndicatorGap; |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 if (fullscreen_) | 743 if (fullscreen_) |
| 741 return ColorScheme::kModeFullscreen; | 744 return ColorScheme::kModeFullscreen; |
| 742 return ColorScheme::kModeNormal; | 745 return ColorScheme::kModeNormal; |
| 743 } | 746 } |
| 744 | 747 |
| 745 const ColorScheme& UiSceneManager::color_scheme() const { | 748 const ColorScheme& UiSceneManager::color_scheme() const { |
| 746 return ColorScheme::GetColorScheme(mode()); | 749 return ColorScheme::GetColorScheme(mode()); |
| 747 } | 750 } |
| 748 | 751 |
| 749 } // namespace vr_shell | 752 } // namespace vr_shell |
| OLD | NEW |