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

Unified Diff: chrome/browser/android/vr_shell/ui_elements/system_indicator.cc

Issue 2950173002: VR: System indicator rework. (Closed)
Patch Set: Address comments; increase size slightly for readability, now that position is dynamic. 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/android/vr_shell/ui_elements/system_indicator.cc
diff --git a/chrome/browser/android/vr_shell/ui_elements/system_indicator.cc b/chrome/browser/android/vr_shell/ui_elements/system_indicator.cc
new file mode 100644
index 0000000000000000000000000000000000000000..bc3a53af543fadac5e4b311b01572ede2b6dfb7e
--- /dev/null
+++ b/chrome/browser/android/vr_shell/ui_elements/system_indicator.cc
@@ -0,0 +1,36 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/android/vr_shell/ui_elements/system_indicator.h"
+
+#include "base/memory/ptr_util.h"
+#include "chrome/browser/android/vr_shell/textures/system_indicator_texture.h"
+
+namespace vr_shell {
+
+SystemIndicator::SystemIndicator(int preferred_width,
+ float height_meters,
+ const gfx::VectorIcon& icon,
+ int string_id)
+ : TexturedElement(preferred_width), height_meters_(height_meters) {
+ if (string_id != 0) {
+ texture_ = base::MakeUnique<SystemIndicatorTexture>(icon, string_id);
+ } else {
+ texture_ = base::MakeUnique<SystemIndicatorTexture>(icon);
+ }
+}
+
+void SystemIndicator::UpdateElementSize() {
+ gfx::SizeF drawn_size = GetTexture()->GetDrawnSize();
+ float width = height_meters_ * drawn_size.width() / drawn_size.height();
+ set_size({width, height_meters_, 1});
+}
+
+SystemIndicator::~SystemIndicator() = default;
+
+UiTexture* SystemIndicator::GetTexture() const {
+ return texture_.get();
+}
+
+} // namespace vr_shell

Powered by Google App Engine
This is Rietveld 408576698