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 338883004: Show third party wallpaper app name in wallpaper picker (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 62208a25cfddd2ab2ebc68e0120036ca29b0b98e..33f24d3ebedcf16426fc7f6baf2b60d1d58d2ab8 100644
--- a/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_manager.js
+++ b/chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_manager.js
@@ -253,6 +253,12 @@ function WallpaperManager(dialogDom) {
$('set-wallpaper-layout').addEventListener(
'change', this.onWallpaperLayoutChanged_.bind(this));
+ if (loadTimeData.valueExists('wallpaperAppName')) {
+ $('wallpaper-set-by-message').hidden = false;
flackr 2014/06/17 15:20:34 Use the :empty CSS selector to automatically hide
bshe 2014/06/17 19:01:44 Done.
+ $('wallpaper-set-by-message').innerText = loadTimeData.getStringF(
flackr 2014/06/17 15:20:34 s/innerText/textContent
bshe 2014/06/17 19:01:44 Done.
+ 'currentWallpaperSetByMessage', str('wallpaperAppName'));
+ }
+
if (this.enableOnlineWallpaper_) {
var self = this;
$('surprise-me').hidden = false;
@@ -352,6 +358,7 @@ function WallpaperManager(dialogDom) {
// Active custom wallpaper is also copied in chronos data dir. It needs
// to be deleted.
chrome.wallpaperPrivate.resetWallpaper();
+ this.hideWallpaperSetByMessage_();
flackr 2014/06/17 15:20:34 Rather than sprinkling this throughout the code, c
bshe 2014/06/17 19:01:44 Unfortunately, there are a few private APIs(setWal
flackr 2014/06/18 00:59:48 Even if the only thing "onWallpaperChanged" does i
bshe 2014/06/18 21:07:42 make sense. Added a onWallpaperChanged function an
} else {
selectedIndex = Math.min(selectedIndex, customWallpaperCount - 1);
wallpaperGrid.selectionModel.selectedIndex = selectedIndex;
@@ -473,6 +480,15 @@ function WallpaperManager(dialogDom) {
};
/**
+ * Hides the wallpaper set by message. It should be called after user changed
+ * wallpaper through wallpaper picker.
+ */
+ WallpaperManager.prototype.hideWallpaperSetByMessage_ = function() {
+ $('wallpaper-set-by-message').hidden = true;
+ $('wallpaper-set-by-message').innerText = '';
flackr 2014/06/17 15:20:34 s/innerText/textContent
bshe 2014/06/17 19:01:44 Done. There is only one line left in this function
+ }
+
+ /**
* Sets wallpaper to the corresponding wallpaper of selected thumbnail.
* @param {{baseURL: string, layout: string, source: string,
* availableOffline: boolean, opt_dynamicURL: string,
@@ -488,6 +504,7 @@ function WallpaperManager(dialogDom) {
var setActive = function() {
self.wallpaperGrid_.activeItem = selectedItem;
self.currentWallpaper_ = selectedItem.baseURL;
+ self.hideWallpaperSetByMessage_();
};
var success = function(dirEntry) {
dirEntry.getFile(selectedItem.baseURL, {create: false},
@@ -511,6 +528,7 @@ function WallpaperManager(dialogDom) {
case Constants.WallpaperSourceEnum.OEM:
// Resets back to default wallpaper.
chrome.wallpaperPrivate.resetWallpaper();
+ this.hideWallpaperSetByMessage_();
this.currentWallpaper_ = selectedItem.baseURL;
this.wallpaperGrid_.activeItem = selectedItem;
WallpaperUtil.saveWallpaperInfo(wallpaperURL, selectedItem.layout,
@@ -527,6 +545,7 @@ function WallpaperManager(dialogDom) {
if (exists) {
self.currentWallpaper_ = wallpaperURL;
self.wallpaperGrid_.activeItem = selectedItem;
+ self.hideWallpaperSetByMessage_();
WallpaperUtil.saveWallpaperInfo(wallpaperURL, selectedItem.layout,
selectedItem.source);
return;
@@ -893,6 +912,7 @@ function WallpaperManager(dialogDom) {
// computer after set a custom wallpaper, wallpaper wont change by sync.
WallpaperUtil.saveWallpaperInfo(fileName, layout,
Constants.WallpaperSourceEnum.Custom);
+ self.hideWallpaperSetByMessage_();
}
};
@@ -921,6 +941,7 @@ function WallpaperManager(dialogDom) {
this.showError_(chrome.runtime.lastError.message);
} else if (opt_selectedItem) {
this.wallpaperGrid_.activeItem = opt_selectedItem;
+ this.hideWallpaperSetByMessage_();
}
};
@@ -938,6 +959,7 @@ function WallpaperManager(dialogDom) {
$('set-wallpaper-layout').disabled = true;
} else {
WallpaperUtil.saveToStorage(self.currentWallpaper_, layout, false);
+ self.hideWallpaperSetByMessage_();
}
});
};

Powered by Google App Engine
This is Rietveld 408576698