Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "config.h" | |
| 6 #include "platform/fetcher/MojoFetcher.h" | |
| 7 | |
| 8 #include "base/bind.h" | |
| 9 #include "mojo/services/public/interfaces/network/network_service.mojom.h" | |
| 10 #include "platform/weborigin/KURL.h" | |
| 11 #include "public/platform/Platform.h" | |
| 12 | |
| 13 namespace blink { | |
| 14 | |
| 15 MojoFetcher::MojoFetcher(Client* client, const KURL& url) | |
| 16 : client_(client), | |
|
esprehn
2014/10/24 21:50:12
sigh, the comma at the end is really hard to catch
| |
| 17 weak_factory_(this) { | |
| 18 DCHECK(client_); | |
| 19 | |
| 20 mojo::NetworkService* net = Platform::current()->networkService(); | |
| 21 net->CreateURLLoader(GetProxy(&url_loader_)); | |
| 22 | |
| 23 mojo::URLRequestPtr url_request = mojo::URLRequest::New(); | |
| 24 url_request->url = url.string().toUTF8(); | |
| 25 url_request->auto_follow_redirects = true; | |
| 26 url_loader_->Start(url_request.Pass(), | |
| 27 base::Bind(&MojoFetcher::OnReceivedResponse, | |
| 28 weak_factory_.GetWeakPtr())); | |
| 29 } | |
| 30 | |
| 31 MojoFetcher::~MojoFetcher() { | |
| 32 } | |
| 33 | |
| 34 void MojoFetcher::OnReceivedResponse(mojo::URLResponsePtr response) { | |
| 35 client_->OnReceivedResponse(response.Pass()); | |
| 36 } | |
| 37 | |
| 38 } // namespace blink | |
| OLD | NEW |