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

Side by Side Diff: chrome/browser/resources/chromeos/wallpaper_manager/js/wallpaper_manager.js

Issue 16634016: Support png wallpapers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: spelling Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * WallpaperManager constructor. 6 * WallpaperManager constructor.
7 * 7 *
8 * WallpaperManager objects encapsulate the functionality of the wallpaper 8 * WallpaperManager objects encapsulate the functionality of the wallpaper
9 * manager extension. 9 * manager extension.
10 * 10 *
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 }; 702 };
703 703
704 /** 704 /**
705 * Handles the custom wallpaper which user selected from file manager. Called 705 * Handles the custom wallpaper which user selected from file manager. Called
706 * when users select a file. 706 * when users select a file.
707 */ 707 */
708 WallpaperManager.prototype.onFileSelectorChanged_ = function() { 708 WallpaperManager.prototype.onFileSelectorChanged_ = function() {
709 var files = $('file-selector').files; 709 var files = $('file-selector').files;
710 if (files.length != 1) 710 if (files.length != 1)
711 console.error('More than one files are selected or no file selected'); 711 console.error('More than one files are selected or no file selected');
712 if (!files[0].type.match('image/jpeg')) { 712 if (!files[0].type.match('image/jpeg') &&
713 !files[0].type.match('image/png')) {
713 this.showError_(str('invalidWallpaper')); 714 this.showError_(str('invalidWallpaper'));
714 return; 715 return;
715 } 716 }
716 var layout = getSelectedLayout(); 717 var layout = getSelectedLayout();
717 var self = this; 718 var self = this;
718 var errorHandler = this.onFileSystemError_.bind(this); 719 var errorHandler = this.onFileSystemError_.bind(this);
719 var setSelectedFile = function(file, layout, fileName) { 720 var setSelectedFile = function(file, layout, fileName) {
720 var saveThumbnail = function(thumbnail) { 721 var saveThumbnail = function(thumbnail) {
721 var success = function(dirEntry) { 722 var success = function(dirEntry) {
722 dirEntry.getFile(fileName, {create: true}, function(fileEntry) { 723 dirEntry.getFile(fileName, {create: true}, function(fileEntry) {
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 } 983 }
983 } 984 }
984 } 985 }
985 this.wallpaperGrid_.dataModel = wallpapersDataModel; 986 this.wallpaperGrid_.dataModel = wallpapersDataModel;
986 this.wallpaperGrid_.selectedItem = selectedItem; 987 this.wallpaperGrid_.selectedItem = selectedItem;
987 this.wallpaperGrid_.activeItem = selectedItem; 988 this.wallpaperGrid_.activeItem = selectedItem;
988 } 989 }
989 }; 990 };
990 991
991 })(); 992 })();
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/wallpaper_manager.cc ('k') | chrome/browser/resources/chromeos/wallpaper_manager/main.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698