Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Unified Diff: chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_manager.js

Issue 1631923004: Sync 3rd party wallpaper app name (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address tbarzic@'s comment. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_manager.js
diff --git a/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_manager.js b/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_manager.js
index ea66985b36e708b054e811f62694fc36aaee379b..991fd6fb11f545ede3b6682260931a26bd9b3777 100644
--- a/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_manager.js
+++ b/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_manager.js
@@ -285,13 +285,30 @@ function WallpaperManager(dialogDom) {
$('set-wallpaper-layout').addEventListener(
'change', this.onWallpaperLayoutChanged_.bind(this));
- if (loadTimeData.valueExists('wallpaperAppName')) {
- $('wallpaper-set-by-message').textContent = loadTimeData.getStringF(
- 'currentWallpaperSetByMessage', str('wallpaperAppName'));
- $('wallpaper-grid').classList.add('small');
- } else {
- $('wallpaper-grid').classList.remove('small');
- }
+ // Always prefer the value from local filesystem to avoid the time window
+ // of setting the third party app name and the third party wallpaper.
+ var getThirdPartyAppName = function(callback) {
+ Constants.WallpaperLocalStorage.get(
+ Constants.AccessLocalWallpaperInfoKey, function(items) {
+ var localInfo = items[Constants.AccessLocalWallpaperInfoKey];
+ if (localInfo && localInfo.hasOwnProperty('appName'))
+ callback(localInfo.appName);
+ else if (loadTimeData.valueExists('wallpaperAppName'))
+ callback(str('wallpaperAppName'));
+ else
+ callback('');
+ });
+ };
+
+ getThirdPartyAppName(function(appName) {
+ if (!!appName) {
+ $('wallpaper-set-by-message').textContent = loadTimeData.getStringF(
+ 'currentWallpaperSetByMessage', appName);
+ $('wallpaper-grid').classList.add('small');
+ } else {
+ $('wallpaper-grid').classList.remove('small');
+ }
+ });
if (this.enableOnlineWallpaper_) {
var self = this;
@@ -415,8 +432,8 @@ function WallpaperManager(dialogDom) {
// to be deleted.
chrome.wallpaperPrivate.resetWallpaper();
this.onWallpaperChanged_(null, null);
- WallpaperUtil.saveWallpaperInfo('', '',
- Constants.WallpaperSourceEnum.Default);
+ WallpaperUtil.saveWallpaperInfo(
+ '', '', Constants.WallpaperSourceEnum.Default, '');
} else {
selectedIndex = Math.min(selectedIndex, customWallpaperCount - 1);
wallpaperGrid.selectionModel.selectedIndex = selectedIndex;
@@ -598,8 +615,8 @@ function WallpaperManager(dialogDom) {
// Resets back to default wallpaper.
chrome.wallpaperPrivate.resetWallpaper();
this.onWallpaperChanged_(selectedItem, selectedItem.baseURL);
- WallpaperUtil.saveWallpaperInfo(wallpaperURL, selectedItem.layout,
- selectedItem.source);
+ WallpaperUtil.saveWallpaperInfo(
+ wallpaperURL, selectedItem.layout, selectedItem.source, '');
break;
case Constants.WallpaperSourceEnum.Online:
var wallpaperURL = selectedItem.baseURL +
@@ -611,8 +628,8 @@ function WallpaperManager(dialogDom) {
function(exists) {
if (exists) {
self.onWallpaperChanged_(selectedItem, wallpaperURL);
- WallpaperUtil.saveWallpaperInfo(wallpaperURL, selectedItem.layout,
- selectedItem.source);
+ WallpaperUtil.saveWallpaperInfo(
+ wallpaperURL, selectedItem.layout, selectedItem.source, '');
return;
}
@@ -638,8 +655,8 @@ function WallpaperManager(dialogDom) {
self.onWallpaperChanged_(selectedItem, wallpaperURL);
}
});
- WallpaperUtil.saveWallpaperInfo(wallpaperURL, selectedItem.layout,
- selectedItem.source);
+ WallpaperUtil.saveWallpaperInfo(
+ wallpaperURL, selectedItem.layout, selectedItem.source, '');
self.wallpaperRequest_ = null;
};
var onFailure = function(status) {
@@ -967,8 +984,8 @@ function WallpaperManager(dialogDom) {
success(opt_thumbnail);
// Custom wallpapers are not synced yet. If login on a different
// computer after set a custom wallpaper, wallpaper wont change by sync.
- WallpaperUtil.saveWallpaperInfo(fileName, layout,
- Constants.WallpaperSourceEnum.Custom);
+ WallpaperUtil.saveWallpaperInfo(
+ fileName, layout, Constants.WallpaperSourceEnum.Custom, '');
}
};
« no previous file with comments | « chrome/browser/resources/chromeos/wallpaper_manager/js/util.js ('k') | chrome/common/extensions/api/wallpaper_private.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698