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

Side by Side Diff: chrome/browser/android/vr_shell/ui_elements/exclusive_screen_toast.cc

Issue 2966793002: NOT FOR REVIEW - convert to cc animation
Patch Set: switch to transform operations Created 3 years, 5 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 unified diff | Download patch
OLDNEW
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_elements/exclusive_screen_toast.h" 5 #include "chrome/browser/android/vr_shell/ui_elements/exclusive_screen_toast.h"
6 6
7 #include "chrome/browser/android/vr_shell/textures/ui_texture.h" 7 #include "chrome/browser/android/vr_shell/textures/ui_texture.h"
8 #include "chrome/browser/android/vr_shell/ui_elements/textured_element.h" 8 #include "chrome/browser/android/vr_shell/ui_elements/textured_element.h"
9 9
10 namespace vr_shell { 10 namespace vr_shell {
11 11
12 ExclusiveScreenToast::ExclusiveScreenToast(int preferred_width, 12 ExclusiveScreenToast::ExclusiveScreenToast(int id,
13 int preferred_width,
13 const base::TimeDelta& timeout) 14 const base::TimeDelta& timeout)
14 : TransientSimpleTexturedElement(preferred_width, timeout) {} 15 : TransientSimpleTexturedElement(id, preferred_width, timeout) {}
15 16
16 ExclusiveScreenToast::~ExclusiveScreenToast() = default; 17 ExclusiveScreenToast::~ExclusiveScreenToast() = default;
17 18
18 void ExclusiveScreenToast::UpdateElementSize() { 19 void ExclusiveScreenToast::UpdateElementSize() {
19 // Adjust the width of this element according to the texture. The width is 20 // Adjust the width of this element according to the texture. The width is
20 // decided by the length of the text to show. 21 // decided by the length of the text to show.
21 gfx::SizeF drawn_size = GetTexture()->GetDrawnSize(); 22 gfx::SizeF drawn_size = GetTexture()->GetDrawnSize();
22 float width = drawn_size.width() / drawn_size.height() * size().y(); 23 float width = drawn_size.width() / drawn_size.height() * size().y();
23 set_size({width, size().y(), 1}); 24 set_size({width, size().y(), 1});
24 } 25 }
25 26
26 } // namespace vr_shell 27 } // namespace vr_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698