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/services/public/interfaces/network/network_service.mojom.h" | |
13 #include "third_party/WebKit/public/platform/Platform.h" | |
14 #include "third_party/WebKit/public/platform/WebThemeEngine.h" | |
15 | |
16 namespace mojo { | |
17 class Application; | |
18 | |
19 namespace examples { | |
20 | |
21 class BlinkPlatformImpl : public blink::Platform { | |
22 public: | |
23 explicit BlinkPlatformImpl(Application* app); | |
24 | |
25 // blink::Platform methods: | |
26 virtual blink::WebMimeRegistry* mimeRegistry() OVERRIDE; | |
jamesr
2014/06/20 05:58:08
please don't annotate with OVERRIDE - you'll make
| |
27 virtual blink::WebThemeEngine* themeEngine() OVERRIDE; | |
28 virtual blink::WebString defaultLocale() OVERRIDE; | |
29 virtual double currentTime() OVERRIDE; | |
30 virtual double monotonicallyIncreasingTime() OVERRIDE; | |
31 virtual void cryptographicallyRandomValues( | |
32 unsigned char* buffer, size_t length) OVERRIDE; | |
33 virtual void setSharedTimerFiredFunction(void (*func)()); | |
34 virtual void setSharedTimerFireInterval(double interval_seconds); | |
35 virtual void stopSharedTimer(); | |
36 virtual void callOnMainThread(void (*func)(void*), void* context); | |
37 virtual blink::WebURLLoader* createURLLoader() OVERRIDE; | |
38 virtual blink::WebString userAgent() OVERRIDE; | |
39 virtual blink::WebData parseDataURL( | |
40 const blink::WebURL& url, blink::WebString& mime_type, | |
41 blink::WebString& charset) OVERRIDE; | |
42 virtual blink::WebURLError cancelledError(const blink::WebURL& url) const | |
43 OVERRIDE; | |
44 virtual blink::WebThread* createThread(const char* name); | |
45 virtual blink::WebThread* currentThread(); | |
46 virtual blink::WebWaitableEvent* createWaitableEvent(); | |
47 virtual blink::WebWaitableEvent* waitMultipleEvents( | |
48 const blink::WebVector<blink::WebWaitableEvent*>& events); | |
49 virtual const unsigned char* getTraceCategoryEnabledFlag( | |
50 const char* category_name) OVERRIDE; | |
51 | |
52 private: | |
53 void SuspendSharedTimer(); | |
54 void ResumeSharedTimer(); | |
55 | |
56 void DoTimeout() { | |
57 if (shared_timer_func_ && !shared_timer_suspended_) | |
58 shared_timer_func_(); | |
59 } | |
60 | |
61 static void DestroyCurrentThread(void*); | |
62 | |
63 NetworkServicePtr network_service_; | |
64 base::MessageLoop* main_loop_; | |
65 base::OneShotTimer<BlinkPlatformImpl> shared_timer_; | |
66 void (*shared_timer_func_)(); | |
67 double shared_timer_fire_time_; | |
68 bool shared_timer_fire_time_was_set_while_suspended_; | |
69 int shared_timer_suspended_; // counter | |
70 base::ThreadLocalStorage::Slot current_thread_slot_; | |
71 blink::WebThemeEngine dummy_theme_engine_; | |
72 WebMimeRegistryImpl mime_registry_; | |
73 }; | |
74 | |
75 } // namespace examples | |
76 } // namespace mojo | |
77 | |
78 #endif // MOJO_EXAMPLE_HTML_VIEWER_BLINK_PLATFORM_IMPL_H_ | |
OLD | NEW |