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 #include "chrome/browser/chromeos/extensions/wallpaper_private_api.h" | 5 #include "chrome/browser/chromeos/extensions/wallpaper_private_api.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
10 #include "ash/desktop_background/desktop_background_controller.h" | 10 #include "ash/desktop_background/desktop_background_controller.h" |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 user_id_, image, layout, update_wallpaper); | 377 user_id_, image, layout, update_wallpaper); |
378 bool is_persistent = | 378 bool is_persistent = |
379 !chromeos::UserManager::Get()->IsCurrentUserNonCryptohomeDataEphemeral(); | 379 !chromeos::UserManager::Get()->IsCurrentUserNonCryptohomeDataEphemeral(); |
380 chromeos::WallpaperInfo info = { | 380 chromeos::WallpaperInfo info = { |
381 params->url, | 381 params->url, |
382 layout, | 382 layout, |
383 chromeos::User::ONLINE, | 383 chromeos::User::ONLINE, |
384 base::Time::Now().LocalMidnight() | 384 base::Time::Now().LocalMidnight() |
385 }; | 385 }; |
386 wallpaper_manager->SetUserWallpaperInfo(user_id_, info, is_persistent); | 386 wallpaper_manager->SetUserWallpaperInfo(user_id_, info, is_persistent); |
387 SetResult(base::Value::CreateBooleanValue(true)); | 387 SetResult(new base::FundamentalValue(true)); |
388 Profile* profile = Profile::FromBrowserContext(browser_context()); | 388 Profile* profile = Profile::FromBrowserContext(browser_context()); |
389 // This API is only available to the component wallpaper picker. We do not | 389 // This API is only available to the component wallpaper picker. We do not |
390 // need to show the app's name if it is the component wallpaper picker. So set | 390 // need to show the app's name if it is the component wallpaper picker. So set |
391 // the pref to empty string. | 391 // the pref to empty string. |
392 profile->GetPrefs()->SetString(prefs::kCurrentWallpaperAppName, | 392 profile->GetPrefs()->SetString(prefs::kCurrentWallpaperAppName, |
393 std::string()); | 393 std::string()); |
394 SendResponse(true); | 394 SendResponse(true); |
395 } | 395 } |
396 | 396 |
397 void WallpaperPrivateSetWallpaperIfExistsFunction::OnFileNotExists( | 397 void WallpaperPrivateSetWallpaperIfExistsFunction::OnFileNotExists( |
398 const std::string& error) { | 398 const std::string& error) { |
399 SetResult(base::Value::CreateBooleanValue(false)); | 399 SetResult(new base::FundamentalValue(false)); |
400 OnFailure(error); | 400 OnFailure(error); |
401 } | 401 } |
402 | 402 |
403 WallpaperPrivateSetWallpaperFunction::WallpaperPrivateSetWallpaperFunction() { | 403 WallpaperPrivateSetWallpaperFunction::WallpaperPrivateSetWallpaperFunction() { |
404 } | 404 } |
405 | 405 |
406 WallpaperPrivateSetWallpaperFunction::~WallpaperPrivateSetWallpaperFunction() { | 406 WallpaperPrivateSetWallpaperFunction::~WallpaperPrivateSetWallpaperFunction() { |
407 } | 407 } |
408 | 408 |
409 bool WallpaperPrivateSetWallpaperFunction::RunAsync() { | 409 bool WallpaperPrivateSetWallpaperFunction::RunAsync() { |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 this, file_list)); | 885 this, file_list)); |
886 } | 886 } |
887 | 887 |
888 void WallpaperPrivateGetOfflineWallpaperListFunction::OnComplete( | 888 void WallpaperPrivateGetOfflineWallpaperListFunction::OnComplete( |
889 const std::vector<std::string>& file_list) { | 889 const std::vector<std::string>& file_list) { |
890 base::ListValue* results = new base::ListValue(); | 890 base::ListValue* results = new base::ListValue(); |
891 results->AppendStrings(file_list); | 891 results->AppendStrings(file_list); |
892 SetResult(results); | 892 SetResult(results); |
893 SendResponse(true); | 893 SendResponse(true); |
894 } | 894 } |
OLD | NEW |