Revert "Reland c91b178b07b0d - Delete dead signin code (SigninGlobalError)"
[chromium-blink-merge.git] / components / html_viewer / blink_platform_impl.h
blobe55fe1629169b03a2b88665d6e8e3194efe8c356
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.
5 #ifndef COMPONENTS_HTML_VIEWER_BLINK_PLATFORM_IMPL_H_
6 #define COMPONENTS_HTML_VIEWER_BLINK_PLATFORM_IMPL_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "base/threading/thread_local_storage.h"
10 #include "base/timer/timer.h"
11 #include "cc/blink/web_compositor_support_impl.h"
12 #include "components/html_viewer/mock_web_blob_registry_impl.h"
13 #include "components/html_viewer/web_mime_registry_impl.h"
14 #include "components/html_viewer/web_notification_manager_impl.h"
15 #include "components/html_viewer/web_theme_engine_impl.h"
16 #include "components/webcrypto/webcrypto_impl.h"
17 #include "mojo/services/network/public/interfaces/url_loader_factory.mojom.h"
18 #include "mojo/services/network/public/interfaces/web_socket_factory.mojom.h"
19 #include "third_party/WebKit/public/platform/Platform.h"
20 #include "third_party/WebKit/public/platform/WebScrollbarBehavior.h"
22 namespace scheduler {
23 class RendererScheduler;
24 class WebThreadImplForRendererScheduler;
27 namespace mojo {
28 class ApplicationImpl;
31 namespace html_viewer {
33 class WebClipboardImpl;
34 class WebCookieJarImpl;
36 class BlinkPlatformImpl : public blink::Platform {
37 public:
38 // |app| may be null in tests.
39 BlinkPlatformImpl(mojo::ApplicationImpl* app,
40 scheduler::RendererScheduler* renderer_scheduler);
41 virtual ~BlinkPlatformImpl();
43 // blink::Platform methods:
44 virtual blink::WebCookieJar* cookieJar();
45 virtual blink::WebClipboard* clipboard();
46 virtual blink::WebMimeRegistry* mimeRegistry();
47 virtual blink::WebThemeEngine* themeEngine();
48 virtual blink::WebString defaultLocale();
49 virtual blink::WebBlobRegistry* blobRegistry();
50 virtual double currentTime();
51 virtual double monotonicallyIncreasingTime();
52 virtual void cryptographicallyRandomValues(unsigned char* buffer,
53 size_t length);
54 virtual bool isThreadedCompositingEnabled();
55 virtual blink::WebCompositorSupport* compositorSupport();
56 uint32_t getUniqueIdForProcess() override;
57 void createMessageChannel(blink::WebMessagePortChannel** channel1,
58 blink::WebMessagePortChannel** channel2) override;
59 virtual blink::WebURLLoader* createURLLoader();
60 virtual blink::WebSocketHandle* createWebSocketHandle();
61 virtual blink::WebString userAgent();
62 virtual blink::WebData parseDataURL(
63 const blink::WebURL& url, blink::WebString& mime_type,
64 blink::WebString& charset);
65 virtual bool isReservedIPAddress(const blink::WebString& host) const;
66 virtual blink::WebURLError cancelledError(const blink::WebURL& url) const;
67 virtual blink::WebThread* createThread(const char* name);
68 virtual blink::WebThread* currentThread();
69 virtual void yieldCurrentThread();
70 virtual blink::WebWaitableEvent* createWaitableEvent(
71 blink::WebWaitableEvent::ResetPolicy policy,
72 blink::WebWaitableEvent::InitialState state);
73 virtual blink::WebWaitableEvent* waitMultipleEvents(
74 const blink::WebVector<blink::WebWaitableEvent*>& events);
75 virtual blink::WebScrollbarBehavior* scrollbarBehavior();
76 virtual const unsigned char* getTraceCategoryEnabledFlag(
77 const char* category_name);
78 virtual blink::WebData loadResource(const char* name);
79 virtual blink::WebGestureCurve* createFlingAnimationCurve(
80 blink::WebGestureDevice device_source,
81 const blink::WebFloatPoint& velocity,
82 const blink::WebSize& cumulative_scroll);
83 virtual blink::WebCrypto* crypto();
84 virtual blink::WebNotificationManager* notificationManager();
86 private:
87 void UpdateWebThreadTLS(blink::WebThread* thread);
89 static void DestroyCurrentThread(void*);
91 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
92 scoped_ptr<scheduler::WebThreadImplForRendererScheduler> main_thread_;
93 base::ThreadLocalStorage::Slot current_thread_slot_;
94 cc_blink::WebCompositorSupportImpl compositor_support_;
95 WebThemeEngineImpl theme_engine_;
96 WebMimeRegistryImpl mime_registry_;
97 webcrypto::WebCryptoImpl web_crypto_;
98 WebNotificationManagerImpl web_notification_manager_;
99 blink::WebScrollbarBehavior scrollbar_behavior_;
100 mojo::WebSocketFactoryPtr web_socket_factory_;
101 mojo::URLLoaderFactoryPtr url_loader_factory_;
102 MockWebBlobRegistryImpl blob_registry_;
103 scoped_ptr<WebCookieJarImpl> cookie_jar_;
104 scoped_ptr<WebClipboardImpl> clipboard_;
106 DISALLOW_COPY_AND_ASSIGN(BlinkPlatformImpl);
109 } // namespace html_viewer
111 #endif // COMPONENTS_HTML_VIEWER_BLINK_PLATFORM_IMPL_H_