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

Side by Side Diff: chrome/browser/signin/android_profile_oauth2_token_service.cc

Issue 805903005: Move WeakPtrFactory members to the end in some android code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 | « chrome/browser/android/compositor/tab_content_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "chrome/browser/signin/android_profile_oauth2_token_service.h" 5 #include "chrome/browser/signin/android_profile_oauth2_token_service.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 virtual void CancelRequest() override; 48 virtual void CancelRequest() override;
49 49
50 // Handles an access token response. 50 // Handles an access token response.
51 void OnAccessTokenResponse(const GoogleServiceAuthError& error, 51 void OnAccessTokenResponse(const GoogleServiceAuthError& error,
52 const std::string& access_token, 52 const std::string& access_token,
53 const base::Time& expiration_time); 53 const base::Time& expiration_time);
54 54
55 private: 55 private:
56 std::string CombineScopes(const std::vector<std::string>& scopes); 56 std::string CombineScopes(const std::vector<std::string>& scopes);
57 57
58 base::WeakPtrFactory<AndroidAccessTokenFetcher> weak_factory_;
59 std::string account_id_; 58 std::string account_id_;
60 bool request_was_cancelled_; 59 bool request_was_cancelled_;
60 base::WeakPtrFactory<AndroidAccessTokenFetcher> weak_factory_;
61 61
62 DISALLOW_COPY_AND_ASSIGN(AndroidAccessTokenFetcher); 62 DISALLOW_COPY_AND_ASSIGN(AndroidAccessTokenFetcher);
63 }; 63 };
64 64
65 AndroidAccessTokenFetcher::AndroidAccessTokenFetcher( 65 AndroidAccessTokenFetcher::AndroidAccessTokenFetcher(
66 OAuth2AccessTokenConsumer* consumer, 66 OAuth2AccessTokenConsumer* consumer,
67 const std::string& account_id) 67 const std::string& account_id)
68 : OAuth2AccessTokenFetcher(consumer), 68 : OAuth2AccessTokenFetcher(consumer),
69 weak_factory_(this),
70 account_id_(account_id), 69 account_id_(account_id),
71 request_was_cancelled_(false) { 70 request_was_cancelled_(false),
71 weak_factory_(this) {
72 } 72 }
73 73
74 AndroidAccessTokenFetcher::~AndroidAccessTokenFetcher() {} 74 AndroidAccessTokenFetcher::~AndroidAccessTokenFetcher() {}
75 75
76 void AndroidAccessTokenFetcher::Start(const std::string& client_id, 76 void AndroidAccessTokenFetcher::Start(const std::string& client_id,
77 const std::string& client_secret, 77 const std::string& client_secret,
78 const std::vector<std::string>& scopes) { 78 const std::vector<std::string>& scopes) {
79 JNIEnv* env = AttachCurrentThread(); 79 JNIEnv* env = AttachCurrentThread();
80 std::string scope = CombineScopes(scopes); 80 std::string scope = CombineScopes(scopes);
81 ScopedJavaLocalRef<jstring> j_username = 81 ScopedJavaLocalRef<jstring> j_username =
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 GoogleServiceAuthError err(result ? 469 GoogleServiceAuthError err(result ?
470 GoogleServiceAuthError::NONE : 470 GoogleServiceAuthError::NONE :
471 GoogleServiceAuthError::CONNECTION_FAILED); 471 GoogleServiceAuthError::CONNECTION_FAILED);
472 heap_callback->Run(err, token, base::Time()); 472 heap_callback->Run(err, token, base::Time());
473 } 473 }
474 474
475 // static 475 // static
476 bool AndroidProfileOAuth2TokenService::Register(JNIEnv* env) { 476 bool AndroidProfileOAuth2TokenService::Register(JNIEnv* env) {
477 return RegisterNativesImpl(env); 477 return RegisterNativesImpl(env);
478 } 478 }
OLDNEW
« no previous file with comments | « chrome/browser/android/compositor/tab_content_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698