| 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" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 mojo::ApplicationImpl* app, | 69 mojo::ApplicationImpl* app, |
| 70 scheduler::RendererScheduler* renderer_scheduler) | 70 scheduler::RendererScheduler* renderer_scheduler) |
| 71 : main_thread_task_runner_(renderer_scheduler->DefaultTaskRunner()), | 71 : main_thread_task_runner_(renderer_scheduler->DefaultTaskRunner()), |
| 72 main_thread_(new scheduler::WebThreadImplForRendererScheduler( | 72 main_thread_(new scheduler::WebThreadImplForRendererScheduler( |
| 73 renderer_scheduler)) { | 73 renderer_scheduler)) { |
| 74 if (app) { | 74 if (app) { |
| 75 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 75 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
| 76 request->url = mojo::String::From("mojo:network_service"); | 76 request->url = mojo::String::From("mojo:network_service"); |
| 77 scoped_ptr<mojo::ApplicationConnection> connection = | 77 scoped_ptr<mojo::ApplicationConnection> connection = |
| 78 app->ConnectToApplication(request.Pass()); | 78 app->ConnectToApplication(request.Pass()); |
| 79 connection->ConnectToService(&network_service_); | 79 connection->ConnectToService(&web_socket_factory_); |
| 80 connection->ConnectToService(&url_loader_factory_); | 80 connection->ConnectToService(&url_loader_factory_); |
| 81 | 81 |
| 82 mojo::CookieStorePtr cookie_store; | 82 mojo::CookieStorePtr cookie_store; |
| 83 network_service_->GetCookieStore(GetProxy(&cookie_store)); | 83 connection->ConnectToService(&cookie_store); |
| 84 cookie_jar_.reset(new WebCookieJarImpl(cookie_store.Pass())); | 84 cookie_jar_.reset(new WebCookieJarImpl(cookie_store.Pass())); |
| 85 | 85 |
| 86 mojo::ClipboardPtr clipboard; | 86 mojo::ClipboardPtr clipboard; |
| 87 mojo::URLRequestPtr request2(mojo::URLRequest::New()); | 87 mojo::URLRequestPtr request2(mojo::URLRequest::New()); |
| 88 request2->url = mojo::String::From("mojo:clipboard"); | 88 request2->url = mojo::String::From("mojo:clipboard"); |
| 89 app->ConnectToService(request2.Pass(), &clipboard); | 89 app->ConnectToService(request2.Pass(), &clipboard); |
| 90 clipboard_.reset(new WebClipboardImpl(clipboard.Pass())); | 90 clipboard_.reset(new WebClipboardImpl(clipboard.Pass())); |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 | 93 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 } | 173 } |
| 174 NOTREACHED() << "Requested resource is unavailable: " << resource; | 174 NOTREACHED() << "Requested resource is unavailable: " << resource; |
| 175 return blink::WebData(); | 175 return blink::WebData(); |
| 176 } | 176 } |
| 177 | 177 |
| 178 blink::WebURLLoader* BlinkPlatformImpl::createURLLoader() { | 178 blink::WebURLLoader* BlinkPlatformImpl::createURLLoader() { |
| 179 return new WebURLLoaderImpl(url_loader_factory_.get(), &blob_registry_); | 179 return new WebURLLoaderImpl(url_loader_factory_.get(), &blob_registry_); |
| 180 } | 180 } |
| 181 | 181 |
| 182 blink::WebSocketHandle* BlinkPlatformImpl::createWebSocketHandle() { | 182 blink::WebSocketHandle* BlinkPlatformImpl::createWebSocketHandle() { |
| 183 return new WebSocketHandleImpl(network_service_.get()); | 183 return new WebSocketHandleImpl(web_socket_factory_.get()); |
| 184 } | 184 } |
| 185 | 185 |
| 186 blink::WebString BlinkPlatformImpl::userAgent() { | 186 blink::WebString BlinkPlatformImpl::userAgent() { |
| 187 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 187 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 188 if (command_line->HasSwitch(kUserAgentSwitch)) { | 188 if (command_line->HasSwitch(kUserAgentSwitch)) { |
| 189 return blink::WebString::fromUTF8( | 189 return blink::WebString::fromUTF8( |
| 190 command_line->GetSwitchValueASCII(kUserAgentSwitch)); | 190 command_line->GetSwitchValueASCII(kUserAgentSwitch)); |
| 191 } | 191 } |
| 192 return blink::WebString::fromUTF8(mojo::common::GetUserAgent()); | 192 return blink::WebString::fromUTF8(mojo::common::GetUserAgent()); |
| 193 } | 193 } |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 BlinkPlatformImpl::notificationManager() { | 280 BlinkPlatformImpl::notificationManager() { |
| 281 return &web_notification_manager_; | 281 return &web_notification_manager_; |
| 282 } | 282 } |
| 283 | 283 |
| 284 void BlinkPlatformImpl::UpdateWebThreadTLS(blink::WebThread* thread) { | 284 void BlinkPlatformImpl::UpdateWebThreadTLS(blink::WebThread* thread) { |
| 285 DCHECK(!current_thread_slot_.Get()); | 285 DCHECK(!current_thread_slot_.Get()); |
| 286 current_thread_slot_.Set(thread); | 286 current_thread_slot_.Set(thread); |
| 287 } | 287 } |
| 288 | 288 |
| 289 } // namespace html_viewer | 289 } // namespace html_viewer |
| OLD | NEW |