OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "mojo/services/html_viewer/blink_platform_impl.h" | 5 #include "mojo/services/html_viewer/blink_platform_impl.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
11 #include "base/synchronization/waitable_event.h" | 11 #include "base/synchronization/waitable_event.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "mojo/public/cpp/application/application_impl.h" | 13 #include "mojo/public/cpp/application/application_impl.h" |
14 #include "mojo/services/html_viewer/webclipboard_impl.h" | |
15 #include "mojo/services/html_viewer/webcookiejar_impl.h" | 14 #include "mojo/services/html_viewer/webcookiejar_impl.h" |
16 #include "mojo/services/html_viewer/websockethandle_impl.h" | 15 #include "mojo/services/html_viewer/websockethandle_impl.h" |
17 #include "mojo/services/html_viewer/webthread_impl.h" | 16 #include "mojo/services/html_viewer/webthread_impl.h" |
18 #include "mojo/services/html_viewer/weburlloader_impl.h" | 17 #include "mojo/services/html_viewer/weburlloader_impl.h" |
19 #include "net/base/data_url.h" | 18 #include "net/base/data_url.h" |
20 #include "net/base/mime_util.h" | 19 #include "net/base/mime_util.h" |
21 #include "net/base/net_errors.h" | 20 #include "net/base/net_errors.h" |
22 #include "third_party/WebKit/public/platform/WebWaitableEvent.h" | 21 #include "third_party/WebKit/public/platform/WebWaitableEvent.h" |
23 | 22 |
24 namespace mojo { | 23 namespace mojo { |
(...skipping 28 matching lines...) Expand all Loading... |
53 shared_timer_func_(NULL), | 52 shared_timer_func_(NULL), |
54 shared_timer_fire_time_(0.0), | 53 shared_timer_fire_time_(0.0), |
55 shared_timer_fire_time_was_set_while_suspended_(false), | 54 shared_timer_fire_time_was_set_while_suspended_(false), |
56 shared_timer_suspended_(0), | 55 shared_timer_suspended_(0), |
57 current_thread_slot_(&DestroyCurrentThread) { | 56 current_thread_slot_(&DestroyCurrentThread) { |
58 app->ConnectToService("mojo:mojo_network_service", &network_service_); | 57 app->ConnectToService("mojo:mojo_network_service", &network_service_); |
59 | 58 |
60 CookieStorePtr cookie_store; | 59 CookieStorePtr cookie_store; |
61 network_service_->GetCookieStore(Get(&cookie_store)); | 60 network_service_->GetCookieStore(Get(&cookie_store)); |
62 cookie_jar_.reset(new WebCookieJarImpl(cookie_store.Pass())); | 61 cookie_jar_.reset(new WebCookieJarImpl(cookie_store.Pass())); |
63 | |
64 ClipboardPtr clipboard; | |
65 app->ConnectToService("mojo:mojo_clipboard", &clipboard); | |
66 clipboard_.reset(new WebClipboardImpl(clipboard.Pass())); | |
67 } | 62 } |
68 | 63 |
69 BlinkPlatformImpl::~BlinkPlatformImpl() { | 64 BlinkPlatformImpl::~BlinkPlatformImpl() { |
70 } | 65 } |
71 | 66 |
72 blink::WebCookieJar* BlinkPlatformImpl::cookieJar() { | 67 blink::WebCookieJar* BlinkPlatformImpl::cookieJar() { |
73 return cookie_jar_.get(); | 68 return cookie_jar_.get(); |
74 } | 69 } |
75 | 70 |
76 blink::WebClipboard* BlinkPlatformImpl::clipboard() { | |
77 return clipboard_.get(); | |
78 } | |
79 | |
80 blink::WebMimeRegistry* BlinkPlatformImpl::mimeRegistry() { | 71 blink::WebMimeRegistry* BlinkPlatformImpl::mimeRegistry() { |
81 return &mime_registry_; | 72 return &mime_registry_; |
82 } | 73 } |
83 | 74 |
84 blink::WebThemeEngine* BlinkPlatformImpl::themeEngine() { | 75 blink::WebThemeEngine* BlinkPlatformImpl::themeEngine() { |
85 return &theme_engine_; | 76 return &theme_engine_; |
86 } | 77 } |
87 | 78 |
88 blink::WebString BlinkPlatformImpl::defaultLocale() { | 79 blink::WebString BlinkPlatformImpl::defaultLocale() { |
89 return blink::WebString::fromUTF8("en-US"); | 80 return blink::WebString::fromUTF8("en-US"); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 } | 228 } |
238 | 229 |
239 // static | 230 // static |
240 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) { | 231 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) { |
241 WebThreadImplForMessageLoop* impl = | 232 WebThreadImplForMessageLoop* impl = |
242 static_cast<WebThreadImplForMessageLoop*>(thread); | 233 static_cast<WebThreadImplForMessageLoop*>(thread); |
243 delete impl; | 234 delete impl; |
244 } | 235 } |
245 | 236 |
246 } // namespace mojo | 237 } // namespace mojo |
OLD | NEW |