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

Side by Side Diff: chrome/browser/android/vr_shell/ui_elements/simple_textured_element.h

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 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_SIMPLE_TEXTURED_ELEMENT_H_ 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_SIMPLE_TEXTURED_ELEMENT_H_
6 #define CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_SIMPLE_TEXTURED_ELEMENT_H_ 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_SIMPLE_TEXTURED_ELEMENT_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "chrome/browser/android/vr_shell/textures/exclusive_screen_toast_textur e.h" 12 #include "chrome/browser/android/vr_shell/textures/exclusive_screen_toast_textur e.h"
13 #include "chrome/browser/android/vr_shell/textures/exit_warning_texture.h" 13 #include "chrome/browser/android/vr_shell/textures/exit_warning_texture.h"
14 #include "chrome/browser/android/vr_shell/textures/insecure_content_permanent_te xture.h" 14 #include "chrome/browser/android/vr_shell/textures/insecure_content_permanent_te xture.h"
15 #include "chrome/browser/android/vr_shell/textures/insecure_content_transient_te xture.h" 15 #include "chrome/browser/android/vr_shell/textures/insecure_content_transient_te xture.h"
16 #include "chrome/browser/android/vr_shell/textures/ui_texture.h" 16 #include "chrome/browser/android/vr_shell/textures/ui_texture.h"
17 #include "chrome/browser/android/vr_shell/ui_elements/textured_element.h" 17 #include "chrome/browser/android/vr_shell/ui_elements/textured_element.h"
18 #include "chrome/browser/android/vr_shell/ui_elements/transience_manager.h" 18 #include "chrome/browser/android/vr_shell/ui_elements/transience_manager.h"
19 19
20 namespace vr_shell { 20 namespace vr_shell {
21 21
22 template <class T> 22 template <class T>
23 class SimpleTexturedElement : public TexturedElement { 23 class SimpleTexturedElement : public TexturedElement {
24 public: 24 public:
25 // |preferred_width| is the element's desired width in meters. Constraints 25 // |preferred_width| is the element's desired width in meters. Constraints
26 // implied by the texture being rendered may or may not allow it to be 26 // implied by the texture being rendered may or may not allow it to be
27 // rendered exactly at the preferred width. 27 // rendered exactly at the preferred width.
28 explicit SimpleTexturedElement(int maximum_width) 28 explicit SimpleTexturedElement(int id, int maximum_width)
29 : TexturedElement(maximum_width), texture_(base::MakeUnique<T>()) {} 29 : TexturedElement(id, maximum_width), texture_(base::MakeUnique<T>()) {}
30 ~SimpleTexturedElement() override {} 30 ~SimpleTexturedElement() override {}
31 T* GetDerivedTexture() { return texture_.get(); } 31 T* GetDerivedTexture() { return texture_.get(); }
32 32
33 protected: 33 protected:
34 UiTexture* GetTexture() const override { return texture_.get(); } 34 UiTexture* GetTexture() const override { return texture_.get(); }
35 35
36 private: 36 private:
37 std::unique_ptr<T> texture_; 37 std::unique_ptr<T> texture_;
38 38
39 DISALLOW_COPY_AND_ASSIGN(SimpleTexturedElement); 39 DISALLOW_COPY_AND_ASSIGN(SimpleTexturedElement);
40 }; 40 };
41 41
42 template <class T> 42 template <class T>
43 class TransientSimpleTexturedElement : public SimpleTexturedElement<T> { 43 class TransientSimpleTexturedElement : public SimpleTexturedElement<T> {
44 public: 44 public:
45 TransientSimpleTexturedElement(int maximum_width, 45 TransientSimpleTexturedElement(int id,
46 int maximum_width,
46 const base::TimeDelta& timeout) 47 const base::TimeDelta& timeout)
47 : SimpleTexturedElement<T>(maximum_width), transience_(this, timeout) {} 48 : SimpleTexturedElement<T>(id, maximum_width),
49 transience_(this, timeout) {}
48 50
49 ~TransientSimpleTexturedElement() override {} 51 ~TransientSimpleTexturedElement() override {}
50 52
51 void SetEnabled(bool enabled) override { transience_.SetEnabled(enabled); } 53 void SetEnabled(bool enabled) override { transience_.SetEnabled(enabled); }
52 54
53 TransienceManager* transience() { return &transience_; } 55 TransienceManager* transience() { return &transience_; }
54 56
55 private: 57 private:
56 TransienceManager transience_; 58 TransienceManager transience_;
57 59
58 DISALLOW_COPY_AND_ASSIGN(TransientSimpleTexturedElement); 60 DISALLOW_COPY_AND_ASSIGN(TransientSimpleTexturedElement);
59 }; 61 };
60 62
61 typedef SimpleTexturedElement<ExitWarningTexture> ExitWarning; 63 typedef SimpleTexturedElement<ExitWarningTexture> ExitWarning;
62 typedef SimpleTexturedElement<InsecureContentPermanentTexture> 64 typedef SimpleTexturedElement<InsecureContentPermanentTexture>
63 PermanentSecurityWarning; 65 PermanentSecurityWarning;
64 typedef TransientSimpleTexturedElement<InsecureContentTransientTexture> 66 typedef TransientSimpleTexturedElement<InsecureContentTransientTexture>
65 TransientSecurityWarning; 67 TransientSecurityWarning;
66 68
67 } // namespace vr_shell 69 } // namespace vr_shell
68 70
69 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_SIMPLE_TEXTURED_ELEMENT_H _ 71 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_UI_ELEMENTS_SIMPLE_TEXTURED_ELEMENT_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698