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

Side by Side Diff: services/authenticating_url_loader/authenticating_url_loader_factory_impl.cc

Issue 1161603003: Have the authenticating_url_loader cache token per-origin. (Closed) Base URL: https://github.com/domokit/mojo.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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "services/authenticating_url_loader/authenticating_url_loader_factory_i mpl.h" 5 #include "services/authenticating_url_loader/authenticating_url_loader_factory_i mpl.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/stl_util.h" 9 #include "base/stl_util.h"
10 #include "mojo/public/cpp/application/application_impl.h" 10 #include "mojo/public/cpp/application/application_impl.h"
(...skipping 22 matching lines...) Expand all
33 url_loader->SetAuthenticationService(authentication_service_.get()); 33 url_loader->SetAuthenticationService(authentication_service_.get());
34 } 34 }
35 } 35 }
36 36
37 void AuthenticatingURLLoaderFactoryImpl::CreateAuthenticatingURLLoader( 37 void AuthenticatingURLLoaderFactoryImpl::CreateAuthenticatingURLLoader(
38 mojo::InterfaceRequest<AuthenticatingURLLoader> loader_request) { 38 mojo::InterfaceRequest<AuthenticatingURLLoader> loader_request) {
39 url_loaders_.push_back(std::unique_ptr<AuthenticatingURLLoaderImpl>( 39 url_loaders_.push_back(std::unique_ptr<AuthenticatingURLLoaderImpl>(
40 new AuthenticatingURLLoaderImpl( 40 new AuthenticatingURLLoaderImpl(
41 loader_request.Pass(), authentication_service_.get(), 41 loader_request.Pass(), authentication_service_.get(),
42 network_service_.get(), 42 network_service_.get(),
43 &cached_tokens_,
43 base::Bind(&AuthenticatingURLLoaderFactoryImpl::DeleteURLLoader, 44 base::Bind(&AuthenticatingURLLoaderFactoryImpl::DeleteURLLoader,
44 base::Unretained(this))))); 45 base::Unretained(this)))));
45 } 46 }
46 47
47 void AuthenticatingURLLoaderFactoryImpl::OnConnectionError() { 48 void AuthenticatingURLLoaderFactoryImpl::OnConnectionError() {
48 SetAuthenticationService(nullptr); 49 SetAuthenticationService(nullptr);
49 } 50 }
50 51
51 void AuthenticatingURLLoaderFactoryImpl::DeleteURLLoader( 52 void AuthenticatingURLLoaderFactoryImpl::DeleteURLLoader(
52 AuthenticatingURLLoaderImpl* url_loader) { 53 AuthenticatingURLLoaderImpl* url_loader) {
53 auto it = std::find_if( 54 auto it = std::find_if(
54 url_loaders_.begin(), url_loaders_.end(), 55 url_loaders_.begin(), url_loaders_.end(),
55 [url_loader](const std::unique_ptr<AuthenticatingURLLoaderImpl>& p) { 56 [url_loader](const std::unique_ptr<AuthenticatingURLLoaderImpl>& p) {
56 return p.get() == url_loader; 57 return p.get() == url_loader;
57 }); 58 });
58 DCHECK(it != url_loaders_.end()); 59 DCHECK(it != url_loaders_.end());
59 url_loaders_.erase(it); 60 url_loaders_.erase(it);
60 } 61 }
61 62
62 } // namespace mojo 63 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698