Commit 8e9edc2c authored by Roman Sorokin's avatar Roman Sorokin Committed by Commit Bot

Chromad: Delete "Google Profile photo" choice from the user image screen

Bug: 682236
Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: I2614bf5a86df25a3b9c08fb5fc69c7afdd0ff5b2
Reviewed-on: https://chromium-review.googlesource.com/675368
Commit-Queue: Roman Sorokin <rsorokin@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#504874}
parent aa92003c
......@@ -51,6 +51,8 @@ namespace {
constexpr const char kContextKeyIsCameraPresent[] = "isCameraPresent";
constexpr const char kContextKeyProfilePictureDataURL[] =
"profilePictureDataURL";
constexpr const char kContextKeyIsProfilePictureAvailable[] =
"isProfilePictureAvailable";
constexpr const char kContextKeySelectedImageIndex[] = "selectedImageIndex";
constexpr const char kContextKeySelectedImageURL[] = "selectedImageURL";
......@@ -221,8 +223,15 @@ void UserImageScreen::Show() {
kContextKeySelectedImageURL,
default_user_image::GetDefaultImageUrl(selected_image_));
// Start fetching the profile image.
GetUserImageManager()->DownloadProfileImage(kProfileDownloadReason);
const user_manager::User* user = GetUser();
// Active Directory accounts do not use a profile image so skip the download
// and inform the UI that no profile image exists.
if (user && user->IsActiveDirectoryUser()) {
GetContextEditor().SetBoolean(kContextKeyIsProfilePictureAvailable, false);
} else {
// Start fetching the profile image.
GetUserImageManager()->DownloadProfileImage(kProfileDownloadReason);
}
}
void UserImageScreen::Hide() {
......
......@@ -11,6 +11,7 @@ login.createScreen('UserImageScreen', 'user-image', function() {
var CONTEXT_KEY_SELECTED_IMAGE_INDEX = 'selectedImageIndex';
var CONTEXT_KEY_SELECTED_IMAGE_URL = 'selectedImageURL';
var CONTEXT_KEY_PROFILE_PICTURE_DATA_URL = 'profilePictureDataURL';
var CONTEXT_KEY_IS_PROFILE_PICTURE_AVAILABLE = 'isProfilePictureAvailable';
return {
EXTERNAL_API: ['setDefaultImages', 'hideCurtain'],
......@@ -32,6 +33,14 @@ login.createScreen('UserImageScreen', 'user-image', function() {
if (url)
$('changePicture').setProfileImageUrl(url, false /* selected */);
});
this.context.addObserver(
CONTEXT_KEY_IS_PROFILE_PICTURE_AVAILABLE, function(available) {
if (!available) {
self.profileImageLoading = false;
// Empty url hides profile image selection choice.
$('changePicture').setProfileImageUrl('', false /* selected */);
}
});
this.profileImageLoading = true;
chrome.send('getImages');
......
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