Chromium Code Reviews| Index: mojo/examples/html_viewer/blink_platform_impl.h |
| diff --git a/mojo/examples/html_viewer/blink_platform_impl.h b/mojo/examples/html_viewer/blink_platform_impl.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..60d9fb9d876fccda8a9060225623cb329bf8ad0d |
| --- /dev/null |
| +++ b/mojo/examples/html_viewer/blink_platform_impl.h |
| @@ -0,0 +1,78 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef MOJO_EXAMPLE_HTML_VIEWER_BLINK_PLATFORM_IMPL_H_ |
| +#define MOJO_EXAMPLE_HTML_VIEWER_BLINK_PLATFORM_IMPL_H_ |
| + |
| +#include "base/message_loop/message_loop.h" |
| +#include "base/threading/thread_local_storage.h" |
| +#include "base/timer/timer.h" |
| +#include "mojo/examples/html_viewer/webmimeregistry_impl.h" |
| +#include "mojo/services/public/interfaces/network/network_service.mojom.h" |
| +#include "third_party/WebKit/public/platform/Platform.h" |
| +#include "third_party/WebKit/public/platform/WebThemeEngine.h" |
| + |
| +namespace mojo { |
| +class Application; |
| + |
| +namespace examples { |
| + |
| +class BlinkPlatformImpl : public blink::Platform { |
| + public: |
| + explicit BlinkPlatformImpl(Application* app); |
| + |
| + // blink::Platform methods: |
| + virtual blink::WebMimeRegistry* mimeRegistry() OVERRIDE; |
|
jamesr
2014/06/20 05:58:08
please don't annotate with OVERRIDE - you'll make
|
| + virtual blink::WebThemeEngine* themeEngine() OVERRIDE; |
| + virtual blink::WebString defaultLocale() OVERRIDE; |
| + virtual double currentTime() OVERRIDE; |
| + virtual double monotonicallyIncreasingTime() OVERRIDE; |
| + virtual void cryptographicallyRandomValues( |
| + unsigned char* buffer, size_t length) OVERRIDE; |
| + virtual void setSharedTimerFiredFunction(void (*func)()); |
| + virtual void setSharedTimerFireInterval(double interval_seconds); |
| + virtual void stopSharedTimer(); |
| + virtual void callOnMainThread(void (*func)(void*), void* context); |
| + virtual blink::WebURLLoader* createURLLoader() OVERRIDE; |
| + virtual blink::WebString userAgent() OVERRIDE; |
| + virtual blink::WebData parseDataURL( |
| + const blink::WebURL& url, blink::WebString& mime_type, |
| + blink::WebString& charset) OVERRIDE; |
| + virtual blink::WebURLError cancelledError(const blink::WebURL& url) const |
| + OVERRIDE; |
| + virtual blink::WebThread* createThread(const char* name); |
| + virtual blink::WebThread* currentThread(); |
| + virtual blink::WebWaitableEvent* createWaitableEvent(); |
| + virtual blink::WebWaitableEvent* waitMultipleEvents( |
| + const blink::WebVector<blink::WebWaitableEvent*>& events); |
| + virtual const unsigned char* getTraceCategoryEnabledFlag( |
| + const char* category_name) OVERRIDE; |
| + |
| + private: |
| + void SuspendSharedTimer(); |
| + void ResumeSharedTimer(); |
| + |
| + void DoTimeout() { |
| + if (shared_timer_func_ && !shared_timer_suspended_) |
| + shared_timer_func_(); |
| + } |
| + |
| + static void DestroyCurrentThread(void*); |
| + |
| + NetworkServicePtr network_service_; |
| + base::MessageLoop* main_loop_; |
| + base::OneShotTimer<BlinkPlatformImpl> shared_timer_; |
| + void (*shared_timer_func_)(); |
| + double shared_timer_fire_time_; |
| + bool shared_timer_fire_time_was_set_while_suspended_; |
| + int shared_timer_suspended_; // counter |
| + base::ThreadLocalStorage::Slot current_thread_slot_; |
| + blink::WebThemeEngine dummy_theme_engine_; |
| + WebMimeRegistryImpl mime_registry_; |
| +}; |
| + |
| +} // namespace examples |
| +} // namespace mojo |
| + |
| +#endif // MOJO_EXAMPLE_HTML_VIEWER_BLINK_PLATFORM_IMPL_H_ |