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

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

Issue 2957173002: Update toast behavior and apperance according to UX requirement (Closed)
Patch Set: review 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/exclusive_screen_toast.cc
diff --git a/chrome/browser/android/vr_shell/ui_elements/exclusive_screen_toast.cc b/chrome/browser/android/vr_shell/ui_elements/exclusive_screen_toast.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e43d3e66c298cf424fb21841aab13e6b4285545d
--- /dev/null
+++ b/chrome/browser/android/vr_shell/ui_elements/exclusive_screen_toast.cc
@@ -0,0 +1,25 @@
+// 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/exclusive_screen_toast.h"
+
+#include "chrome/browser/android/vr_shell/textures/ui_texture.h"
+#include "chrome/browser/android/vr_shell/ui_elements/textured_element.h"
+
+namespace vr_shell {
+
+ExclusiveScreenToast::ExclusiveScreenToast(int preferred_width)
+ : SimpleTexturedElement(preferred_width) {}
+
+ExclusiveScreenToast::~ExclusiveScreenToast() = default;
+
+void ExclusiveScreenToast::UpdateElementSize() {
+ // Adjust the width of this element according to the texture. The width is
+ // decided by the length of the text to show.
+ gfx::SizeF drawn_size = GetTexture()->GetDrawnSize();
+ float width = drawn_size.width() / drawn_size.height() * size().y();
+ set_size({width, size().y(), 1});
+}
+
+} // namespace vr_shell

Powered by Google App Engine
This is Rietveld 408576698