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

Side by Side Diff: google_apis/gaia/fake_gaia.cc

Issue 1873663002: Convert //google_apis from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "google_apis/gaia/fake_gaia.h" 5 #include "google_apis/gaia/fake_gaia.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base_paths.h" 10 #include "base/base_paths.h"
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 293
294 // Handles /GetUserInfo GAIA call. 294 // Handles /GetUserInfo GAIA call.
295 REGISTER_RESPONSE_HANDLER( 295 REGISTER_RESPONSE_HANDLER(
296 gaia_urls->get_user_info_url(), HandleGetUserInfo); 296 gaia_urls->get_user_info_url(), HandleGetUserInfo);
297 297
298 // Handles /oauth2/v1/userinfo call. 298 // Handles /oauth2/v1/userinfo call.
299 REGISTER_RESPONSE_HANDLER( 299 REGISTER_RESPONSE_HANDLER(
300 gaia_urls->oauth_user_info_url(), HandleOAuthUserInfo); 300 gaia_urls->oauth_user_info_url(), HandleOAuthUserInfo);
301 } 301 }
302 302
303 scoped_ptr<HttpResponse> FakeGaia::HandleRequest(const HttpRequest& request) { 303 std::unique_ptr<HttpResponse> FakeGaia::HandleRequest(
304 const HttpRequest& request) {
304 // The scheme and host of the URL is actually not important but required to 305 // The scheme and host of the URL is actually not important but required to
305 // get a valid GURL in order to parse |request.relative_url|. 306 // get a valid GURL in order to parse |request.relative_url|.
306 GURL request_url = GURL("http://localhost").Resolve(request.relative_url); 307 GURL request_url = GURL("http://localhost").Resolve(request.relative_url);
307 std::string request_path = request_url.path(); 308 std::string request_path = request_url.path();
308 scoped_ptr<BasicHttpResponse> http_response(new BasicHttpResponse()); 309 std::unique_ptr<BasicHttpResponse> http_response(new BasicHttpResponse());
309 RequestHandlerMap::iterator iter = request_handlers_.find(request_path); 310 RequestHandlerMap::iterator iter = request_handlers_.find(request_path);
310 if (iter != request_handlers_.end()) { 311 if (iter != request_handlers_.end()) {
311 LOG(WARNING) << "Serving request " << request_path; 312 LOG(WARNING) << "Serving request " << request_path;
312 iter->second.Run(request, http_response.get()); 313 iter->second.Run(request, http_response.get());
313 } else { 314 } else {
314 LOG(ERROR) << "Unhandled request " << request_path; 315 LOG(ERROR) << "Unhandled request " << request_path;
315 return scoped_ptr<HttpResponse>(); // Request not understood. 316 return std::unique_ptr<HttpResponse>(); // Request not understood.
316 } 317 }
317 318
318 return std::move(http_response); 319 return std::move(http_response);
319 } 320 }
320 321
321 void FakeGaia::IssueOAuthToken(const std::string& auth_token, 322 void FakeGaia::IssueOAuthToken(const std::string& auth_token,
322 const AccessTokenInfo& token_info) { 323 const AccessTokenInfo& token_info) {
323 access_token_info_map_.insert(std::make_pair(auth_token, token_info)); 324 access_token_info_map_.insert(std::make_pair(auth_token, token_info));
324 } 325 }
325 326
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 url = net::AppendQueryParameter(url, "RelayState", 833 url = net::AppendQueryParameter(url, "RelayState",
833 GaiaUrls::GetInstance() 834 GaiaUrls::GetInstance()
834 ->gaia_url() 835 ->gaia_url()
835 .Resolve(kDummySAMLContinuePath) 836 .Resolve(kDummySAMLContinuePath)
836 .spec()); 837 .spec());
837 std::string redirect_url = url.spec(); 838 std::string redirect_url = url.spec();
838 http_response->set_code(net::HTTP_TEMPORARY_REDIRECT); 839 http_response->set_code(net::HTTP_TEMPORARY_REDIRECT);
839 http_response->AddCustomHeader("Google-Accounts-SAML", "Start"); 840 http_response->AddCustomHeader("Google-Accounts-SAML", "Start");
840 http_response->AddCustomHeader("Location", redirect_url); 841 http_response->AddCustomHeader("Location", redirect_url);
841 } 842 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698