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

Side by Side Diff: sky/services/platform/weburlloader_impl.cc

Issue 1154223003: NOT FOR COMMIT: POC of using AuthenticatingURLLoader in Sky (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: updated comment 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 | « sky/services/platform/weburlloader_impl.h ('k') | sky/shell/ui/engine.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 "sky/services/platform/weburlloader_impl.h" 5 #include "sky/services/platform/weburlloader_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
11 #include "mojo/common/common_type_converters.h" 11 #include "mojo/common/common_type_converters.h"
12 #include "mojo/services/authenticating_url_loader/public/interfaces/authenticati ng_url_loader_factory.mojom.h"
12 #include "mojo/services/network/public/interfaces/network_service.mojom.h" 13 #include "mojo/services/network/public/interfaces/network_service.mojom.h"
13 #include "sky/engine/public/platform/WebURLError.h" 14 #include "sky/engine/public/platform/WebURLError.h"
14 #include "sky/engine/public/platform/WebURLLoadTiming.h" 15 #include "sky/engine/public/platform/WebURLLoadTiming.h"
15 #include "sky/engine/public/platform/WebURLLoaderClient.h" 16 #include "sky/engine/public/platform/WebURLLoaderClient.h"
16 #include "sky/engine/public/platform/WebURLResponse.h" 17 #include "sky/engine/public/platform/WebURLResponse.h"
17 #include "sky/services/platform/net_constants.h" 18 #include "sky/services/platform/net_constants.h"
18 #include "sky/services/platform/url_request_types.h" 19 #include "sky/services/platform/url_request_types.h"
19 20
20 namespace sky { 21 namespace sky {
21 namespace { 22 namespace {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 result.setHTTPHeaderField( 63 result.setHTTPHeaderField(
63 blink::WebString::fromUTF8(header_line.substr(0, first_colon)), 64 blink::WebString::fromUTF8(header_line.substr(0, first_colon)),
64 blink::WebString::fromUTF8(value)); 65 blink::WebString::fromUTF8(value));
65 } 66 }
66 67
67 return result; 68 return result;
68 } 69 }
69 70
70 } // namespace 71 } // namespace
71 72
72 WebURLLoaderImpl::WebURLLoaderImpl(mojo::NetworkService* network_service) 73 WebURLLoaderImpl::WebURLLoaderImpl(
73 : client_(NULL), 74 mojo::NetworkService* network_service,
74 weak_factory_(this) { 75 mojo::AuthenticatingURLLoaderFactory* authenticating_url_loader_factory)
75 network_service->CreateURLLoader(GetProxy(&url_loader_)); 76 : client_(NULL), weak_factory_(this) {
77 authenticating_url_loader_factory->CreateAuthenticatingURLLoader(
78 GetProxy(&url_loader_));
76 } 79 }
77 80
78 WebURLLoaderImpl::~WebURLLoaderImpl() { 81 WebURLLoaderImpl::~WebURLLoaderImpl() {
79 } 82 }
80 83
81 void WebURLLoaderImpl::loadAsynchronously(const blink::WebURLRequest& request, 84 void WebURLLoaderImpl::loadAsynchronously(const blink::WebURLRequest& request,
82 blink::WebURLLoaderClient* client) { 85 blink::WebURLLoaderClient* client) {
83 client_ = client; 86 client_ = client;
84 url_ = request.url(); 87 url_ = request.url();
85 88
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 MOJO_DEADLINE_INDEFINITE, 189 MOJO_DEADLINE_INDEFINITE,
187 base::Bind(&WebURLLoaderImpl::OnResponseBodyStreamReady, 190 base::Bind(&WebURLLoaderImpl::OnResponseBodyStreamReady,
188 weak_factory_.GetWeakPtr())); 191 weak_factory_.GetWeakPtr()));
189 } 192 }
190 193
191 void WebURLLoaderImpl::OnResponseBodyStreamReady(MojoResult result) { 194 void WebURLLoaderImpl::OnResponseBodyStreamReady(MojoResult result) {
192 ReadMore(); 195 ReadMore();
193 } 196 }
194 197
195 } // namespace sky 198 } // namespace sky
OLDNEW
« no previous file with comments | « sky/services/platform/weburlloader_impl.h ('k') | sky/shell/ui/engine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698