| 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 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "components/html_viewer/web_cookie_jar_impl.h" | 21 #include "components/html_viewer/web_cookie_jar_impl.h" |
| 22 #include "components/html_viewer/web_graphics_context_3d_command_buffer_impl.h" | 22 #include "components/html_viewer/web_graphics_context_3d_command_buffer_impl.h" |
| 23 #include "components/html_viewer/web_socket_handle_impl.h" | 23 #include "components/html_viewer/web_socket_handle_impl.h" |
| 24 #include "components/html_viewer/web_url_loader_impl.h" | 24 #include "components/html_viewer/web_url_loader_impl.h" |
| 25 #include "components/message_port/web_message_port_channel_impl.h" | 25 #include "components/message_port/web_message_port_channel_impl.h" |
| 26 #include "components/mime_util/mime_util.h" | 26 #include "components/mime_util/mime_util.h" |
| 27 #include "components/scheduler/child/webthread_impl_for_worker_scheduler.h" | 27 #include "components/scheduler/child/webthread_impl_for_worker_scheduler.h" |
| 28 #include "components/scheduler/renderer/renderer_scheduler.h" | 28 #include "components/scheduler/renderer/renderer_scheduler.h" |
| 29 #include "components/scheduler/renderer/webthread_impl_for_renderer_scheduler.h" | 29 #include "components/scheduler/renderer/webthread_impl_for_renderer_scheduler.h" |
| 30 #include "mojo/common/user_agent.h" | 30 #include "mojo/common/user_agent.h" |
| 31 #include "mojo/shell/public/cpp/application_impl.h" | 31 #include "mojo/shell/public/cpp/shell.h" |
| 32 #include "mojo/shell/public/cpp/connect.h" | |
| 33 #include "net/base/data_url.h" | 32 #include "net/base/data_url.h" |
| 34 #include "net/base/ip_address_number.h" | 33 #include "net/base/ip_address_number.h" |
| 35 #include "net/base/net_errors.h" | 34 #include "net/base/net_errors.h" |
| 36 #include "net/base/net_util.h" | 35 #include "net/base/net_util.h" |
| 37 #include "third_party/WebKit/public/platform/URLConversion.h" | 36 #include "third_party/WebKit/public/platform/URLConversion.h" |
| 38 #include "third_party/WebKit/public/platform/WebWaitableEvent.h" | 37 #include "third_party/WebKit/public/platform/WebWaitableEvent.h" |
| 39 #include "ui/base/resource/resource_bundle.h" | 38 #include "ui/base/resource/resource_bundle.h" |
| 40 #include "ui/events/gestures/blink/web_gesture_curve_impl.h" | 39 #include "ui/events/gestures/blink/web_gesture_curve_impl.h" |
| 41 #include "url/gurl.h" | 40 #include "url/gurl.h" |
| 42 | 41 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 65 | 64 |
| 66 private: | 65 private: |
| 67 scoped_ptr<base::WaitableEvent> impl_; | 66 scoped_ptr<base::WaitableEvent> impl_; |
| 68 DISALLOW_COPY_AND_ASSIGN(WebWaitableEventImpl); | 67 DISALLOW_COPY_AND_ASSIGN(WebWaitableEventImpl); |
| 69 }; | 68 }; |
| 70 | 69 |
| 71 } // namespace | 70 } // namespace |
| 72 | 71 |
| 73 BlinkPlatformImpl::BlinkPlatformImpl( | 72 BlinkPlatformImpl::BlinkPlatformImpl( |
| 74 GlobalState* global_state, | 73 GlobalState* global_state, |
| 75 mojo::ApplicationImpl* app, | 74 mojo::Shell* shell, |
| 76 scheduler::RendererScheduler* renderer_scheduler) | 75 scheduler::RendererScheduler* renderer_scheduler) |
| 77 : global_state_(global_state), | 76 : global_state_(global_state), |
| 78 app_(app), | 77 shell_(shell), |
| 79 main_thread_task_runner_(renderer_scheduler->DefaultTaskRunner()), | 78 main_thread_task_runner_(renderer_scheduler->DefaultTaskRunner()), |
| 80 main_thread_(renderer_scheduler->CreateMainThread()) { | 79 main_thread_(renderer_scheduler->CreateMainThread()) { |
| 81 if (app) { | 80 if (shell) { |
| 82 scoped_ptr<mojo::ApplicationConnection> connection = | 81 scoped_ptr<mojo::ApplicationConnection> connection = |
| 83 app->ConnectToApplication("mojo:network_service"); | 82 shell->ConnectToApplication("mojo:network_service"); |
| 84 connection->ConnectToService(&web_socket_factory_); | 83 connection->ConnectToService(&web_socket_factory_); |
| 85 connection->ConnectToService(&url_loader_factory_); | 84 connection->ConnectToService(&url_loader_factory_); |
| 86 | 85 |
| 87 mojo::CookieStorePtr cookie_store; | 86 mojo::CookieStorePtr cookie_store; |
| 88 connection->ConnectToService(&cookie_store); | 87 connection->ConnectToService(&cookie_store); |
| 89 cookie_jar_.reset(new WebCookieJarImpl(std::move(cookie_store))); | 88 cookie_jar_.reset(new WebCookieJarImpl(std::move(cookie_store))); |
| 90 | 89 |
| 91 mojo::ClipboardPtr clipboard; | 90 mojo::ClipboardPtr clipboard; |
| 92 app->ConnectToService("mojo:clipboard", &clipboard); | 91 shell->ConnectToService("mojo:clipboard", &clipboard); |
| 93 clipboard_.reset(new WebClipboardImpl(std::move(clipboard))); | 92 clipboard_.reset(new WebClipboardImpl(std::move(clipboard))); |
| 94 } | 93 } |
| 95 } | 94 } |
| 96 | 95 |
| 97 BlinkPlatformImpl::~BlinkPlatformImpl() { | 96 BlinkPlatformImpl::~BlinkPlatformImpl() { |
| 98 } | 97 } |
| 99 | 98 |
| 100 blink::WebCookieJar* BlinkPlatformImpl::cookieJar() { | 99 blink::WebCookieJar* BlinkPlatformImpl::cookieJar() { |
| 101 return cookie_jar_.get(); | 100 return cookie_jar_.get(); |
| 102 } | 101 } |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 blink::WebGraphicsContext3D* share_context) { | 159 blink::WebGraphicsContext3D* share_context) { |
| 161 blink::WebGraphicsContext3D::WebGraphicsInfo gl_info; | 160 blink::WebGraphicsContext3D::WebGraphicsInfo gl_info; |
| 162 return createOffscreenGraphicsContext3D(attributes, share_context, &gl_info); | 161 return createOffscreenGraphicsContext3D(attributes, share_context, &gl_info); |
| 163 } | 162 } |
| 164 | 163 |
| 165 blink::WebGraphicsContext3D* | 164 blink::WebGraphicsContext3D* |
| 166 BlinkPlatformImpl::createOffscreenGraphicsContext3D( | 165 BlinkPlatformImpl::createOffscreenGraphicsContext3D( |
| 167 const blink::WebGraphicsContext3D::Attributes& attributes, | 166 const blink::WebGraphicsContext3D::Attributes& attributes, |
| 168 blink::WebGraphicsContext3D* share_context, | 167 blink::WebGraphicsContext3D* share_context, |
| 169 blink::WebGraphicsContext3D::WebGraphicsInfo* gl_info) { | 168 blink::WebGraphicsContext3D::WebGraphicsInfo* gl_info) { |
| 170 // TODO(penghuang): Use the app from the right HTMLDocument. | 169 // TODO(penghuang): Use the shell from the right HTMLDocument. |
| 171 return WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( | 170 return WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( |
| 172 global_state_, app_, blink::WebStringToGURL(attributes.topDocumentURL), | 171 global_state_, shell_, blink::WebStringToGURL(attributes.topDocumentURL), |
| 173 attributes, share_context, gl_info); | 172 attributes, share_context, gl_info); |
| 174 } | 173 } |
| 175 | 174 |
| 176 blink::WebGraphicsContext3D* | 175 blink::WebGraphicsContext3D* |
| 177 BlinkPlatformImpl::createOffscreenGraphicsContext3D( | 176 BlinkPlatformImpl::createOffscreenGraphicsContext3D( |
| 178 const blink::WebGraphicsContext3D::Attributes& attributes) { | 177 const blink::WebGraphicsContext3D::Attributes& attributes) { |
| 179 return createOffscreenGraphicsContext3D(attributes, nullptr, nullptr); | 178 return createOffscreenGraphicsContext3D(attributes, nullptr, nullptr); |
| 180 } | 179 } |
| 181 | 180 |
| 182 blink::WebGraphicsContext3DProvider* | 181 blink::WebGraphicsContext3DProvider* |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 BlinkPlatformImpl::notificationManager() { | 301 BlinkPlatformImpl::notificationManager() { |
| 303 return &web_notification_manager_; | 302 return &web_notification_manager_; |
| 304 } | 303 } |
| 305 | 304 |
| 306 void BlinkPlatformImpl::UpdateWebThreadTLS(blink::WebThread* thread) { | 305 void BlinkPlatformImpl::UpdateWebThreadTLS(blink::WebThread* thread) { |
| 307 DCHECK(!current_thread_slot_.Get()); | 306 DCHECK(!current_thread_slot_.Get()); |
| 308 current_thread_slot_.Set(thread); | 307 current_thread_slot_.Set(thread); |
| 309 } | 308 } |
| 310 | 309 |
| 311 } // namespace html_viewer | 310 } // namespace html_viewer |
| OLD | NEW |