| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef MOJO_EXAMPLE_HTML_VIEWER_BLINK_PLATFORM_IMPL_H_ | |
| 6 #define MOJO_EXAMPLE_HTML_VIEWER_BLINK_PLATFORM_IMPL_H_ | |
| 7 | |
| 8 #include "base/message_loop/message_loop.h" | |
| 9 #include "base/threading/thread_local_storage.h" | |
| 10 #include "base/timer/timer.h" | |
| 11 #include "mojo/examples/html_viewer/webmimeregistry_impl.h" | |
| 12 #include "mojo/examples/html_viewer/webthemeengine_impl.h" | |
| 13 #include "mojo/services/public/interfaces/network/network_service.mojom.h" | |
| 14 #include "third_party/WebKit/public/platform/Platform.h" | |
| 15 #include "third_party/WebKit/public/platform/WebScrollbarBehavior.h" | |
| 16 | |
| 17 namespace mojo { | |
| 18 class ApplicationImpl; | |
| 19 | |
| 20 namespace examples { | |
| 21 | |
| 22 class BlinkPlatformImpl : public blink::Platform { | |
| 23 public: | |
| 24 explicit BlinkPlatformImpl(ApplicationImpl* app); | |
| 25 virtual ~BlinkPlatformImpl(); | |
| 26 | |
| 27 // blink::Platform methods: | |
| 28 virtual blink::WebMimeRegistry* mimeRegistry(); | |
| 29 virtual blink::WebThemeEngine* themeEngine(); | |
| 30 virtual blink::WebString defaultLocale(); | |
| 31 virtual double currentTime(); | |
| 32 virtual double monotonicallyIncreasingTime(); | |
| 33 virtual void cryptographicallyRandomValues( | |
| 34 unsigned char* buffer, size_t length); | |
| 35 virtual void setSharedTimerFiredFunction(void (*func)()); | |
| 36 virtual void setSharedTimerFireInterval(double interval_seconds); | |
| 37 virtual void stopSharedTimer(); | |
| 38 virtual void callOnMainThread(void (*func)(void*), void* context); | |
| 39 virtual blink::WebURLLoader* createURLLoader(); | |
| 40 virtual blink::WebString userAgent(); | |
| 41 virtual blink::WebData parseDataURL( | |
| 42 const blink::WebURL& url, blink::WebString& mime_type, | |
| 43 blink::WebString& charset); | |
| 44 virtual blink::WebURLError cancelledError(const blink::WebURL& url) const; | |
| 45 virtual blink::WebThread* createThread(const char* name); | |
| 46 virtual blink::WebThread* currentThread(); | |
| 47 virtual blink::WebWaitableEvent* createWaitableEvent(); | |
| 48 virtual blink::WebWaitableEvent* waitMultipleEvents( | |
| 49 const blink::WebVector<blink::WebWaitableEvent*>& events); | |
| 50 virtual blink::WebScrollbarBehavior* scrollbarBehavior(); | |
| 51 virtual const unsigned char* getTraceCategoryEnabledFlag( | |
| 52 const char* category_name); | |
| 53 | |
| 54 private: | |
| 55 void SuspendSharedTimer(); | |
| 56 void ResumeSharedTimer(); | |
| 57 | |
| 58 void DoTimeout() { | |
| 59 if (shared_timer_func_ && !shared_timer_suspended_) | |
| 60 shared_timer_func_(); | |
| 61 } | |
| 62 | |
| 63 static void DestroyCurrentThread(void*); | |
| 64 | |
| 65 NetworkServicePtr network_service_; | |
| 66 base::MessageLoop* main_loop_; | |
| 67 base::OneShotTimer<BlinkPlatformImpl> shared_timer_; | |
| 68 void (*shared_timer_func_)(); | |
| 69 double shared_timer_fire_time_; | |
| 70 bool shared_timer_fire_time_was_set_while_suspended_; | |
| 71 int shared_timer_suspended_; // counter | |
| 72 base::ThreadLocalStorage::Slot current_thread_slot_; | |
| 73 WebThemeEngineImpl theme_engine_; | |
| 74 WebMimeRegistryImpl mime_registry_; | |
| 75 blink::WebScrollbarBehavior scrollbar_behavior_; | |
| 76 }; | |
| 77 | |
| 78 } // namespace examples | |
| 79 } // namespace mojo | |
| 80 | |
| 81 #endif // MOJO_EXAMPLE_HTML_VIEWER_BLINK_PLATFORM_IMPL_H_ | |
| OLD | NEW |