| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 MOJO_SERVICES_HTML_VIEWER_BLINK_PLATFORM_IMPL_H_ | 5 #ifndef MOJO_SERVICES_HTML_VIEWER_BLINK_PLATFORM_IMPL_H_ |
| 6 #define MOJO_SERVICES_HTML_VIEWER_BLINK_PLATFORM_IMPL_H_ | 6 #define MOJO_SERVICES_HTML_VIEWER_BLINK_PLATFORM_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/threading/thread_local_storage.h" | 10 #include "base/threading/thread_local_storage.h" |
| 11 #include "base/timer/timer.h" | 11 #include "base/timer/timer.h" |
| 12 #include "cc/blink/web_compositor_support_impl.h" | 12 #include "cc/blink/web_compositor_support_impl.h" |
| 13 #include "mojo/services/html_viewer/blink_resource_map.h" | 13 #include "mojo/services/html_viewer/blink_resource_map.h" |
| 14 #include "mojo/services/html_viewer/webmimeregistry_impl.h" | 14 #include "mojo/services/html_viewer/webmimeregistry_impl.h" |
| 15 #include "mojo/services/html_viewer/webnotificationmanager_impl.h" | 15 #include "mojo/services/html_viewer/webnotificationmanager_impl.h" |
| 16 #include "mojo/services/html_viewer/webscheduler_impl.h" | 16 #include "mojo/services/html_viewer/webscheduler_impl.h" |
| 17 #include "mojo/services/html_viewer/webthemeengine_impl.h" | 17 #include "mojo/services/html_viewer/webthemeengine_impl.h" |
| 18 #include "third_party/WebKit/public/platform/Platform.h" | 18 #include "third_party/WebKit/public/platform/Platform.h" |
| 19 #include "third_party/WebKit/public/platform/WebScrollbarBehavior.h" | 19 #include "third_party/WebKit/public/platform/WebScrollbarBehavior.h" |
| 20 | 20 |
| 21 namespace html_viewer { | 21 namespace html_viewer { |
| 22 | 22 |
| 23 class BlinkPlatformImpl : public blink::Platform { | 23 class BlinkPlatformImpl : public blink::Platform { |
| 24 public: | 24 public: |
| 25 explicit BlinkPlatformImpl(); | 25 explicit BlinkPlatformImpl(); |
| 26 ~BlinkPlatformImpl() override; | 26 virtual ~BlinkPlatformImpl(); |
| 27 | 27 |
| 28 // blink::Platform methods: | 28 // blink::Platform methods: |
| 29 blink::WebMimeRegistry* mimeRegistry() override; | 29 virtual blink::WebMimeRegistry* mimeRegistry(); |
| 30 blink::WebThemeEngine* themeEngine() override; | 30 virtual blink::WebThemeEngine* themeEngine(); |
| 31 blink::WebScheduler* scheduler() override; | 31 virtual blink::WebScheduler* scheduler(); |
| 32 blink::WebString defaultLocale() override; | 32 virtual blink::WebString defaultLocale(); |
| 33 double currentTime() override; | 33 virtual double currentTime(); |
| 34 double monotonicallyIncreasingTime() override; | 34 virtual double monotonicallyIncreasingTime(); |
| 35 void cryptographicallyRandomValues(unsigned char* buffer, | 35 virtual void cryptographicallyRandomValues(unsigned char* buffer, |
| 36 size_t length) override; | 36 size_t length); |
| 37 void setSharedTimerFiredFunction(void (*func)()) override; | 37 virtual void setSharedTimerFiredFunction(void (*func)()); |
| 38 void setSharedTimerFireInterval(double interval_seconds) override; | 38 virtual void setSharedTimerFireInterval(double interval_seconds); |
| 39 void stopSharedTimer() override; | 39 virtual void stopSharedTimer(); |
| 40 virtual void callOnMainThread(void (*func)(void*), void* context); | 40 virtual void callOnMainThread(void (*func)(void*), void* context); |
| 41 bool isThreadedCompositingEnabled() override; | 41 virtual bool isThreadedCompositingEnabled(); |
| 42 blink::WebCompositorSupport* compositorSupport() override; | 42 virtual blink::WebCompositorSupport* compositorSupport(); |
| 43 blink::WebURLLoader* createURLLoader() override; | 43 virtual blink::WebURLLoader* createURLLoader(); |
| 44 blink::WebSocketHandle* createWebSocketHandle() override; | 44 virtual blink::WebSocketHandle* createWebSocketHandle(); |
| 45 blink::WebString userAgent() override; | 45 virtual blink::WebString userAgent(); |
| 46 blink::WebData parseDataURL( | 46 virtual blink::WebData parseDataURL( |
| 47 const blink::WebURL& url, blink::WebString& mime_type, | 47 const blink::WebURL& url, blink::WebString& mime_type, |
| 48 blink::WebString& charset) override; | 48 blink::WebString& charset); |
| 49 bool isReservedIPAddress(const blink::WebString& host) const override; | 49 virtual bool isReservedIPAddress(const blink::WebString& host) const; |
| 50 blink::WebURLError cancelledError(const blink::WebURL& url) const override; | 50 virtual blink::WebURLError cancelledError(const blink::WebURL& url) const; |
| 51 blink::WebThread* createThread(const char* name) override; | 51 virtual blink::WebThread* createThread(const char* name); |
| 52 blink::WebThread* currentThread() override; | 52 virtual blink::WebThread* currentThread(); |
| 53 void yieldCurrentThread() override; | 53 virtual void yieldCurrentThread(); |
| 54 blink::WebWaitableEvent* createWaitableEvent() override; | 54 virtual blink::WebWaitableEvent* createWaitableEvent(); |
| 55 blink::WebWaitableEvent* waitMultipleEvents( | 55 virtual blink::WebWaitableEvent* waitMultipleEvents( |
| 56 const blink::WebVector<blink::WebWaitableEvent*>& events) override; | 56 const blink::WebVector<blink::WebWaitableEvent*>& events); |
| 57 blink::WebScrollbarBehavior* scrollbarBehavior() override; | 57 virtual blink::WebScrollbarBehavior* scrollbarBehavior(); |
| 58 const unsigned char* getTraceCategoryEnabledFlag( | 58 virtual const unsigned char* getTraceCategoryEnabledFlag( |
| 59 const char* category_name) override; | 59 const char* category_name); |
| 60 blink::WebData loadResource(const char* name) override; | 60 virtual blink::WebData loadResource(const char* name); |
| 61 blink::WebGestureCurve* createFlingAnimationCurve( | 61 virtual blink::WebGestureCurve* createFlingAnimationCurve( |
| 62 blink::WebGestureDevice device_source, | 62 blink::WebGestureDevice device_source, |
| 63 const blink::WebFloatPoint& velocity, | 63 const blink::WebFloatPoint& velocity, |
| 64 const blink::WebSize& cumulative_scroll) override; | 64 const blink::WebSize& cumulative_scroll); |
| 65 blink::WebNotificationManager* notificationManager() override; | 65 virtual blink::WebNotificationManager* notificationManager(); |
| 66 | 66 |
| 67 private: | 67 private: |
| 68 void SuspendSharedTimer(); | 68 void SuspendSharedTimer(); |
| 69 void ResumeSharedTimer(); | 69 void ResumeSharedTimer(); |
| 70 | 70 |
| 71 void DoTimeout() { | 71 void DoTimeout() { |
| 72 if (shared_timer_func_ && !shared_timer_suspended_) | 72 if (shared_timer_func_ && !shared_timer_suspended_) |
| 73 shared_timer_func_(); | 73 shared_timer_func_(); |
| 74 } | 74 } |
| 75 | 75 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 89 WebNotificationManagerImpl web_notification_manager_; | 89 WebNotificationManagerImpl web_notification_manager_; |
| 90 blink::WebScrollbarBehavior scrollbar_behavior_; | 90 blink::WebScrollbarBehavior scrollbar_behavior_; |
| 91 BlinkResourceMap blink_resource_map_; | 91 BlinkResourceMap blink_resource_map_; |
| 92 | 92 |
| 93 DISALLOW_COPY_AND_ASSIGN(BlinkPlatformImpl); | 93 DISALLOW_COPY_AND_ASSIGN(BlinkPlatformImpl); |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 } // namespace html_viewer | 96 } // namespace html_viewer |
| 97 | 97 |
| 98 #endif // MOJO_SERVICES_HTML_VIEWER_BLINK_PLATFORM_IMPL_H_ | 98 #endif // MOJO_SERVICES_HTML_VIEWER_BLINK_PLATFORM_IMPL_H_ |
| OLD | NEW |