| 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" |
| 14 #include "mojo/services/html_viewer/webcookiejar_impl.h" | 15 #include "mojo/services/html_viewer/webcookiejar_impl.h" |
| 15 #include "mojo/services/html_viewer/websockethandle_impl.h" | 16 #include "mojo/services/html_viewer/websockethandle_impl.h" |
| 16 #include "mojo/services/html_viewer/webthread_impl.h" | 17 #include "mojo/services/html_viewer/webthread_impl.h" |
| 17 #include "mojo/services/html_viewer/weburlloader_impl.h" | 18 #include "mojo/services/html_viewer/weburlloader_impl.h" |
| 18 #include "net/base/data_url.h" | 19 #include "net/base/data_url.h" |
| 19 #include "net/base/mime_util.h" | 20 #include "net/base/mime_util.h" |
| 20 #include "net/base/net_errors.h" | 21 #include "net/base/net_errors.h" |
| 21 #include "third_party/WebKit/public/platform/WebWaitableEvent.h" | 22 #include "third_party/WebKit/public/platform/WebWaitableEvent.h" |
| 22 | 23 |
| 23 namespace mojo { | 24 namespace mojo { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 52 shared_timer_func_(NULL), | 53 shared_timer_func_(NULL), |
| 53 shared_timer_fire_time_(0.0), | 54 shared_timer_fire_time_(0.0), |
| 54 shared_timer_fire_time_was_set_while_suspended_(false), | 55 shared_timer_fire_time_was_set_while_suspended_(false), |
| 55 shared_timer_suspended_(0), | 56 shared_timer_suspended_(0), |
| 56 current_thread_slot_(&DestroyCurrentThread) { | 57 current_thread_slot_(&DestroyCurrentThread) { |
| 57 app->ConnectToService("mojo:mojo_network_service", &network_service_); | 58 app->ConnectToService("mojo:mojo_network_service", &network_service_); |
| 58 | 59 |
| 59 CookieStorePtr cookie_store; | 60 CookieStorePtr cookie_store; |
| 60 network_service_->GetCookieStore(Get(&cookie_store)); | 61 network_service_->GetCookieStore(Get(&cookie_store)); |
| 61 cookie_jar_.reset(new WebCookieJarImpl(cookie_store.Pass())); | 62 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())); |
| 62 } | 67 } |
| 63 | 68 |
| 64 BlinkPlatformImpl::~BlinkPlatformImpl() { | 69 BlinkPlatformImpl::~BlinkPlatformImpl() { |
| 65 } | 70 } |
| 66 | 71 |
| 67 blink::WebCookieJar* BlinkPlatformImpl::cookieJar() { | 72 blink::WebCookieJar* BlinkPlatformImpl::cookieJar() { |
| 68 return cookie_jar_.get(); | 73 return cookie_jar_.get(); |
| 69 } | 74 } |
| 70 | 75 |
| 76 blink::WebClipboard* BlinkPlatformImpl::clipboard() { |
| 77 return clipboard_.get(); |
| 78 } |
| 79 |
| 71 blink::WebMimeRegistry* BlinkPlatformImpl::mimeRegistry() { | 80 blink::WebMimeRegistry* BlinkPlatformImpl::mimeRegistry() { |
| 72 return &mime_registry_; | 81 return &mime_registry_; |
| 73 } | 82 } |
| 74 | 83 |
| 75 blink::WebThemeEngine* BlinkPlatformImpl::themeEngine() { | 84 blink::WebThemeEngine* BlinkPlatformImpl::themeEngine() { |
| 76 return &theme_engine_; | 85 return &theme_engine_; |
| 77 } | 86 } |
| 78 | 87 |
| 79 blink::WebString BlinkPlatformImpl::defaultLocale() { | 88 blink::WebString BlinkPlatformImpl::defaultLocale() { |
| 80 return blink::WebString::fromUTF8("en-US"); | 89 return blink::WebString::fromUTF8("en-US"); |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 } | 237 } |
| 229 | 238 |
| 230 // static | 239 // static |
| 231 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) { | 240 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) { |
| 232 WebThreadImplForMessageLoop* impl = | 241 WebThreadImplForMessageLoop* impl = |
| 233 static_cast<WebThreadImplForMessageLoop*>(thread); | 242 static_cast<WebThreadImplForMessageLoop*>(thread); |
| 234 delete impl; | 243 delete impl; |
| 235 } | 244 } |
| 236 | 245 |
| 237 } // namespace mojo | 246 } // namespace mojo |
| OLD | NEW |