Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
Remove Files.app's own profile badge.
Browse files Browse the repository at this point in the history
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}
  • Loading branch information
fukino authored and Commit bot committed Sep 1, 2014
1 parent e322f3c commit 14cea1d
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 143 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
}

Expand Down Expand Up @@ -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);
Expand All @@ -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();
Expand Down
18 changes: 0 additions & 18 deletions chrome/browser/chromeos/file_manager/file_manager_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions chrome/common/extensions/api/file_browser_private.idl
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down
12 changes: 0 additions & 12 deletions ui/file_manager/file_manager/foreground/css/file_manager.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion ui/file_manager/file_manager/foreground/js/file_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
34 changes: 0 additions & 34 deletions ui/file_manager/file_manager/foreground/js/ui/file_manager_ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion ui/file_manager/file_manager/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 14cea1d

Please sign in to comment.