Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Side by Side Diff: components/html_viewer/blink_platform_impl.cc

Issue 1161463004: Move URL Loader creation to a separate factory object. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/html_viewer/blink_platform_impl.h ('k') | components/html_viewer/html_viewer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 : main_thread_task_runner_(renderer_scheduler->DefaultTaskRunner()), 64 : main_thread_task_runner_(renderer_scheduler->DefaultTaskRunner()),
65 main_thread_( 65 main_thread_(
66 new scheduler::WebThreadImplForRendererScheduler(renderer_scheduler)), 66 new scheduler::WebThreadImplForRendererScheduler(renderer_scheduler)),
67 shared_timer_func_(NULL), 67 shared_timer_func_(NULL),
68 shared_timer_fire_time_(0.0), 68 shared_timer_fire_time_(0.0),
69 shared_timer_fire_time_was_set_while_suspended_(false), 69 shared_timer_fire_time_was_set_while_suspended_(false),
70 shared_timer_suspended_(0) { 70 shared_timer_suspended_(0) {
71 if (app) { 71 if (app) {
72 mojo::URLRequestPtr request(mojo::URLRequest::New()); 72 mojo::URLRequestPtr request(mojo::URLRequest::New());
73 request->url = mojo::String::From("mojo:network_service"); 73 request->url = mojo::String::From("mojo:network_service");
74 app->ConnectToService(request.Pass(), &network_service_); 74 mojo::ApplicationConnection* connection =
75 app->ConnectToApplication(request.Pass());
76 connection->ConnectToService(&network_service_);
77 connection->ConnectToService(&url_loader_factory_);
75 78
76 mojo::CookieStorePtr cookie_store; 79 mojo::CookieStorePtr cookie_store;
77 network_service_->GetCookieStore(GetProxy(&cookie_store)); 80 network_service_->GetCookieStore(GetProxy(&cookie_store));
78 cookie_jar_.reset(new WebCookieJarImpl(cookie_store.Pass())); 81 cookie_jar_.reset(new WebCookieJarImpl(cookie_store.Pass()));
79 82
80 mojo::ClipboardPtr clipboard; 83 mojo::ClipboardPtr clipboard;
81 mojo::URLRequestPtr request2(mojo::URLRequest::New()); 84 mojo::URLRequestPtr request2(mojo::URLRequest::New());
82 request2->url = mojo::String::From("mojo:clipboard"); 85 request2->url = mojo::String::From("mojo:clipboard");
83 app->ConnectToService(request2.Pass(), &clipboard); 86 app->ConnectToService(request2.Pass(), &clipboard);
84 clipboard_.reset(new WebClipboardImpl(clipboard.Pass())); 87 clipboard_.reset(new WebClipboardImpl(clipboard.Pass()));
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 blink_resource_map_.GetResource(kDataResources[i].id, &length); 200 blink_resource_map_.GetResource(kDataResources[i].id, &length);
198 CHECK(data != nullptr && length > 0); 201 CHECK(data != nullptr && length > 0);
199 return blink::WebData(reinterpret_cast<const char*>(data), length); 202 return blink::WebData(reinterpret_cast<const char*>(data), length);
200 } 203 }
201 } 204 }
202 NOTREACHED() << "Requested resource is unavailable: " << resource; 205 NOTREACHED() << "Requested resource is unavailable: " << resource;
203 return blink::WebData(); 206 return blink::WebData();
204 } 207 }
205 208
206 blink::WebURLLoader* BlinkPlatformImpl::createURLLoader() { 209 blink::WebURLLoader* BlinkPlatformImpl::createURLLoader() {
207 return new WebURLLoaderImpl(network_service_.get(), &blob_registry_); 210 return new WebURLLoaderImpl(url_loader_factory_.get(), &blob_registry_);
208 } 211 }
209 212
210 blink::WebSocketHandle* BlinkPlatformImpl::createWebSocketHandle() { 213 blink::WebSocketHandle* BlinkPlatformImpl::createWebSocketHandle() {
211 return new WebSocketHandleImpl(network_service_.get()); 214 return new WebSocketHandleImpl(network_service_.get());
212 } 215 }
213 216
214 blink::WebString BlinkPlatformImpl::userAgent() { 217 blink::WebString BlinkPlatformImpl::userAgent() {
215 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 218 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
216 if (command_line->HasSwitch(kUserAgentSwitch)) { 219 if (command_line->HasSwitch(kUserAgentSwitch)) {
217 return blink::WebString::fromUTF8( 220 return blink::WebString::fromUTF8(
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 BlinkPlatformImpl::notificationManager() { 309 BlinkPlatformImpl::notificationManager() {
307 return &web_notification_manager_; 310 return &web_notification_manager_;
308 } 311 }
309 312
310 void BlinkPlatformImpl::UpdateWebThreadTLS(blink::WebThread* thread) { 313 void BlinkPlatformImpl::UpdateWebThreadTLS(blink::WebThread* thread) {
311 DCHECK(!current_thread_slot_.Get()); 314 DCHECK(!current_thread_slot_.Get());
312 current_thread_slot_.Set(thread); 315 current_thread_slot_.Set(thread);
313 } 316 }
314 317
315 } // namespace html_viewer 318 } // namespace html_viewer
OLDNEW
« no previous file with comments | « components/html_viewer/blink_platform_impl.h ('k') | components/html_viewer/html_viewer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698