diff options
author | hirono@chromium.org <hirono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-27 13:23:19 +0000 |
---|---|---|
committer | hirono@chromium.org <hirono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-27 13:23:19 +0000 |
commit | f62684811d2e6aefbbd1723ec7f3f2bd7b5b8a27 (patch) | |
tree | f254bc2cfb14b502ea30c1abedf06c58176dfe0f | |
parent | d1027a80c396ae08bd98127e941e77a11295bfae (diff) | |
download | chromium_src-f62684811d2e6aefbbd1723ec7f3f2bd7b5b8a27.zip chromium_src-f62684811d2e6aefbbd1723ec7f3f2bd7b5b8a27.tar.gz chromium_src-f62684811d2e6aefbbd1723ec7f3f2bd7b5b8a27.tar.bz2 |
Show the avatar batch in windows that are moved to another profile.
Windows that are moved to another profile should have the batch as well as
normal browser windows.
BUG=336091
TEST=manually
Review URL: https://codereview.chromium.org/148113002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247227 0039d316-1c4b-4281-b951-d872f2087c98
5 files changed, 59 insertions, 3 deletions
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_misc.cc b/chrome/browser/chromeos/extensions/file_manager/private_api_misc.cc index 6659713..8fb7909 100644 --- a/chrome/browser/chromeos/extensions/file_manager/private_api_misc.cc +++ b/chrome/browser/chromeos/extensions/file_manager/private_api_misc.cc @@ -18,6 +18,7 @@ #include "chrome/browser/chromeos/settings/cros_settings.h" #include "chrome/browser/lifetime/application_lifetime.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/profiles/profile_info_util.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/signin/profile_oauth2_token_service.h" #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" @@ -29,6 +30,7 @@ #include "content/public/browser/web_contents.h" #include "content/public/common/page_zoom.h" #include "google_apis/drive/auth_service.h" +#include "ui/base/webui/web_ui_util.h" #include "url/gurl.h" namespace extensions { @@ -76,6 +78,16 @@ GetLoggedInProfileInfoList() { profile_info->display_name = UTF16ToUTF8(user->GetDisplayName()); // TODO(hirono): Remove the property from the profile_info. profile_info->is_current_profile = true; + + // Make an icon URL of the profile. + const int kImageSize = 30; + const gfx::Image& image = profiles::GetAvatarIconForTitleBar( + gfx::Image(user->image()), true, kImageSize, kImageSize); + const SkBitmap* const bitmap = image.ToSkBitmap(); + if (bitmap) { + profile_info->image_uri.reset(new std::string( + webui::GetBitmapDataUrl(*bitmap))); + } result_profiles.push_back(profile_info); } diff --git a/chrome/browser/resources/file_manager/foreground/css/file_manager.css b/chrome/browser/resources/file_manager/foreground/css/file_manager.css index d385099..986e21f 100644 --- a/chrome/browser/resources/file_manager/foreground/css/file_manager.css +++ b/chrome/browser/resources/file_manager/foreground/css/file_manager.css @@ -148,12 +148,28 @@ body { line-height: 45px; } +.dialog-navigation-list-header #profile-batch { + display: none; +} + +.dialog-navigation-list-header #profile-batch[src] { + display: inline-block; + height: 30px; + margin: 8px; + vertical-align: top; + width: 30px; +} + .dialog-navigation-list-header #app-name { -webkit-margin-start: 15px; color: #303030; font-size: 130%; } +.dialog-navigation-list-header #profile-batch[src] + #app-name { + -webkit-margin-start: 0; +} + .dialog-navigation-list-contents { display: -webkit-box; flex: 1 1 auto; diff --git a/chrome/browser/resources/file_manager/foreground/js/file_manager.js b/chrome/browser/resources/file_manager/foreground/js/file_manager.js index 40ce6e8..a1cfe96 100644 --- a/chrome/browser/resources/file_manager/foreground/js/file_manager.js +++ b/chrome/browser/resources/file_manager/foreground/js/file_manager.js @@ -2267,8 +2267,8 @@ var BOTTOM_MARGIN_FOR_PREVIEW_PANEL_PX = 52; this.gearButton_.blur(); chrome.fileBrowserPrivate.visitDesktop(inProfile.profileId, function() { - // TODO(hirono): Update the profile batch. - }); + this.ui_.updateProfileBatch(); + }.bind(this)); }.bind(this, profile)); } }.bind(this)); diff --git a/chrome/browser/resources/file_manager/foreground/js/ui/file_manager_ui.js b/chrome/browser/resources/file_manager/foreground/js/ui/file_manager_ui.js index 1d460f5..fba0402 100644 --- a/chrome/browser/resources/file_manager/foreground/js/ui/file_manager_ui.js +++ b/chrome/browser/resources/file_manager/foreground/js/ui/file_manager_ui.js @@ -101,6 +101,7 @@ var FileManagerUI = function(element, dialogType) { Object.seal(this); // Initialize the header. + this.updateProfileBatch(); this.element_.querySelector('#app-name').innerText = chrome.runtime.getManifest().name; @@ -188,3 +189,30 @@ FileManagerUI.prototype.initDialogs = function() { FileManagerUI.prototype.initAdditionalUI = function() { this.searchBox = new SearchBox(this.element_.querySelector('#search-box')); }; + +/** + * Updates visibility and image of the profile batch. + */ +FileManagerUI.prototype.updateProfileBatch = function() { + if (this.dialogType_ !== DialogType.FULL_PAGE) + return; + + chrome.fileBrowserPrivate.getProfiles(function(profiles, + currentId, + displayedId) { + var imageUri; + if (currentId !== displayedId) { + for (var i = 0; i < profiles.length; i++) { + if (profiles[i].profileId !== currentId) { + imageUri = profiles[i].imageUri; + break; + } + } + } + var profileBatch = this.element_.querySelector('#profile-batch'); + if (imageUri) + profileBatch.setAttribute('src', imageUri); + else + profileBatch.removeAttribute('src'); + }.bind(this)); +}; diff --git a/chrome/browser/resources/file_manager/main.html b/chrome/browser/resources/file_manager/main.html index f4876d86..4eef031 100644 --- a/chrome/browser/resources/file_manager/main.html +++ b/chrome/browser/resources/file_manager/main.html @@ -274,7 +274,7 @@ <div class="dialog-container"> <div class="dialog-navigation-list"> <div class="dialog-navigation-list-header"> - <span id="app-name"></span> + <img id="profile-batch"></img><span id="app-name"></span> </div> <div class="dialog-navigation-list-contents"> <list id="navigation-list" tabindex="14"></list> |