OLD | NEW |
---|---|
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 "chrome/browser/supervised_user/legacy/custodian_profile_downloader_ser vice.h" | 5 #include "chrome/browser/supervised_user/legacy/custodian_profile_downloader_ser vice.h" |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/signin/chrome_signin_client_factory.h" | |
9 #include "chrome/browser/signin/signin_manager_factory.h" | 10 #include "chrome/browser/signin/signin_manager_factory.h" |
10 #include "chrome/common/pref_names.h" | 11 #include "chrome/common/pref_names.h" |
11 #include "components/signin/core/browser/signin_manager.h" | 12 #include "components/signin/core/browser/signin_manager.h" |
12 #include "google_apis/gaia/gaia_auth_util.h" | 13 #include "google_apis/gaia/gaia_auth_util.h" |
13 | 14 |
14 CustodianProfileDownloaderService::CustodianProfileDownloaderService( | 15 CustodianProfileDownloaderService::CustodianProfileDownloaderService( |
15 Profile* custodian_profile) | 16 Profile* custodian_profile) |
16 : custodian_profile_(custodian_profile) { | 17 : custodian_profile_(custodian_profile) { |
17 } | 18 } |
18 | 19 |
(...skipping 16 matching lines...) Expand all Loading... | |
35 if (gaia::AreEmailsSame(last_downloaded_profile_email_, current_email)) { | 36 if (gaia::AreEmailsSame(last_downloaded_profile_email_, current_email)) { |
36 // Profile was previously downloaded successfully, use it as it is unlikely | 37 // Profile was previously downloaded successfully, use it as it is unlikely |
37 // that we will need to download it again. | 38 // that we will need to download it again. |
38 OnProfileDownloadSuccess(profile_downloader_.get()); | 39 OnProfileDownloadSuccess(profile_downloader_.get()); |
39 return; | 40 return; |
40 } | 41 } |
41 // If another profile download is in progress, drop it. It's not worth | 42 // If another profile download is in progress, drop it. It's not worth |
42 // queueing them up, and more likely that the one that hasn't ended yet is | 43 // queueing them up, and more likely that the one that hasn't ended yet is |
43 // failing somehow than that the new one won't succeed. | 44 // failing somehow than that the new one won't succeed. |
44 in_progress_profile_email_ = current_email; | 45 in_progress_profile_email_ = current_email; |
45 profile_downloader_.reset(new ProfileDownloader(this)); | 46 profile_downloader_.reset( |
Marc Treib
2015/05/06 21:30:05
nit: Is this a valid way to break the line? I'd wr
anthonyvd
2015/05/14 15:39:23
Done.
| |
47 new ProfileDownloader(this, | |
48 ChromeSigninClientFactory::GetForProfile(custodian_profile_))); | |
46 profile_downloader_->Start(); | 49 profile_downloader_->Start(); |
47 } | 50 } |
48 | 51 |
49 bool CustodianProfileDownloaderService::NeedsProfilePicture() const { | 52 bool CustodianProfileDownloaderService::NeedsProfilePicture() const { |
50 return false; | 53 return false; |
51 } | 54 } |
52 | 55 |
53 int CustodianProfileDownloaderService::GetDesiredImageSideLength() const { | 56 int CustodianProfileDownloaderService::GetDesiredImageSideLength() const { |
54 return 0; | 57 return 0; |
55 } | 58 } |
(...skipping 14 matching lines...) Expand all Loading... | |
70 last_downloaded_profile_email_ = in_progress_profile_email_; | 73 last_downloaded_profile_email_ = in_progress_profile_email_; |
71 } | 74 } |
72 | 75 |
73 void CustodianProfileDownloaderService::OnProfileDownloadFailure( | 76 void CustodianProfileDownloaderService::OnProfileDownloadFailure( |
74 ProfileDownloader* downloader, | 77 ProfileDownloader* downloader, |
75 ProfileDownloaderDelegate::FailureReason reason) { | 78 ProfileDownloaderDelegate::FailureReason reason) { |
76 // Ignore failures; proceed without the custodian's name. | 79 // Ignore failures; proceed without the custodian's name. |
77 download_callback_.Reset(); | 80 download_callback_.Reset(); |
78 profile_downloader_.reset(); | 81 profile_downloader_.reset(); |
79 } | 82 } |
OLD | NEW |