Chromium Code Reviews| 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 |