[Media Router] Add integration tests and e2e tests for media router and presentation...
[chromium-blink-merge.git] / components / html_viewer / blink_platform_impl.h
blobb651e04cba05b3dd70f029706019eb1f64496c3b
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/blink_resource_map.h"
13 #include "components/html_viewer/mock_web_blob_registry_impl.h"
14 #include "components/html_viewer/web_mime_registry_impl.h"
15 #include "components/html_viewer/web_notification_manager_impl.h"
16 #include "components/html_viewer/web_theme_engine_impl.h"
17 #include "components/webcrypto/webcrypto_impl.h"
18 #include "mojo/services/network/public/interfaces/network_service.mojom.h"
19 #include "mojo/services/network/public/interfaces/url_loader_factory.mojom.h"
20 #include "third_party/WebKit/public/platform/Platform.h"
21 #include "third_party/WebKit/public/platform/WebScrollbarBehavior.h"
23 namespace scheduler {
24 class RendererScheduler;
25 class WebThreadImplForRendererScheduler;
28 namespace mojo {
29 class ApplicationImpl;
32 namespace html_viewer {
34 class WebClipboardImpl;
35 class WebCookieJarImpl;
37 class BlinkPlatformImpl : public blink::Platform {
38 public:
39 // |app| may be null in tests.
40 BlinkPlatformImpl(mojo::ApplicationImpl* app,
41 scheduler::RendererScheduler* renderer_scheduler);
42 virtual ~BlinkPlatformImpl();
44 // blink::Platform methods:
45 virtual blink::WebCookieJar* cookieJar();
46 virtual blink::WebClipboard* clipboard();
47 virtual blink::WebMimeRegistry* mimeRegistry();
48 virtual blink::WebThemeEngine* themeEngine();
49 virtual blink::WebString defaultLocale();
50 virtual blink::WebBlobRegistry* blobRegistry();
51 virtual double currentTime();
52 virtual double monotonicallyIncreasingTime();
53 virtual void cryptographicallyRandomValues(unsigned char* buffer,
54 size_t length);
55 virtual bool isThreadedCompositingEnabled();
56 virtual blink::WebCompositorSupport* compositorSupport();
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 virtual blink::WebWaitableEvent* waitMultipleEvents(
72 const blink::WebVector<blink::WebWaitableEvent*>& events);
73 virtual blink::WebScrollbarBehavior* scrollbarBehavior();
74 virtual const unsigned char* getTraceCategoryEnabledFlag(
75 const char* category_name);
76 virtual blink::WebData loadResource(const char* name);
77 virtual blink::WebGestureCurve* createFlingAnimationCurve(
78 blink::WebGestureDevice device_source,
79 const blink::WebFloatPoint& velocity,
80 const blink::WebSize& cumulative_scroll);
81 virtual blink::WebCrypto* crypto();
82 virtual blink::WebNotificationManager* notificationManager();
84 private:
85 void UpdateWebThreadTLS(blink::WebThread* thread);
87 static void DestroyCurrentThread(void*);
89 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
90 scoped_ptr<scheduler::WebThreadImplForRendererScheduler> main_thread_;
91 base::ThreadLocalStorage::Slot current_thread_slot_;
92 cc_blink::WebCompositorSupportImpl compositor_support_;
93 WebThemeEngineImpl theme_engine_;
94 WebMimeRegistryImpl mime_registry_;
95 webcrypto::WebCryptoImpl web_crypto_;
96 WebNotificationManagerImpl web_notification_manager_;
97 blink::WebScrollbarBehavior scrollbar_behavior_;
98 BlinkResourceMap blink_resource_map_;
99 mojo::NetworkServicePtr network_service_;
100 mojo::URLLoaderFactoryPtr url_loader_factory_;
101 MockWebBlobRegistryImpl blob_registry_;
102 scoped_ptr<WebCookieJarImpl> cookie_jar_;
103 scoped_ptr<WebClipboardImpl> clipboard_;
105 DISALLOW_COPY_AND_ASSIGN(BlinkPlatformImpl);
108 } // namespace html_viewer
110 #endif // COMPONENTS_HTML_VIEWER_BLINK_PLATFORM_IMPL_H_