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

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: Set size to DMM. Scale will be used to correctly scale the toast 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..0b7e8793b4e04e256894c73ced3cd1712e19226a
--- /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 x = drawn_size.width() / drawn_size.height() * size().y();
cjgrant 2017/06/28 13:55:34 s/x/width/ ? 'x' generally sounds like a position
bshe 2017/06/28 20:01:58 Done.
+ set_size({x, size().y(), 1});
+}
+
+} // namespace vr_shell

Powered by Google App Engine
This is Rietveld 408576698