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

Side by Side Diff: remoting/host/oauth_token_getter_impl.cc

Issue 1864213002: Convert //remoting to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac IWYU 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
« no previous file with comments | « remoting/host/oauth_token_getter_impl.h ('k') | remoting/host/pairing_registry_delegate.h » ('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 "remoting/host/oauth_token_getter_impl.h" 5 #include "remoting/host/oauth_token_getter_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "google_apis/google_api_keys.h" 12 #include "google_apis/google_api_keys.h"
13 #include "net/url_request/url_request_context_getter.h" 13 #include "net/url_request/url_request_context_getter.h"
14 #include "remoting/base/logging.h" 14 #include "remoting/base/logging.h"
15 15
16 namespace remoting { 16 namespace remoting {
17 17
18 namespace { 18 namespace {
19 19
20 // Maximum number of retries on network/500 errors. 20 // Maximum number of retries on network/500 errors.
21 const int kMaxRetries = 3; 21 const int kMaxRetries = 3;
22 22
23 // Time when we we try to update OAuth token before its expiration. 23 // Time when we we try to update OAuth token before its expiration.
24 const int kTokenUpdateTimeBeforeExpirySeconds = 60; 24 const int kTokenUpdateTimeBeforeExpirySeconds = 60;
25 25
26 } // namespace 26 } // namespace
27 27
28 OAuthTokenGetterImpl::OAuthTokenGetterImpl( 28 OAuthTokenGetterImpl::OAuthTokenGetterImpl(
29 scoped_ptr<OAuthCredentials> oauth_credentials, 29 std::unique_ptr<OAuthCredentials> oauth_credentials,
30 const scoped_refptr<net::URLRequestContextGetter>& 30 const scoped_refptr<net::URLRequestContextGetter>&
31 url_request_context_getter, 31 url_request_context_getter,
32 bool auto_refresh) 32 bool auto_refresh)
33 : oauth_credentials_(std::move(oauth_credentials)), 33 : oauth_credentials_(std::move(oauth_credentials)),
34 gaia_oauth_client_( 34 gaia_oauth_client_(
35 new gaia::GaiaOAuthClient(url_request_context_getter.get())), 35 new gaia::GaiaOAuthClient(url_request_context_getter.get())),
36 url_request_context_getter_(url_request_context_getter) { 36 url_request_context_getter_(url_request_context_getter) {
37 if (auto_refresh) { 37 if (auto_refresh) {
38 refresh_timer_.reset(new base::OneShotTimer()); 38 refresh_timer_.reset(new base::OneShotTimer());
39 } 39 }
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 ""}; 172 ""};
173 173
174 refreshing_oauth_token_ = true; 174 refreshing_oauth_token_ = true;
175 std::vector<std::string> empty_scope_list; // Use scope from refresh token. 175 std::vector<std::string> empty_scope_list; // Use scope from refresh token.
176 gaia_oauth_client_->RefreshToken(client_info, 176 gaia_oauth_client_->RefreshToken(client_info,
177 oauth_credentials_->refresh_token, 177 oauth_credentials_->refresh_token,
178 empty_scope_list, kMaxRetries, this); 178 empty_scope_list, kMaxRetries, this);
179 } 179 }
180 180
181 } // namespace remoting 181 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/oauth_token_getter_impl.h ('k') | remoting/host/pairing_registry_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698