OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/ui/webui/options2/chromeos/set_wallpaper_options_handle
r.h" | 5 #include "chrome/browser/ui/webui/options2/chromeos/set_wallpaper_options_handle
r.h" |
6 | 6 |
7 #include "ash/desktop_background/desktop_background_controller.h" | 7 #include "ash/desktop_background/desktop_background_controller.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 void SetWallpaperOptionsHandler::HandleDailyWallpaper(const ListValue* args) { | 241 void SetWallpaperOptionsHandler::HandleDailyWallpaper(const ListValue* args) { |
242 User::WallpaperType type; | 242 User::WallpaperType type; |
243 int index; | 243 int index; |
244 base::Time date; | 244 base::Time date; |
245 WallpaperManager::Get()->GetLoggedInUserWallpaperProperties( | 245 WallpaperManager::Get()->GetLoggedInUserWallpaperProperties( |
246 &type, &index, &date); | 246 &type, &index, &date); |
247 if (date != base::Time::Now().LocalMidnight()) | 247 if (date != base::Time::Now().LocalMidnight()) |
248 index = ash::GetNextWallpaperIndex(index); | 248 index = ash::GetNextWallpaperIndex(index); |
249 UserManager::Get()->SaveLoggedInUserWallpaperProperties(User::DAILY, index); | 249 UserManager::Get()->SaveLoggedInUserWallpaperProperties(User::DAILY, index); |
250 ash::Shell::GetInstance()->desktop_background_controller()-> | 250 ash::Shell::GetInstance()->desktop_background_controller()-> |
251 SetDefaultWallpaper(index); | 251 SetDefaultWallpaper(index, false); |
252 base::StringValue image_url(GetDefaultWallpaperThumbnailURL(index)); | 252 base::StringValue image_url(GetDefaultWallpaperThumbnailURL(index)); |
253 base::FundamentalValue is_daily(true); | 253 base::FundamentalValue is_daily(true); |
254 web_ui()->CallJavascriptFunction("SetWallpaperOptions.setSelectedImage", | 254 web_ui()->CallJavascriptFunction("SetWallpaperOptions.setSelectedImage", |
255 image_url, is_daily); | 255 image_url, is_daily); |
256 } | 256 } |
257 | 257 |
258 gfx::NativeWindow SetWallpaperOptionsHandler::GetBrowserWindow() const { | 258 gfx::NativeWindow SetWallpaperOptionsHandler::GetBrowserWindow() const { |
259 Browser* browser = | 259 Browser* browser = |
260 browser::FindBrowserWithWebContents(web_ui()->GetWebContents()); | 260 browser::FindBrowserWithWebContents(web_ui()->GetWebContents()); |
261 return browser->window()->GetNativeWindow(); | 261 return browser->window()->GetNativeWindow(); |
262 } | 262 } |
263 | 263 |
264 } // namespace options2 | 264 } // namespace options2 |
265 } // namespace chromeos | 265 } // namespace chromeos |
OLD | NEW |