| 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 COMPONENTS_HTML_VIEWER_BLINK_PLATFORM_IMPL_H_ | |
| 6 #define COMPONENTS_HTML_VIEWER_BLINK_PLATFORM_IMPL_H_ | |
| 7 | |
| 8 #include <stddef.h> | |
| 9 #include <stdint.h> | |
| 10 | |
| 11 #include "base/macros.h" | |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "base/threading/thread_local_storage.h" | |
| 14 #include "base/timer/timer.h" | |
| 15 #include "cc/blink/web_compositor_support_impl.h" | |
| 16 #include "components/html_viewer/mock_web_blob_registry_impl.h" | |
| 17 #include "components/html_viewer/web_mime_registry_impl.h" | |
| 18 #include "components/html_viewer/web_notification_manager_impl.h" | |
| 19 #include "components/html_viewer/web_theme_engine_impl.h" | |
| 20 #include "components/webcrypto/webcrypto_impl.h" | |
| 21 #include "mojo/services/network/public/interfaces/url_loader_factory.mojom.h" | |
| 22 #include "mojo/services/network/public/interfaces/web_socket_factory.mojom.h" | |
| 23 #include "third_party/WebKit/public/platform/Platform.h" | |
| 24 #include "third_party/WebKit/public/platform/WebScrollbarBehavior.h" | |
| 25 | |
| 26 namespace mojo { | |
| 27 class Shell; | |
| 28 } | |
| 29 | |
| 30 namespace scheduler { | |
| 31 class RendererScheduler; | |
| 32 class WebThreadImplForRendererScheduler; | |
| 33 } | |
| 34 | |
| 35 namespace html_viewer { | |
| 36 | |
| 37 class GlobalState; | |
| 38 class WebClipboardImpl; | |
| 39 class WebCookieJarImpl; | |
| 40 | |
| 41 class BlinkPlatformImpl : public blink::Platform { | |
| 42 public: | |
| 43 // |shell| may be null in tests. | |
| 44 BlinkPlatformImpl(GlobalState* global_state, | |
| 45 mojo::Shell* shell, | |
| 46 scheduler::RendererScheduler* renderer_scheduler); | |
| 47 ~BlinkPlatformImpl() override; | |
| 48 | |
| 49 // blink::Platform methods: | |
| 50 blink::WebCookieJar* cookieJar() override; | |
| 51 blink::WebClipboard* clipboard() override; | |
| 52 blink::WebMimeRegistry* mimeRegistry() override; | |
| 53 blink::WebThemeEngine* themeEngine() override; | |
| 54 blink::WebString defaultLocale() override; | |
| 55 blink::WebBlobRegistry* blobRegistry() override; | |
| 56 double currentTimeSeconds() override; | |
| 57 double monotonicallyIncreasingTimeSeconds() override; | |
| 58 bool isThreadedCompositingEnabled() override; | |
| 59 blink::WebCompositorSupport* compositorSupport() override; | |
| 60 uint32_t getUniqueIdForProcess() override; | |
| 61 void createMessageChannel(blink::WebMessagePortChannel** channel1, | |
| 62 blink::WebMessagePortChannel** channel2) override; | |
| 63 blink::WebURLLoader* createURLLoader() override; | |
| 64 blink::WebSocketHandle* createWebSocketHandle() override; | |
| 65 blink::WebString userAgent() override; | |
| 66 blink::WebData parseDataURL(const blink::WebURL& url, | |
| 67 blink::WebString& mime_type, | |
| 68 blink::WebString& charset) override; | |
| 69 bool isReservedIPAddress(const blink::WebString& host) const override; | |
| 70 blink::WebURLError cancelledError(const blink::WebURL& url) const override; | |
| 71 blink::WebThread* createThread(const char* name) override; | |
| 72 blink::WebThread* currentThread() override; | |
| 73 void yieldCurrentThread() override; | |
| 74 blink::WebWaitableEvent* createWaitableEvent( | |
| 75 blink::WebWaitableEvent::ResetPolicy policy, | |
| 76 blink::WebWaitableEvent::InitialState state) override; | |
| 77 blink::WebWaitableEvent* waitMultipleEvents( | |
| 78 const blink::WebVector<blink::WebWaitableEvent*>& events) override; | |
| 79 blink::WebScrollbarBehavior* scrollbarBehavior() override; | |
| 80 blink::WebGraphicsContext3D* createOffscreenGraphicsContext3D( | |
| 81 const blink::WebGraphicsContext3D::Attributes& attributes, | |
| 82 blink::WebGraphicsContext3D* share_context) override; | |
| 83 blink::WebGraphicsContext3D* createOffscreenGraphicsContext3D( | |
| 84 const blink::WebGraphicsContext3D::Attributes& attributes, | |
| 85 blink::WebGraphicsContext3D* share_context, | |
| 86 blink::WebGraphicsContext3D::WebGraphicsInfo* gl_info) override; | |
| 87 blink::WebGraphicsContext3D* createOffscreenGraphicsContext3D( | |
| 88 const blink::WebGraphicsContext3D::Attributes& attributes) override; | |
| 89 blink::WebGraphicsContext3DProvider* | |
| 90 createSharedOffscreenGraphicsContext3DProvider() override; | |
| 91 blink::WebData loadResource(const char* name) override; | |
| 92 blink::WebGestureCurve* createFlingAnimationCurve( | |
| 93 blink::WebGestureDevice device_source, | |
| 94 const blink::WebFloatPoint& velocity, | |
| 95 const blink::WebSize& cumulative_scroll) override; | |
| 96 blink::WebCrypto* crypto() override; | |
| 97 blink::WebNotificationManager* notificationManager() override; | |
| 98 | |
| 99 private: | |
| 100 void UpdateWebThreadTLS(blink::WebThread* thread); | |
| 101 | |
| 102 static void DestroyCurrentThread(void*); | |
| 103 | |
| 104 GlobalState* global_state_; | |
| 105 mojo::Shell* shell_; | |
| 106 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; | |
| 107 scoped_ptr<blink::WebThread> main_thread_; | |
| 108 base::ThreadLocalStorage::Slot current_thread_slot_; | |
| 109 cc_blink::WebCompositorSupportImpl compositor_support_; | |
| 110 WebThemeEngineImpl theme_engine_; | |
| 111 WebMimeRegistryImpl mime_registry_; | |
| 112 webcrypto::WebCryptoImpl web_crypto_; | |
| 113 WebNotificationManagerImpl web_notification_manager_; | |
| 114 blink::WebScrollbarBehavior scrollbar_behavior_; | |
| 115 mojo::WebSocketFactoryPtr web_socket_factory_; | |
| 116 mojo::URLLoaderFactoryPtr url_loader_factory_; | |
| 117 MockWebBlobRegistryImpl blob_registry_; | |
| 118 scoped_ptr<WebCookieJarImpl> cookie_jar_; | |
| 119 scoped_ptr<WebClipboardImpl> clipboard_; | |
| 120 | |
| 121 DISALLOW_COPY_AND_ASSIGN(BlinkPlatformImpl); | |
| 122 }; | |
| 123 | |
| 124 } // namespace html_viewer | |
| 125 | |
| 126 #endif // COMPONENTS_HTML_VIEWER_BLINK_PLATFORM_IMPL_H_ | |
| OLD | NEW |