| 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 var WALLPAPER_PICKER_WIDTH = 574; | 5 var WALLPAPER_PICKER_WIDTH = 574; |
| 6 var WALLPAPER_PICKER_HEIGHT = 420; | 6 var WALLPAPER_PICKER_HEIGHT = 420; |
| 7 | 7 |
| 8 var wallpaperPickerWindow; | 8 var wallpaperPickerWindow; |
| 9 | 9 |
| 10 var surpriseWallpaper = null; | 10 var surpriseWallpaper = null; |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 element.available_for_surprise_me == undefined; | 143 element.available_for_surprise_me == undefined; |
| 144 }); | 144 }); |
| 145 var index = Math.floor(Math.random() * filtered.length); | 145 var index = Math.floor(Math.random() * filtered.length); |
| 146 var wallpaper = filtered[index]; | 146 var wallpaper = filtered[index]; |
| 147 var wallpaperURL = wallpaper.base_url + Constants.HighResolutionSuffix; | 147 var wallpaperURL = wallpaper.base_url + Constants.HighResolutionSuffix; |
| 148 var onSuccess = function() { | 148 var onSuccess = function() { |
| 149 WallpaperUtil.saveToStorage( | 149 WallpaperUtil.saveToStorage( |
| 150 Constants.AccessLastSurpriseWallpaperChangedDate, | 150 Constants.AccessLastSurpriseWallpaperChangedDate, |
| 151 dateString, | 151 dateString, |
| 152 true); | 152 true); |
| 153 } | 153 }; |
| 154 WallpaperUtil.setOnlineWallpaper(wallpaperURL, wallpaper.default_layout, | 154 WallpaperUtil.setOnlineWallpaper(wallpaperURL, wallpaper.default_layout, |
| 155 onSuccess, self.retryLater_.bind(self)); | 155 onSuccess, self.retryLater_.bind(self)); |
| 156 } | 156 } |
| 157 }); | 157 }); |
| 158 }; | 158 }; |
| 159 | 159 |
| 160 /** | 160 /** |
| 161 * Sets wallpaper to the wallpaper specified by item from rss. If downloading | 161 * Sets wallpaper to the wallpaper specified by item from rss. If downloading |
| 162 * the wallpaper fails, retry one hour later. | 162 * the wallpaper fails, retry one hour later. |
| 163 * @param {Element} item The wallpaper rss item element. | 163 * @param {Element} item The wallpaper rss item element. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 wallpaperPickerWindow.focus(); | 218 wallpaperPickerWindow.focus(); |
| 219 chrome.wallpaperPrivate.minimizeInactiveWindows(); | 219 chrome.wallpaperPrivate.minimizeInactiveWindows(); |
| 220 return; | 220 return; |
| 221 } | 221 } |
| 222 | 222 |
| 223 chrome.app.window.create('main.html', { | 223 chrome.app.window.create('main.html', { |
| 224 frame: 'none', | 224 frame: 'none', |
| 225 width: WALLPAPER_PICKER_WIDTH, | 225 width: WALLPAPER_PICKER_WIDTH, |
| 226 height: WALLPAPER_PICKER_HEIGHT, | 226 height: WALLPAPER_PICKER_HEIGHT, |
| 227 resizable: false, | 227 resizable: false, |
| 228 transparentBackground: true | 228 alphaEnabled: true |
| 229 }, function(w) { | 229 }, function(w) { |
| 230 wallpaperPickerWindow = w; | 230 wallpaperPickerWindow = w; |
| 231 chrome.wallpaperPrivate.minimizeInactiveWindows(); | 231 chrome.wallpaperPrivate.minimizeInactiveWindows(); |
| 232 w.onClosed.addListener(function() { | 232 w.onClosed.addListener(function() { |
| 233 chrome.wallpaperPrivate.restoreMinimizedWindows(); | 233 chrome.wallpaperPrivate.restoreMinimizedWindows(); |
| 234 }); | 234 }); |
| 235 }); | 235 }); |
| 236 }); | 236 }); |
| 237 | 237 |
| 238 chrome.storage.onChanged.addListener(function(changes, namespace) { | 238 chrome.storage.onChanged.addListener(function(changes, namespace) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 264 WallpaperUtil.setOnlineWallpaper(newValue.url, newValue.layout, | 264 WallpaperUtil.setOnlineWallpaper(newValue.url, newValue.layout, |
| 265 function() {}, function() {}); | 265 function() {}, function() {}); |
| 266 } | 266 } |
| 267 WallpaperUtil.saveToStorage(Constants.AccessLocalWallpaperInfoKey, | 267 WallpaperUtil.saveToStorage(Constants.AccessLocalWallpaperInfoKey, |
| 268 newValue, false); | 268 newValue, false); |
| 269 } | 269 } |
| 270 }); | 270 }); |
| 271 } | 271 } |
| 272 }); | 272 }); |
| 273 | 273 |
| OLD | NEW |