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

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

Issue 2815913005: Switch to using scoped_ptr with UserData (Closed)
Patch Set: fixes Created 3 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/gaia_auth_util.h" 5 #include "google_apis/gaia/gaia_auth_util.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/json/json_reader.h" 12 #include "base/json/json_reader.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/memory/ptr_util.h"
14 #include "base/strings/string_split.h" 15 #include "base/strings/string_split.h"
15 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
16 #include "base/values.h" 17 #include "base/values.h"
17 #include "google_apis/gaia/gaia_urls.h" 18 #include "google_apis/gaia/gaia_urls.h"
18 #include "net/url_request/url_fetcher.h" 19 #include "net/url_request/url_fetcher.h"
19 #include "net/url_request/url_request.h" 20 #include "net/url_request/url_request.h"
20 #include "url/gurl.h" 21 #include "url/gurl.h"
21 22
22 namespace gaia { 23 namespace gaia {
23 24
(...skipping 21 matching lines...) Expand all
45 base::RemoveChars(parts[0], ".", &parts[0]); 46 base::RemoveChars(parts[0], ".", &parts[0]);
46 } 47 }
47 48
48 std::string new_email = base::ToLowerASCII(base::JoinString(parts, "@")); 49 std::string new_email = base::ToLowerASCII(base::JoinString(parts, "@"));
49 VLOG(1) << "Canonicalized " << email_address << " to " << new_email; 50 VLOG(1) << "Canonicalized " << email_address << " to " << new_email;
50 return new_email; 51 return new_email;
51 } 52 }
52 53
53 class GaiaURLRequestUserData : public base::SupportsUserData::Data { 54 class GaiaURLRequestUserData : public base::SupportsUserData::Data {
54 public: 55 public:
55 static base::SupportsUserData::Data* Create() { 56 static std::unique_ptr<base::SupportsUserData::Data> Create() {
56 return new GaiaURLRequestUserData(); 57 return base::MakeUnique<GaiaURLRequestUserData>();
57 } 58 }
58 }; 59 };
59 60
60 } // namespace 61 } // namespace
61 62
62 63
63 ListedAccount::ListedAccount() {} 64 ListedAccount::ListedAccount() {}
64 65
65 ListedAccount::ListedAccount(const ListedAccount& other) = default; 66 ListedAccount::ListedAccount(const ListedAccount& other) = default;
66 67
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 return request.GetUserData(kURLRequestUserDataKey) != nullptr; 198 return request.GetUserData(kURLRequestUserDataKey) != nullptr;
198 } 199 }
199 200
200 void MarkURLFetcherAsGaia(net::URLFetcher* fetcher) { 201 void MarkURLFetcherAsGaia(net::URLFetcher* fetcher) {
201 DCHECK(fetcher); 202 DCHECK(fetcher);
202 fetcher->SetURLRequestUserData(kURLRequestUserDataKey, 203 fetcher->SetURLRequestUserData(kURLRequestUserDataKey,
203 base::Bind(&GaiaURLRequestUserData::Create)); 204 base::Bind(&GaiaURLRequestUserData::Create));
204 } 205 }
205 206
206 } // namespace gaia 207 } // namespace gaia
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698