| 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 "sky/engine/platform/fetcher/MojoFetcher.h" | |
| 6 | |
| 7 #include "base/bind.h" | |
| 8 #include "mojo/services/network/public/interfaces/network_service.mojom.h" | |
| 9 #include "sky/engine/platform/weborigin/KURL.h" | |
| 10 #include "sky/engine/public/platform/Platform.h" | |
| 11 | |
| 12 namespace blink { | |
| 13 | |
| 14 MojoFetcher::MojoFetcher(Client* client, const KURL& url) | |
| 15 : client_(client), | |
| 16 weak_factory_(this) { | |
| 17 DCHECK(client_); | |
| 18 | |
| 19 mojo::NetworkService* net = Platform::current()->networkService(); | |
| 20 net->CreateURLLoader(GetProxy(&url_loader_)); | |
| 21 | |
| 22 mojo::URLRequestPtr url_request = mojo::URLRequest::New(); | |
| 23 url_request->url = url.string().toUTF8(); | |
| 24 url_request->auto_follow_redirects = true; | |
| 25 // TODO(rafaelw): Bypass the cache until we can figure out why modified | |
| 26 // resources aren't updating within sky. | |
| 27 url_request->bypass_cache = true; | |
| 28 url_loader_->Start(url_request.Pass(), | |
| 29 base::Bind(&MojoFetcher::OnReceivedResponse, | |
| 30 weak_factory_.GetWeakPtr())); | |
| 31 } | |
| 32 | |
| 33 MojoFetcher::~MojoFetcher() { | |
| 34 } | |
| 35 | |
| 36 void MojoFetcher::OnReceivedResponse(mojo::URLResponsePtr response) { | |
| 37 client_->OnReceivedResponse(response.Pass()); | |
| 38 } | |
| 39 | |
| 40 } // namespace blink | |
| OLD | NEW |