OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/login/users/wallpaper/wallpaper_manager.h" | 5 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "ash/common/ash_constants.h" | 9 #include "ash/common/ash_constants.h" |
10 #include "ash/common/wallpaper/wallpaper_controller.h" | 10 #include "ash/common/wallpaper/wallpaper_controller.h" |
11 #include "ash/public/interfaces/constants.mojom.h" | 11 #include "ash/public/interfaces/constants.mojom.h" |
12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
13 #include "base/bind.h" | 13 #include "base/bind.h" |
14 #include "base/bind_helpers.h" | 14 #include "base/bind_helpers.h" |
15 #include "base/command_line.h" | 15 #include "base/command_line.h" |
16 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
| 18 #include "base/memory/ptr_util.h" |
18 #include "base/metrics/histogram_macros.h" | 19 #include "base/metrics/histogram_macros.h" |
19 #include "base/path_service.h" | 20 #include "base/path_service.h" |
20 #include "base/sha1.h" | 21 #include "base/sha1.h" |
21 #include "base/strings/string_number_conversions.h" | 22 #include "base/strings/string_number_conversions.h" |
22 #include "base/sys_info.h" | 23 #include "base/sys_info.h" |
23 #include "base/task_scheduler/post_task.h" | 24 #include "base/task_scheduler/post_task.h" |
24 #include "base/threading/thread_task_runner_handle.h" | 25 #include "base/threading/thread_task_runner_handle.h" |
25 #include "base/threading/worker_pool.h" | 26 #include "base/threading/worker_pool.h" |
26 #include "base/time/time.h" | 27 #include "base/time/time.h" |
27 #include "base/trace_event/trace_event.h" | 28 #include "base/trace_event/trace_event.h" |
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 bool is_persistent) { | 708 bool is_persistent) { |
708 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 709 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
709 current_user_wallpaper_info_ = info; | 710 current_user_wallpaper_info_ = info; |
710 if (!is_persistent) | 711 if (!is_persistent) |
711 return; | 712 return; |
712 | 713 |
713 PrefService* local_state = g_browser_process->local_state(); | 714 PrefService* local_state = g_browser_process->local_state(); |
714 DictionaryPrefUpdate wallpaper_update(local_state, | 715 DictionaryPrefUpdate wallpaper_update(local_state, |
715 wallpaper::kUsersWallpaperInfo); | 716 wallpaper::kUsersWallpaperInfo); |
716 | 717 |
717 base::DictionaryValue* wallpaper_info_dict = new base::DictionaryValue(); | 718 auto wallpaper_info_dict = base::MakeUnique<base::DictionaryValue>(); |
718 wallpaper_info_dict->SetString(kNewWallpaperDateNodeName, | 719 wallpaper_info_dict->SetString(kNewWallpaperDateNodeName, |
719 base::Int64ToString(info.date.ToInternalValue())); | 720 base::Int64ToString(info.date.ToInternalValue())); |
720 wallpaper_info_dict->SetString(kNewWallpaperLocationNodeName, info.location); | 721 wallpaper_info_dict->SetString(kNewWallpaperLocationNodeName, info.location); |
721 wallpaper_info_dict->SetInteger(kNewWallpaperLayoutNodeName, info.layout); | 722 wallpaper_info_dict->SetInteger(kNewWallpaperLayoutNodeName, info.layout); |
722 wallpaper_info_dict->SetInteger(kNewWallpaperTypeNodeName, info.type); | 723 wallpaper_info_dict->SetInteger(kNewWallpaperTypeNodeName, info.type); |
723 wallpaper_update->SetWithoutPathExpansion(account_id.GetUserEmail(), | 724 wallpaper_update->SetWithoutPathExpansion(account_id.GetUserEmail(), |
724 wallpaper_info_dict); | 725 std::move(wallpaper_info_dict)); |
725 } | 726 } |
726 | 727 |
727 void WallpaperManager::ScheduleSetUserWallpaper(const AccountId& account_id, | 728 void WallpaperManager::ScheduleSetUserWallpaper(const AccountId& account_id, |
728 bool delayed) { | 729 bool delayed) { |
729 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 730 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
730 // Some unit tests come here without a UserManager or without a pref system. | 731 // Some unit tests come here without a UserManager or without a pref system. |
731 if (!user_manager::UserManager::IsInitialized() || | 732 if (!user_manager::UserManager::IsInitialized() || |
732 !g_browser_process->local_state()) { | 733 !g_browser_process->local_state()) { |
733 return; | 734 return; |
734 } | 735 } |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1387 | 1388 |
1388 UMA_HISTOGRAM_ENUMERATION( | 1389 UMA_HISTOGRAM_ENUMERATION( |
1389 "Ash.Wallpaper.Apps", | 1390 "Ash.Wallpaper.Apps", |
1390 wallpaper_manager_util::ShouldUseAndroidWallpapersApp(profile) | 1391 wallpaper_manager_util::ShouldUseAndroidWallpapersApp(profile) |
1391 ? WALLPAPERS_APP_ANDROID | 1392 ? WALLPAPERS_APP_ANDROID |
1392 : WALLPAPERS_PICKER_APP_CHROMEOS, | 1393 : WALLPAPERS_PICKER_APP_CHROMEOS, |
1393 WALLPAPERS_APPS_NUM); | 1394 WALLPAPERS_APPS_NUM); |
1394 } | 1395 } |
1395 | 1396 |
1396 } // namespace chromeos | 1397 } // namespace chromeos |
OLD | NEW |