| 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 "components/html_viewer/blink_platform_impl.h" | 5 #include "components/html_viewer/blink_platform_impl.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
| 11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
| 12 #include "base/synchronization/waitable_event.h" | 12 #include "base/synchronization/waitable_event.h" |
| 13 #include "base/threading/platform_thread.h" | 13 #include "base/threading/platform_thread.h" |
| 14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 15 #include "components/html_viewer/blink_resource_constants.h" | 15 #include "components/html_viewer/blink_resource_constants.h" |
| 16 #include "components/html_viewer/web_clipboard_impl.h" | 16 #include "components/html_viewer/web_clipboard_impl.h" |
| 17 #include "components/html_viewer/web_cookie_jar_impl.h" | 17 #include "components/html_viewer/web_cookie_jar_impl.h" |
| 18 #include "components/html_viewer/web_message_port_channel_impl.h" | 18 #include "components/html_viewer/web_message_port_channel_impl.h" |
| 19 #include "components/html_viewer/web_socket_handle_impl.h" | 19 #include "components/html_viewer/web_socket_handle_impl.h" |
| 20 #include "components/html_viewer/web_thread_impl.h" | 20 #include "components/html_viewer/web_thread_impl.h" |
| 21 #include "components/html_viewer/web_url_loader_impl.h" | 21 #include "components/html_viewer/web_url_loader_impl.h" |
| 22 #include "net/base/data_url.h" | 22 #include "net/base/data_url.h" |
| 23 #include "net/base/mime_util.h" | 23 #include "net/base/mime_util.h" |
| 24 #include "net/base/net_errors.h" | 24 #include "net/base/net_errors.h" |
| 25 #include "net/base/net_util.h" | 25 #include "net/base/net_util.h" |
| 26 #include "third_party/WebKit/public/platform/WebWaitableEvent.h" | 26 #include "third_party/WebKit/public/platform/WebWaitableEvent.h" |
| 27 #include "third_party/mojo/src/mojo/public/cpp/application/application_impl.h" | 27 #include "third_party/mojo/src/mojo/public/cpp/application/application_impl.h" |
| 28 #include "third_party/mojo/src/mojo/public/cpp/application/connect.h" |
| 28 #include "ui/events/gestures/blink/web_gesture_curve_impl.h" | 29 #include "ui/events/gestures/blink/web_gesture_curve_impl.h" |
| 29 | 30 |
| 30 namespace html_viewer { | 31 namespace html_viewer { |
| 31 namespace { | 32 namespace { |
| 32 | 33 |
| 33 // Allows overriding user agent scring. | 34 // Allows overriding user agent scring. |
| 34 const char kUserAgentSwitch[] = "user-agent"; | 35 const char kUserAgentSwitch[] = "user-agent"; |
| 35 | 36 |
| 36 // TODO(darin): Figure out what our UA should really be. | 37 // TODO(darin): Figure out what our UA should really be. |
| 37 const char kDefaultUserAgentString[] = | 38 const char kDefaultUserAgentString[] = |
| (...skipping 27 matching lines...) Expand all Loading... |
| 65 shared_timer_suspended_(0), | 66 shared_timer_suspended_(0), |
| 66 current_thread_slot_(&DestroyCurrentThread), | 67 current_thread_slot_(&DestroyCurrentThread), |
| 67 scheduler_(main_loop_->message_loop_proxy()) { | 68 scheduler_(main_loop_->message_loop_proxy()) { |
| 68 if (app) { | 69 if (app) { |
| 69 app->ConnectToService("mojo:network_service", &network_service_); | 70 app->ConnectToService("mojo:network_service", &network_service_); |
| 70 | 71 |
| 71 mojo::CookieStorePtr cookie_store; | 72 mojo::CookieStorePtr cookie_store; |
| 72 network_service_->GetCookieStore(GetProxy(&cookie_store)); | 73 network_service_->GetCookieStore(GetProxy(&cookie_store)); |
| 73 cookie_jar_.reset(new WebCookieJarImpl(cookie_store.Pass())); | 74 cookie_jar_.reset(new WebCookieJarImpl(cookie_store.Pass())); |
| 74 | 75 |
| 76 mojo::ServiceProviderPtr service_provider; |
| 77 app->ConnectToService("mojo:core_services", &service_provider); |
| 75 mojo::ClipboardPtr clipboard; | 78 mojo::ClipboardPtr clipboard; |
| 76 app->ConnectToService("mojo:clipboard", &clipboard); | 79 mojo::ConnectToService(service_provider.get(), &clipboard); |
| 77 clipboard_.reset(new WebClipboardImpl(clipboard.Pass())); | 80 clipboard_.reset(new WebClipboardImpl(clipboard.Pass())); |
| 78 } | 81 } |
| 79 } | 82 } |
| 80 | 83 |
| 81 BlinkPlatformImpl::~BlinkPlatformImpl() { | 84 BlinkPlatformImpl::~BlinkPlatformImpl() { |
| 82 } | 85 } |
| 83 | 86 |
| 84 blink::WebCookieJar* BlinkPlatformImpl::cookieJar() { | 87 blink::WebCookieJar* BlinkPlatformImpl::cookieJar() { |
| 85 return cookie_jar_.get(); | 88 return cookie_jar_.get(); |
| 86 } | 89 } |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 } | 317 } |
| 315 | 318 |
| 316 // static | 319 // static |
| 317 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) { | 320 void BlinkPlatformImpl::DestroyCurrentThread(void* thread) { |
| 318 WebThreadImplForMessageLoop* impl = | 321 WebThreadImplForMessageLoop* impl = |
| 319 static_cast<WebThreadImplForMessageLoop*>(thread); | 322 static_cast<WebThreadImplForMessageLoop*>(thread); |
| 320 delete impl; | 323 delete impl; |
| 321 } | 324 } |
| 322 | 325 |
| 323 } // namespace html_viewer | 326 } // namespace html_viewer |
| OLD | NEW |