Commit b37848b3 authored by Roman Sorokin's avatar Roman Sorokin Committed by Commit Bot

cros: Remove reason from UserImageManager::DownloadProfileImage

It's not being reported to histograms

Bug: none
Change-Id: I1e6999cf4618cdeb9a7969e78d35a06b0d461c96
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2418573Reviewed-by: default avatarRoman Aleksandrov <raleksandrov@google.com>
Reviewed-by: default avatarRegan Hsu <hsuregan@chromium.org>
Commit-Queue: Roman Sorokin [CET] <rsorokin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#808374}
parent e06ecf53
......@@ -23,7 +23,7 @@ class MockUserImageManager : public UserImageManager {
void SaveUserImage(std::unique_ptr<user_manager::UserImage>) {}
MOCK_METHOD1(SaveUserImageFromFile, void(const base::FilePath&));
MOCK_METHOD0(SaveUserImageFromProfileImage, void());
MOCK_METHOD1(DownloadProfileImage, void(const std::string&));
MOCK_METHOD0(DownloadProfileImage, void());
MOCK_CONST_METHOD0(DownloadedProfileImage, const gfx::ImageSkia&(void));
};
......
......@@ -71,9 +71,8 @@ class UserImageManager {
// Starts downloading the profile image for the user. If user's image
// index is |USER_IMAGE_PROFILE|, newly downloaded image is immediately
// set as user's current picture. |reason| is an arbitrary string
// (used to report UMA histograms with download times).
virtual void DownloadProfileImage(const std::string& reason) = 0;
// set as user's current picture.
virtual void DownloadProfileImage() = 0;
// Returns the result of the last successful profile image download, if any.
// Otherwise, returns an empty bitmap.
......
......@@ -59,16 +59,6 @@ const int kProfileDataDownloadRetryIntervalSec = 300;
// Delay betweeen subsequent profile refresh attempts (24 hrs).
const int kProfileRefreshIntervalSec = 24 * 3600;
// Time histogram suffix for a profile image download after login.
const char kProfileDownloadReasonLoggedIn[] = "LoggedIn";
// Time histogram suffix for a profile image download when the user chooses the
// profile image but it has not been downloaded yet.
const char kProfileDownloadReasonProfileImageChosen[] = "ProfileImageChosen";
// Time histogram suffix for a scheduled profile image download.
const char kProfileDownloadReasonScheduled[] = "Scheduled";
// Time histogram suffix for a profile image download retry.
const char kProfileDownloadReasonRetry[] = "Retry";
static bool g_ignore_profile_data_download_delay_ = false;
// Converts |image_index| to UMA histogram value.
......@@ -586,12 +576,12 @@ void UserImageManagerImpl::UserProfileCreated() {
? base::TimeDelta()
: base::TimeDelta::FromSeconds(kProfileDataDownloadDelaySec),
base::BindOnce(&UserImageManagerImpl::DownloadProfileData,
base::Unretained(this), kProfileDownloadReasonLoggedIn));
base::Unretained(this)));
// Schedule periodic refreshes of the profile data.
profile_download_periodic_timer_.Start(
FROM_HERE, base::TimeDelta::FromSeconds(kProfileRefreshIntervalSec),
base::Bind(&UserImageManagerImpl::DownloadProfileData,
base::Unretained(this), kProfileDownloadReasonScheduled));
base::Unretained(this)));
} else {
profile_download_one_shot_timer_.Stop();
profile_download_periodic_timer_.Stop();
......@@ -640,7 +630,7 @@ void UserImageManagerImpl::SaveUserImageFromProfileImage() {
// If no profile image has been downloaded yet, ensure that a download is
// started.
if (downloaded_profile_image_.isNull())
DownloadProfileData(kProfileDownloadReasonProfileImageChosen);
DownloadProfileData();
}
void UserImageManagerImpl::DeleteUserImage() {
......@@ -648,9 +638,9 @@ void UserImageManagerImpl::DeleteUserImage() {
DeleteUserImageAndLocalStateEntry(kUserImageProperties);
}
void UserImageManagerImpl::DownloadProfileImage(const std::string& reason) {
void UserImageManagerImpl::DownloadProfileImage() {
profile_image_requested_ = true;
DownloadProfileData(reason);
DownloadProfileData();
}
const gfx::ImageSkia& UserImageManagerImpl::DownloadedProfileImage() const {
......@@ -794,7 +784,7 @@ void UserImageManagerImpl::OnProfileDownloadFailure(
FROM_HERE,
base::TimeDelta::FromSeconds(kProfileDataDownloadRetryIntervalSec),
base::BindOnce(&UserImageManagerImpl::DownloadProfileData,
base::Unretained(this), kProfileDownloadReasonRetry));
base::Unretained(this)));
}
user_manager_->NotifyUserProfileImageUpdateFailed(*GetUser());
......@@ -829,7 +819,7 @@ bool UserImageManagerImpl::NeedProfileImage() const {
profile_image_requested_);
}
void UserImageManagerImpl::DownloadProfileData(const std::string& reason) {
void UserImageManagerImpl::DownloadProfileData() {
if (!IsUserLoggedInAndHasGaiaAccount())
return;
......
......@@ -55,7 +55,7 @@ class UserImageManagerImpl : public UserImageManager,
void SaveUserImageFromFile(const base::FilePath& path) override;
void SaveUserImageFromProfileImage() override;
void DeleteUserImage() override;
void DownloadProfileImage(const std::string& reason) override;
void DownloadProfileImage() override;
const gfx::ImageSkia& DownloadedProfileImage() const override;
UserImageSyncObserver* GetSyncObserver() const override;
void Shutdown() override;
......@@ -125,9 +125,8 @@ class UserImageManagerImpl : public UserImageManager,
// Downloads the profile data for the currently logged-in user. The user's
// full name and, if NeedProfileImage() is true, the profile image are
// downloaded. |reason| is an arbitrary string (used to report UMA histograms
// with download times).
void DownloadProfileData(const std::string& reason);
// downloaded.
void DownloadProfileData();
// Removes ther user from the dictionary |prefs_dict_root| in
// local state and deletes the image file that the dictionary
......
......@@ -78,9 +78,6 @@ ui::SelectFileDialog::FileTypeInfo GetUserImageFileTypeInfo() {
return file_type_info;
}
// Time histogram suffix for profile image download.
const char kProfileDownloadReason[] = "Preferences";
} // namespace
ChangePictureHandler::ChangePictureHandler()
......@@ -278,7 +275,7 @@ void ChangePictureHandler::UpdateProfileImage() {
!user_image_manager->DownloadedProfileImage().isNull()) {
SendProfileImage(user_image_manager->DownloadedProfileImage(), false);
}
user_image_manager->DownloadProfileImage(kProfileDownloadReason);
user_image_manager->DownloadProfileImage();
}
void ChangePictureHandler::SendOldImage(std::string&& image_url) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment