| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 SKY_ENGINE_CORE_VIEW_VIEW_H_ | 5 #ifndef SKY_ENGINE_CORE_VIEW_VIEW_H_ |
| 6 #define SKY_ENGINE_CORE_VIEW_VIEW_H_ | 6 #define SKY_ENGINE_CORE_VIEW_VIEW_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "sky/engine/core/html/VoidCallback.h" |
| 10 #include "sky/engine/core/painting/Picture.h" | 11 #include "sky/engine/core/painting/Picture.h" |
| 11 #include "sky/engine/core/view/BeginFrameCallback.h" | 12 #include "sky/engine/core/view/BeginFrameCallback.h" |
| 12 #include "sky/engine/core/view/EventCallback.h" | 13 #include "sky/engine/core/view/EventCallback.h" |
| 13 #include "sky/engine/public/platform/sky_display_metrics.h" | 14 #include "sky/engine/public/platform/sky_display_metrics.h" |
| 14 #include "sky/engine/tonic/dart_wrappable.h" | 15 #include "sky/engine/tonic/dart_wrappable.h" |
| 15 #include "sky/engine/wtf/PassRefPtr.h" | 16 #include "sky/engine/wtf/PassRefPtr.h" |
| 16 #include "sky/engine/wtf/RefCounted.h" | 17 #include "sky/engine/wtf/RefCounted.h" |
| 17 | 18 |
| 18 namespace blink { | 19 namespace blink { |
| 19 | 20 |
| 20 class View : public RefCounted<View>, public DartWrappable { | 21 class View : public RefCounted<View>, public DartWrappable { |
| 21 DEFINE_WRAPPERTYPEINFO(); | 22 DEFINE_WRAPPERTYPEINFO(); |
| 22 public: | 23 public: |
| 23 ~View() override; | 24 ~View() override; |
| 24 static PassRefPtr<View> create(const base::Closure& scheduleFrameCallback); | 25 static PassRefPtr<View> create(const base::Closure& scheduleFrameCallback); |
| 25 | 26 |
| 26 double devicePixelRatio() const { return m_displayMetrics.device_pixel_ratio
; } | 27 double devicePixelRatio() const { return m_displayMetrics.device_pixel_ratio
; } |
| 27 double width() const; | 28 double width() const; |
| 28 double height() const; | 29 double height() const; |
| 29 | 30 |
| 30 Picture* picture() const { return m_picture.get(); } | 31 Picture* picture() const { return m_picture.get(); } |
| 31 void setPicture(Picture* picture) { m_picture = picture; } | 32 void setPicture(Picture* picture) { m_picture = picture; } |
| 32 | 33 |
| 33 void setEventCallback(PassOwnPtr<EventCallback> callback); | 34 void setEventCallback(PassOwnPtr<EventCallback> callback); |
| 34 | 35 |
| 36 void setMetricsChangedCallback(PassOwnPtr<VoidCallback> callback); |
| 37 |
| 35 void setBeginFrameCallback(PassOwnPtr<BeginFrameCallback> callback); | 38 void setBeginFrameCallback(PassOwnPtr<BeginFrameCallback> callback); |
| 36 void scheduleFrame(); | 39 void scheduleFrame(); |
| 37 | 40 |
| 38 void setDisplayMetrics(const SkyDisplayMetrics& metrics); | 41 void setDisplayMetrics(const SkyDisplayMetrics& metrics); |
| 39 void handleInputEvent(PassRefPtr<Event> event); | 42 void handleInputEvent(PassRefPtr<Event> event); |
| 40 void beginFrame(base::TimeTicks frameTime); | 43 void beginFrame(base::TimeTicks frameTime); |
| 41 | 44 |
| 42 private: | 45 private: |
| 43 explicit View(const base::Closure& scheduleFrameCallback); | 46 explicit View(const base::Closure& scheduleFrameCallback); |
| 44 | 47 |
| 45 base::Closure m_scheduleFrameCallback; | 48 base::Closure m_scheduleFrameCallback; |
| 46 SkyDisplayMetrics m_displayMetrics; | 49 SkyDisplayMetrics m_displayMetrics; |
| 47 OwnPtr<EventCallback> m_eventCallback; | 50 OwnPtr<EventCallback> m_eventCallback; |
| 51 OwnPtr<VoidCallback> m_metricsChangedCallback; |
| 48 OwnPtr<BeginFrameCallback> m_beginFrameCallback; | 52 OwnPtr<BeginFrameCallback> m_beginFrameCallback; |
| 49 RefPtr<Picture> m_picture; | 53 RefPtr<Picture> m_picture; |
| 50 }; | 54 }; |
| 51 | 55 |
| 52 } // namespace blink | 56 } // namespace blink |
| 53 | 57 |
| 54 #endif // SKY_ENGINE_CORE_VIEW_VIEW_H_ | 58 #endif // SKY_ENGINE_CORE_VIEW_VIEW_H_ |
| OLD | NEW |