Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(524)

Side by Side Diff: mojo/examples/html_viewer/blink_platform_impl.h

Issue 340453002: Mojo: HTML Viewer based on Blink. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix build Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « mojo/examples/html_viewer/DEPS ('k') | mojo/examples/html_viewer/blink_platform_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 MOJO_EXAMPLE_HTML_VIEWER_BLINK_PLATFORM_IMPL_H_
6 #define MOJO_EXAMPLE_HTML_VIEWER_BLINK_PLATFORM_IMPL_H_
7
8 #include "base/message_loop/message_loop.h"
9 #include "base/threading/thread_local_storage.h"
10 #include "base/timer/timer.h"
11 #include "mojo/examples/html_viewer/webmimeregistry_impl.h"
12 #include "mojo/services/public/interfaces/network/network_service.mojom.h"
13 #include "third_party/WebKit/public/platform/Platform.h"
14 #include "third_party/WebKit/public/platform/WebThemeEngine.h"
15
16 namespace mojo {
17 class Application;
18
19 namespace examples {
20
21 class BlinkPlatformImpl : public blink::Platform {
22 public:
23 explicit BlinkPlatformImpl(Application* app);
24 virtual ~BlinkPlatformImpl();
25
26 // blink::Platform methods:
27 virtual blink::WebMimeRegistry* mimeRegistry();
28 virtual blink::WebThemeEngine* themeEngine();
29 virtual blink::WebString defaultLocale();
30 virtual double currentTime();
31 virtual double monotonicallyIncreasingTime();
32 virtual void cryptographicallyRandomValues(
33 unsigned char* buffer, size_t length);
34 virtual void setSharedTimerFiredFunction(void (*func)());
35 virtual void setSharedTimerFireInterval(double interval_seconds);
36 virtual void stopSharedTimer();
37 virtual void callOnMainThread(void (*func)(void*), void* context);
38 virtual blink::WebURLLoader* createURLLoader();
39 virtual blink::WebString userAgent();
40 virtual blink::WebData parseDataURL(
41 const blink::WebURL& url, blink::WebString& mime_type,
42 blink::WebString& charset);
43 virtual blink::WebURLError cancelledError(const blink::WebURL& url) const;
44 virtual blink::WebThread* createThread(const char* name);
45 virtual blink::WebThread* currentThread();
46 virtual blink::WebWaitableEvent* createWaitableEvent();
47 virtual blink::WebWaitableEvent* waitMultipleEvents(
48 const blink::WebVector<blink::WebWaitableEvent*>& events);
49 virtual const unsigned char* getTraceCategoryEnabledFlag(
50 const char* category_name);
51
52 private:
53 void SuspendSharedTimer();
54 void ResumeSharedTimer();
55
56 void DoTimeout() {
57 if (shared_timer_func_ && !shared_timer_suspended_)
58 shared_timer_func_();
59 }
60
61 static void DestroyCurrentThread(void*);
62
63 NetworkServicePtr network_service_;
64 base::MessageLoop* main_loop_;
65 base::OneShotTimer<BlinkPlatformImpl> shared_timer_;
66 void (*shared_timer_func_)();
67 double shared_timer_fire_time_;
68 bool shared_timer_fire_time_was_set_while_suspended_;
69 int shared_timer_suspended_; // counter
70 base::ThreadLocalStorage::Slot current_thread_slot_;
71 blink::WebThemeEngine dummy_theme_engine_;
72 WebMimeRegistryImpl mime_registry_;
73 };
74
75 } // namespace examples
76 } // namespace mojo
77
78 #endif // MOJO_EXAMPLE_HTML_VIEWER_BLINK_PLATFORM_IMPL_H_
OLDNEW
« no previous file with comments | « mojo/examples/html_viewer/DEPS ('k') | mojo/examples/html_viewer/blink_platform_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698