| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 : main_thread_task_runner_(renderer_scheduler->DefaultTaskRunner()), | 63 : main_thread_task_runner_(renderer_scheduler->DefaultTaskRunner()), |
| 64 main_thread_( | 64 main_thread_( |
| 65 new scheduler::WebThreadImplForRendererScheduler(renderer_scheduler)), | 65 new scheduler::WebThreadImplForRendererScheduler(renderer_scheduler)), |
| 66 shared_timer_func_(NULL), | 66 shared_timer_func_(NULL), |
| 67 shared_timer_fire_time_(0.0), | 67 shared_timer_fire_time_(0.0), |
| 68 shared_timer_fire_time_was_set_while_suspended_(false), | 68 shared_timer_fire_time_was_set_while_suspended_(false), |
| 69 shared_timer_suspended_(0) { | 69 shared_timer_suspended_(0) { |
| 70 if (app) { | 70 if (app) { |
| 71 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 71 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
| 72 request->url = mojo::String::From("mojo:network_service"); | 72 request->url = mojo::String::From("mojo:network_service"); |
| 73 app->ConnectToService(request.Pass(), &network_service_); | 73 mojo::ApplicationConnection* connection = |
| 74 app->ConnectToApplication(request.Pass()); |
| 75 connection->ConnectToService(&network_service_); |
| 76 connection->ConnectToService(&url_loader_factory_); |
| 74 | 77 |
| 75 mojo::CookieStorePtr cookie_store; | 78 mojo::CookieStorePtr cookie_store; |
| 76 network_service_->GetCookieStore(GetProxy(&cookie_store)); | 79 network_service_->GetCookieStore(GetProxy(&cookie_store)); |
| 77 cookie_jar_.reset(new WebCookieJarImpl(cookie_store.Pass())); | 80 cookie_jar_.reset(new WebCookieJarImpl(cookie_store.Pass())); |
| 78 | 81 |
| 79 mojo::ClipboardPtr clipboard; | 82 mojo::ClipboardPtr clipboard; |
| 80 mojo::URLRequestPtr request2(mojo::URLRequest::New()); | 83 mojo::URLRequestPtr request2(mojo::URLRequest::New()); |
| 81 request2->url = mojo::String::From("mojo:clipboard"); | 84 request2->url = mojo::String::From("mojo:clipboard"); |
| 82 app->ConnectToService(request2.Pass(), &clipboard); | 85 app->ConnectToService(request2.Pass(), &clipboard); |
| 83 clipboard_.reset(new WebClipboardImpl(clipboard.Pass())); | 86 clipboard_.reset(new WebClipboardImpl(clipboard.Pass())); |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 blink_resource_map_.GetResource(kDataResources[i].id, &length); | 199 blink_resource_map_.GetResource(kDataResources[i].id, &length); |
| 197 CHECK(data != nullptr && length > 0); | 200 CHECK(data != nullptr && length > 0); |
| 198 return blink::WebData(reinterpret_cast<const char*>(data), length); | 201 return blink::WebData(reinterpret_cast<const char*>(data), length); |
| 199 } | 202 } |
| 200 } | 203 } |
| 201 NOTREACHED() << "Requested resource is unavailable: " << resource; | 204 NOTREACHED() << "Requested resource is unavailable: " << resource; |
| 202 return blink::WebData(); | 205 return blink::WebData(); |
| 203 } | 206 } |
| 204 | 207 |
| 205 blink::WebURLLoader* BlinkPlatformImpl::createURLLoader() { | 208 blink::WebURLLoader* BlinkPlatformImpl::createURLLoader() { |
| 206 return new WebURLLoaderImpl(network_service_.get(), &blob_registry_); | 209 return new WebURLLoaderImpl(url_loader_factory_.get(), &blob_registry_); |
| 207 } | 210 } |
| 208 | 211 |
| 209 blink::WebSocketHandle* BlinkPlatformImpl::createWebSocketHandle() { | 212 blink::WebSocketHandle* BlinkPlatformImpl::createWebSocketHandle() { |
| 210 return new WebSocketHandleImpl(network_service_.get()); | 213 return new WebSocketHandleImpl(network_service_.get()); |
| 211 } | 214 } |
| 212 | 215 |
| 213 blink::WebString BlinkPlatformImpl::userAgent() { | 216 blink::WebString BlinkPlatformImpl::userAgent() { |
| 214 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 217 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 215 if (command_line->HasSwitch(kUserAgentSwitch)) { | 218 if (command_line->HasSwitch(kUserAgentSwitch)) { |
| 216 return blink::WebString::fromUTF8( | 219 return blink::WebString::fromUTF8( |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 BlinkPlatformImpl::notificationManager() { | 308 BlinkPlatformImpl::notificationManager() { |
| 306 return &web_notification_manager_; | 309 return &web_notification_manager_; |
| 307 } | 310 } |
| 308 | 311 |
| 309 void BlinkPlatformImpl::UpdateWebThreadTLS(blink::WebThread* thread) { | 312 void BlinkPlatformImpl::UpdateWebThreadTLS(blink::WebThread* thread) { |
| 310 DCHECK(!current_thread_slot_.Get()); | 313 DCHECK(!current_thread_slot_.Get()); |
| 311 current_thread_slot_.Set(thread); | 314 current_thread_slot_.Set(thread); |
| 312 } | 315 } |
| 313 | 316 |
| 314 } // namespace html_viewer | 317 } // namespace html_viewer |
| OLD | NEW |