| 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 "sky/engine/core/painting/Picture.h" | 9 #include "sky/engine/core/painting/Picture.h" |
| 10 #include "sky/engine/core/view/EventCallback.h" |
| 10 #include "sky/engine/public/platform/sky_display_metrics.h" | 11 #include "sky/engine/public/platform/sky_display_metrics.h" |
| 11 #include "sky/engine/tonic/dart_wrappable.h" | 12 #include "sky/engine/tonic/dart_wrappable.h" |
| 12 #include "sky/engine/wtf/PassRefPtr.h" | 13 #include "sky/engine/wtf/PassRefPtr.h" |
| 13 #include "sky/engine/wtf/RefCounted.h" | 14 #include "sky/engine/wtf/RefCounted.h" |
| 14 | 15 |
| 15 namespace blink { | 16 namespace blink { |
| 16 | 17 |
| 17 class View : public RefCounted<View>, public DartWrappable { | 18 class View : public RefCounted<View>, public DartWrappable { |
| 18 DEFINE_WRAPPERTYPEINFO(); | 19 DEFINE_WRAPPERTYPEINFO(); |
| 19 public: | 20 public: |
| 20 ~View() override; | 21 ~View() override; |
| 21 static PassRefPtr<View> create(const base::Closure& schedulePaintCallback); | 22 static PassRefPtr<View> create(const base::Closure& schedulePaintCallback); |
| 22 | 23 |
| 23 double devicePixelRatio() const { return m_displayMetrics.device_pixel_ratio
; } | 24 double devicePixelRatio() const { return m_displayMetrics.device_pixel_ratio
; } |
| 24 double width() const; | 25 double width() const; |
| 25 double height() const; | 26 double height() const; |
| 26 | 27 |
| 27 Picture* picture() const { return m_picture.get(); } | 28 Picture* picture() const { return m_picture.get(); } |
| 28 void setPicture(Picture* picture) { m_picture = picture; } | 29 void setPicture(Picture* picture) { m_picture = picture; } |
| 29 | 30 |
| 31 void setEventCallback(PassOwnPtr<EventCallback> callback); |
| 32 |
| 30 void schedulePaint(); | 33 void schedulePaint(); |
| 31 | 34 |
| 32 void setDisplayMetrics(const SkyDisplayMetrics& metrics); | 35 void setDisplayMetrics(const SkyDisplayMetrics& metrics); |
| 36 bool handleInputEvent(PassRefPtr<Event> event); |
| 33 | 37 |
| 34 private: | 38 private: |
| 35 explicit View(const base::Closure& schedulePaintCallback); | 39 explicit View(const base::Closure& schedulePaintCallback); |
| 36 | 40 |
| 37 base::Closure m_schedulePaintCallback; | 41 base::Closure m_schedulePaintCallback; |
| 38 SkyDisplayMetrics m_displayMetrics; | 42 SkyDisplayMetrics m_displayMetrics; |
| 43 OwnPtr<EventCallback> m_eventCallback; |
| 39 RefPtr<Picture> m_picture; | 44 RefPtr<Picture> m_picture; |
| 40 }; | 45 }; |
| 41 | 46 |
| 42 } // namespace blink | 47 } // namespace blink |
| 43 | 48 |
| 44 #endif // SKY_ENGINE_CORE_VIEW_VIEW_H_ | 49 #endif // SKY_ENGINE_CORE_VIEW_VIEW_H_ |
| OLD | NEW |