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 <map> | 7 #include <map> |
8 #include <memory> | 8 #include <memory> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 user_manager::UserManager::Get()->GetActiveUser()->GetAccountId(); | 464 user_manager::UserManager::Get()->GetActiveUser()->GetAccountId(); |
465 wallpaper_manager->SetWallpaperFromImageSkia(account_id_, image, layout, | 465 wallpaper_manager->SetWallpaperFromImageSkia(account_id_, image, layout, |
466 update_wallpaper); | 466 update_wallpaper); |
467 bool is_persistent = !user_manager::UserManager::Get() | 467 bool is_persistent = !user_manager::UserManager::Get() |
468 ->IsCurrentUserNonCryptohomeDataEphemeral(); | 468 ->IsCurrentUserNonCryptohomeDataEphemeral(); |
469 wallpaper::WallpaperInfo info = {params->url, | 469 wallpaper::WallpaperInfo info = {params->url, |
470 layout, | 470 layout, |
471 user_manager::User::ONLINE, | 471 user_manager::User::ONLINE, |
472 base::Time::Now().LocalMidnight()}; | 472 base::Time::Now().LocalMidnight()}; |
473 wallpaper_manager->SetUserWallpaperInfo(account_id_, info, is_persistent); | 473 wallpaper_manager->SetUserWallpaperInfo(account_id_, info, is_persistent); |
474 SetResult(base::MakeUnique<base::FundamentalValue>(true)); | 474 SetResult(base::MakeUnique<base::Value>(true)); |
475 Profile* profile = Profile::FromBrowserContext(browser_context()); | 475 Profile* profile = Profile::FromBrowserContext(browser_context()); |
476 // This API is only available to the component wallpaper picker. We do not | 476 // This API is only available to the component wallpaper picker. We do not |
477 // need to show the app's name if it is the component wallpaper picker. So set | 477 // need to show the app's name if it is the component wallpaper picker. So set |
478 // the pref to empty string. | 478 // the pref to empty string. |
479 profile->GetPrefs()->SetString(prefs::kCurrentWallpaperAppName, | 479 profile->GetPrefs()->SetString(prefs::kCurrentWallpaperAppName, |
480 std::string()); | 480 std::string()); |
481 SendResponse(true); | 481 SendResponse(true); |
482 } | 482 } |
483 | 483 |
484 void WallpaperPrivateSetWallpaperIfExistsFunction::OnFileNotExists( | 484 void WallpaperPrivateSetWallpaperIfExistsFunction::OnFileNotExists( |
485 const std::string& error) { | 485 const std::string& error) { |
486 SetResult(base::MakeUnique<base::FundamentalValue>(false)); | 486 SetResult(base::MakeUnique<base::Value>(false)); |
487 OnFailure(error); | 487 OnFailure(error); |
488 } | 488 } |
489 | 489 |
490 WallpaperPrivateSetWallpaperFunction::WallpaperPrivateSetWallpaperFunction() { | 490 WallpaperPrivateSetWallpaperFunction::WallpaperPrivateSetWallpaperFunction() { |
491 } | 491 } |
492 | 492 |
493 WallpaperPrivateSetWallpaperFunction::~WallpaperPrivateSetWallpaperFunction() { | 493 WallpaperPrivateSetWallpaperFunction::~WallpaperPrivateSetWallpaperFunction() { |
494 } | 494 } |
495 | 495 |
496 bool WallpaperPrivateSetWallpaperFunction::RunAsync() { | 496 bool WallpaperPrivateSetWallpaperFunction::RunAsync() { |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
969 WallpaperPrivateRecordWallpaperUMAFunction::Run() { | 969 WallpaperPrivateRecordWallpaperUMAFunction::Run() { |
970 std::unique_ptr<record_wallpaper_uma::Params> params( | 970 std::unique_ptr<record_wallpaper_uma::Params> params( |
971 record_wallpaper_uma::Params::Create(*args_)); | 971 record_wallpaper_uma::Params::Create(*args_)); |
972 EXTENSION_FUNCTION_VALIDATE(params); | 972 EXTENSION_FUNCTION_VALIDATE(params); |
973 | 973 |
974 user_manager::User::WallpaperType source = getWallpaperType(params->source); | 974 user_manager::User::WallpaperType source = getWallpaperType(params->source); |
975 UMA_HISTOGRAM_ENUMERATION("Ash.Wallpaper.Source", source, | 975 UMA_HISTOGRAM_ENUMERATION("Ash.Wallpaper.Source", source, |
976 user_manager::User::WALLPAPER_TYPE_COUNT); | 976 user_manager::User::WALLPAPER_TYPE_COUNT); |
977 return RespondNow(NoArguments()); | 977 return RespondNow(NoArguments()); |
978 } | 978 } |
OLD | NEW |