OLD | NEW |
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 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 var wallpaperInfo = { | 763 var wallpaperInfo = { |
764 baseURL: fileName, | 764 baseURL: fileName, |
765 layout: layout, | 765 layout: layout, |
766 source: wallpapers.WallpaperSourceEnum.Custom, | 766 source: wallpapers.WallpaperSourceEnum.Custom, |
767 availableOffline: true | 767 availableOffline: true |
768 }; | 768 }; |
769 self.currentWallpaper_ = fileName; | 769 self.currentWallpaper_ = fileName; |
770 var items = {}; | 770 var items = {}; |
771 items[self.currentWallpaper_] = layout; | 771 items[self.currentWallpaper_] = layout; |
772 self.storage_.set(items, function() {}); | 772 self.storage_.set(items, function() {}); |
773 self.wallpaperGrid_.dataModel.splice(0, 0, wallpaperInfo); | 773 self.wallpaperGrid_.insertElement(0, wallpaperInfo); |
774 self.wallpaperGrid_.selectedItem = wallpaperInfo; | 774 self.wallpaperGrid_.selectedItem = wallpaperInfo; |
775 self.wallpaperGrid_.activeItem = wallpaperInfo; | 775 self.wallpaperGrid_.activeItem = wallpaperInfo; |
776 }; | 776 }; |
777 | 777 |
778 fileWriter.onerror = errorHandler; | 778 fileWriter.onerror = errorHandler; |
779 | 779 |
780 var blob = new Blob([new Int8Array(thumbnail)], | 780 var blob = new Blob([new Int8Array(thumbnail)], |
781 {'type' : 'image\/jpeg'}); | 781 {'type' : 'image\/jpeg'}); |
782 fileWriter.write(blob); | 782 fileWriter.write(blob); |
783 }, errorHandler); | 783 }, errorHandler); |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 } | 1017 } |
1018 } | 1018 } |
1019 } | 1019 } |
1020 this.wallpaperGrid_.dataModel = wallpapersDataModel; | 1020 this.wallpaperGrid_.dataModel = wallpapersDataModel; |
1021 this.wallpaperGrid_.selectedItem = selectedItem; | 1021 this.wallpaperGrid_.selectedItem = selectedItem; |
1022 this.wallpaperGrid_.activeItem = selectedItem; | 1022 this.wallpaperGrid_.activeItem = selectedItem; |
1023 } | 1023 } |
1024 }; | 1024 }; |
1025 | 1025 |
1026 })(); | 1026 })(); |
OLD | NEW |