Commit 14cea1d2 authored by fukino's avatar fukino Committed by Commit bot

Remove Files.app's own profile badge.

Now that the Files.app uses default system header, the own profile badge is redundant.

BUG=408816
TEST=confirmed manually, ran browser_tests

Review URL: https://codereview.chromium.org/520623002

Cr-Commit-Position: refs/heads/master@{#292827}
parent e322f3c3
......@@ -62,7 +62,7 @@ AppWindow* GetCurrentAppWindow(ChromeSyncExtensionFunction* function) {
}
std::vector<linked_ptr<api::file_browser_private::ProfileInfo> >
GetLoggedInProfileInfoList(content::WebContents* contents) {
GetLoggedInProfileInfoList() {
DCHECK(user_manager::UserManager::IsInitialized());
const std::vector<Profile*>& profiles =
g_browser_process->profile_manager()->GetLoadedProfiles();
......@@ -89,18 +89,6 @@ GetLoggedInProfileInfoList(content::WebContents* contents) {
// TODO(hirono): Remove the property from the profile_info.
profile_info->is_current_profile = true;
// Make an icon URL of the profile.
if (contents) {
const gfx::Image& image =
ash::GetAvatarImageForContext(contents->GetBrowserContext());
const gfx::ImageSkia& skia = image.AsImageSkia();
profile_info->profile_image.reset(
new api::file_browser_private::ImageSet);
profile_info->profile_image->scale1x_url =
webui::GetBitmapDataUrl(skia.GetRepresentation(1.0f).sk_bitmap());
profile_info->profile_image->scale2x_url =
webui::GetBitmapDataUrl(skia.GetRepresentation(2.0f).sk_bitmap());
}
result_profiles.push_back(profile_info);
}
......@@ -380,7 +368,7 @@ void FileBrowserPrivateRequestWebStoreAccessTokenFunction::OnAccessTokenFetched(
bool FileBrowserPrivateGetProfilesFunction::RunSync() {
const std::vector<linked_ptr<api::file_browser_private::ProfileInfo> >&
profiles = GetLoggedInProfileInfoList(GetAssociatedWebContents());
profiles = GetLoggedInProfileInfoList();
// Obtains the display profile ID.
AppWindow* const app_window = GetCurrentAppWindow(this);
......@@ -404,7 +392,7 @@ bool FileBrowserPrivateVisitDesktopFunction::RunSync() {
using api::file_browser_private::VisitDesktop::Params;
const scoped_ptr<Params> params(Params::Create(*args_));
const std::vector<linked_ptr<api::file_browser_private::ProfileInfo> >&
profiles = GetLoggedInProfileInfoList(GetAssociatedWebContents());
profiles = GetLoggedInProfileInfoList();
chrome::MultiUserWindowManager* const window_manager =
chrome::MultiUserWindowManager::GetInstance();
......
......@@ -1219,24 +1219,6 @@ IN_PROC_BROWSER_TEST_F(MultiProfileFileManagerBrowserTest, MAYBE_BasicDrive) {
StartTest();
}
// Slow tests are disabled on debug build. http://crbug.com/327719
#if !defined(NDEBUG)
#define MAYBE_PRE_Badge DISABLED_PRE_Badge
#define MAYBE_Badge DISABLED_Badge
#else
#define MAYBE_PRE_Badge PRE_Badge
#define MAYBE_Badge Badge
#endif
IN_PROC_BROWSER_TEST_F(MultiProfileFileManagerBrowserTest, MAYBE_PRE_Badge) {
AddAllUsers();
}
IN_PROC_BROWSER_TEST_F(MultiProfileFileManagerBrowserTest, MAYBE_Badge) {
// Test the profile badge to be correctly shown and hidden.
set_test_case_name("multiProfileBadge");
StartTest();
}
// Slow tests are disabled on debug build. http://crbug.com/327719
#if !defined(NDEBUG)
#define MAYBE_PRE_VisitDesktopMenu DISABLED_PRE_VisitDesktopMenu
......
......@@ -237,9 +237,6 @@ dictionary ProfileInfo {
// TODO(hirono): Remove the property because of the design change of
// multi-profile suuport.
boolean isCurrentProfile;
// Image set of profile image.
ImageSet? profileImage;
};
// Mounted disk volume metadata.
......
......@@ -49,65 +49,6 @@ function waitForVisitDesktopMenu(windowId, profileId, waitMode) {
});
}
testcase.multiProfileBadge = function() {
var appId;
StepsRunner.run([
function() {
setupAndWaitUntilReady(null, RootPath.DOWNLOADS, this.next);
},
// Add all users.
function(inAppId) {
appId = inAppId;
chrome.test.sendMessage(JSON.stringify({name: 'addAllUsers'}),
this.next);
},
// Get the badge element.
function(json) {
chrome.test.assertTrue(JSON.parse(json));
waitForElement(appId, '#profile-badge').then(this.next);
},
// Verify no badge image is shown yet. Move to other deskop.
function(element) {
chrome.test.assertTrue(element.hidden, 'Badge hidden initially');
callRemoteTestUtil('visitDesktop',
appId,
['bob@invalid.domain'],
this.next);
},
// Get the badge element again.
function(result) {
chrome.test.assertTrue(result);
waitForElement(appId, '#profile-badge:not([hidden])').then(this.next);
},
// Verify an image source is filled. Go back to the original desktop
function(element) {
callRemoteTestUtil('queryAllElements',
appId,
['#profile-badge',
null,
['background']]).then(this.next);
},
function(elements) {
chrome.test.assertTrue(
elements[0].styles.background.indexOf('data:image') !== -1,
'Badge shown after moving desktop');
callRemoteTestUtil('visitDesktop',
appId,
['alice@invalid.domain'],
this.next);
},
// Wait for #profile-badge element to disappear.
function(result) {
chrome.test.assertTrue(result);
waitForElementLost(appId, '#profile-badge:not([hidden])').then(this.next);
},
// The image is gone.
function(result) {
checkIfNoErrorsOccured(this.next);
}
]);
};
testcase.multiProfileVisitDesktopMenu = function() {
var appId;
StepsRunner.run([
......
......@@ -157,24 +157,12 @@ a:focus {
line-height: 45px;
}
.dialog-navigation-list-header #profile-badge {
display: inline-block;
height: 29px; /* Size of a profile image. */
margin: 8px;
vertical-align: top;
width: 29px; /* Size of a profile image. */
}
.dialog-navigation-list-header #app-name {
color: #303030;
font-size: 130%;
margin: 0 15px;
}
.dialog-navigation-list-header #profile-badge:not([hidden]) + #app-name {
margin: 0;
}
.dialog-navigation-list-contents {
display: flex;
flex: 1 1 auto;
......
......@@ -480,7 +480,6 @@ var BOTTOM_MARGIN_FOR_PREVIEW_PANEL_PX = 52;
this.onShowGearMenu_.bind(this));
chrome.fileBrowserPrivate.onDesktopChanged.addListener(function() {
this.updateVisitDesktopMenus_();
this.ui_.updateProfileBadge();
}.bind(this));
chrome.fileBrowserPrivate.onProfileAdded.addListener(
this.updateVisitDesktopMenus_.bind(this));
......
......@@ -137,7 +137,6 @@ var FileManagerUI = function(element, dialogType) {
Object.seal(this);
// Initialize the header.
this.updateProfileBadge();
this.element_.querySelector('#app-name').innerText =
chrome.runtime.getManifest().name;
......@@ -236,39 +235,6 @@ FileManagerUI.prototype.initAdditionalUI = function() {
this.toggleViewButton = this.element_.querySelector('#view-button');
};
/**
* Updates visibility and image of the profile badge.
*/
FileManagerUI.prototype.updateProfileBadge = function() {
if (this.dialogType_ !== DialogType.FULL_PAGE)
return;
chrome.fileBrowserPrivate.getProfiles(function(profiles,
currentId,
displayedId) {
var profileImage;
if (currentId !== displayedId) {
for (var i = 0; i < profiles.length; i++) {
if (profiles[i].profileId === currentId) {
profileImage = profiles[i].profileImage;
break;
}
}
}
var profileBadge = this.element_.querySelector('#profile-badge');
if (profileImage) {
profileBadge.style.background =
'-webkit-image-set(' +
'url(' + profileImage.scale1xUrl + ') 1x,' +
'url(' + profileImage.scale2xUrl + ') 2x) no-repeat center';
profileBadge.hidden = false;
} else {
profileBadge.style.background = '';
profileBadge.hidden = true;
}
}.bind(this));
};
/**
* Handles click event on the search button.
* @param {Event} event Click event.
......
......@@ -278,7 +278,7 @@
<div class="dialog-container">
<div class="dialog-navigation-list">
<div class="dialog-navigation-list-header">
<span id="profile-badge" hidden></span><span id="app-name"></span>
<span id="app-name"></span>
</div>
<div class="dialog-navigation-list-contents">
<tree id="directory-tree" tabindex="15"></tree>
......
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