| 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/webmimeregistry_impl.h" | 13 #include "mojo/services/html_viewer/webmimeregistry_impl.h" |
| 14 #include "mojo/services/html_viewer/webthemeengine_impl.h" | 14 #include "mojo/services/html_viewer/webthemeengine_impl.h" |
| 15 #include "mojo/services/public/interfaces/network/network_service.mojom.h" | |
| 16 #include "third_party/WebKit/public/platform/Platform.h" | 15 #include "third_party/WebKit/public/platform/Platform.h" |
| 17 #include "third_party/WebKit/public/platform/WebScrollbarBehavior.h" | 16 #include "third_party/WebKit/public/platform/WebScrollbarBehavior.h" |
| 18 | 17 |
| 19 namespace mojo { | 18 namespace mojo { |
| 20 class ApplicationImpl; | |
| 21 class WebClipboardImpl; | |
| 22 class WebCookieJarImpl; | |
| 23 | 19 |
| 24 class BlinkPlatformImpl : public blink::Platform { | 20 class BlinkPlatformImpl : public blink::Platform { |
| 25 public: | 21 public: |
| 26 explicit BlinkPlatformImpl(ApplicationImpl* app); | 22 explicit BlinkPlatformImpl(); |
| 27 virtual ~BlinkPlatformImpl(); | 23 virtual ~BlinkPlatformImpl(); |
| 28 | 24 |
| 29 // blink::Platform methods: | 25 // blink::Platform methods: |
| 30 virtual blink::WebCookieJar* cookieJar(); | |
| 31 virtual blink::WebClipboard* clipboard(); | |
| 32 virtual blink::WebMimeRegistry* mimeRegistry(); | 26 virtual blink::WebMimeRegistry* mimeRegistry(); |
| 33 virtual blink::WebThemeEngine* themeEngine(); | 27 virtual blink::WebThemeEngine* themeEngine(); |
| 34 virtual blink::WebString defaultLocale(); | 28 virtual blink::WebString defaultLocale(); |
| 35 virtual double currentTime(); | 29 virtual double currentTime(); |
| 36 virtual double monotonicallyIncreasingTime(); | 30 virtual double monotonicallyIncreasingTime(); |
| 37 virtual void cryptographicallyRandomValues( | 31 virtual void cryptographicallyRandomValues( |
| 38 unsigned char* buffer, size_t length); | 32 unsigned char* buffer, size_t length); |
| 39 virtual void setSharedTimerFiredFunction(void (*func)()); | 33 virtual void setSharedTimerFiredFunction(void (*func)()); |
| 40 virtual void setSharedTimerFireInterval(double interval_seconds); | 34 virtual void setSharedTimerFireInterval(double interval_seconds); |
| 41 virtual void stopSharedTimer(); | 35 virtual void stopSharedTimer(); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 63 void SuspendSharedTimer(); | 57 void SuspendSharedTimer(); |
| 64 void ResumeSharedTimer(); | 58 void ResumeSharedTimer(); |
| 65 | 59 |
| 66 void DoTimeout() { | 60 void DoTimeout() { |
| 67 if (shared_timer_func_ && !shared_timer_suspended_) | 61 if (shared_timer_func_ && !shared_timer_suspended_) |
| 68 shared_timer_func_(); | 62 shared_timer_func_(); |
| 69 } | 63 } |
| 70 | 64 |
| 71 static void DestroyCurrentThread(void*); | 65 static void DestroyCurrentThread(void*); |
| 72 | 66 |
| 73 NetworkServicePtr network_service_; | |
| 74 base::MessageLoop* main_loop_; | 67 base::MessageLoop* main_loop_; |
| 75 base::OneShotTimer<BlinkPlatformImpl> shared_timer_; | 68 base::OneShotTimer<BlinkPlatformImpl> shared_timer_; |
| 76 void (*shared_timer_func_)(); | 69 void (*shared_timer_func_)(); |
| 77 double shared_timer_fire_time_; | 70 double shared_timer_fire_time_; |
| 78 bool shared_timer_fire_time_was_set_while_suspended_; | 71 bool shared_timer_fire_time_was_set_while_suspended_; |
| 79 int shared_timer_suspended_; // counter | 72 int shared_timer_suspended_; // counter |
| 80 base::ThreadLocalStorage::Slot current_thread_slot_; | 73 base::ThreadLocalStorage::Slot current_thread_slot_; |
| 81 cc_blink::WebCompositorSupportImpl compositor_support_; | 74 cc_blink::WebCompositorSupportImpl compositor_support_; |
| 82 WebThemeEngineImpl theme_engine_; | 75 WebThemeEngineImpl theme_engine_; |
| 83 scoped_ptr<WebCookieJarImpl> cookie_jar_; | |
| 84 scoped_ptr<WebClipboardImpl> clipboard_; | |
| 85 WebMimeRegistryImpl mime_registry_; | 76 WebMimeRegistryImpl mime_registry_; |
| 86 blink::WebScrollbarBehavior scrollbar_behavior_; | 77 blink::WebScrollbarBehavior scrollbar_behavior_; |
| 87 | 78 |
| 88 DISALLOW_COPY_AND_ASSIGN(BlinkPlatformImpl); | 79 DISALLOW_COPY_AND_ASSIGN(BlinkPlatformImpl); |
| 89 }; | 80 }; |
| 90 | 81 |
| 91 } // namespace mojo | 82 } // namespace mojo |
| 92 | 83 |
| 93 #endif // MOJO_SERVICES_HTML_VIEWER_BLINK_PLATFORM_IMPL_H_ | 84 #endif // MOJO_SERVICES_HTML_VIEWER_BLINK_PLATFORM_IMPL_H_ |
| OLD | NEW |