Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(308)

Side by Side Diff: chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc

Issue 2806283002: Revert of Stop passing raw pointers to base::Value API in c/b/chromeos and c/b/extensions (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/ash_constants.h" 9 #include "ash/ash_constants.h"
10 #include "ash/public/interfaces/constants.mojom.h" 10 #include "ash/public/interfaces/constants.mojom.h"
11 #include "ash/shell.h" 11 #include "ash/shell.h"
12 #include "ash/wallpaper/wallpaper_controller.h" 12 #include "ash/wallpaper/wallpaper_controller.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"
19 #include "base/metrics/histogram_macros.h" 18 #include "base/metrics/histogram_macros.h"
20 #include "base/path_service.h" 19 #include "base/path_service.h"
21 #include "base/sha1.h" 20 #include "base/sha1.h"
22 #include "base/strings/string_number_conversions.h" 21 #include "base/strings/string_number_conversions.h"
23 #include "base/sys_info.h" 22 #include "base/sys_info.h"
24 #include "base/task_scheduler/post_task.h" 23 #include "base/task_scheduler/post_task.h"
25 #include "base/threading/thread_task_runner_handle.h" 24 #include "base/threading/thread_task_runner_handle.h"
26 #include "base/threading/worker_pool.h" 25 #include "base/threading/worker_pool.h"
27 #include "base/time/time.h" 26 #include "base/time/time.h"
28 #include "base/trace_event/trace_event.h" 27 #include "base/trace_event/trace_event.h"
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 bool is_persistent) { 706 bool is_persistent) {
708 DCHECK_CURRENTLY_ON(BrowserThread::UI); 707 DCHECK_CURRENTLY_ON(BrowserThread::UI);
709 current_user_wallpaper_info_ = info; 708 current_user_wallpaper_info_ = info;
710 if (!is_persistent) 709 if (!is_persistent)
711 return; 710 return;
712 711
713 PrefService* local_state = g_browser_process->local_state(); 712 PrefService* local_state = g_browser_process->local_state();
714 DictionaryPrefUpdate wallpaper_update(local_state, 713 DictionaryPrefUpdate wallpaper_update(local_state,
715 wallpaper::kUsersWallpaperInfo); 714 wallpaper::kUsersWallpaperInfo);
716 715
717 auto wallpaper_info_dict = base::MakeUnique<base::DictionaryValue>(); 716 base::DictionaryValue* wallpaper_info_dict = new base::DictionaryValue();
718 wallpaper_info_dict->SetString(kNewWallpaperDateNodeName, 717 wallpaper_info_dict->SetString(kNewWallpaperDateNodeName,
719 base::Int64ToString(info.date.ToInternalValue())); 718 base::Int64ToString(info.date.ToInternalValue()));
720 wallpaper_info_dict->SetString(kNewWallpaperLocationNodeName, info.location); 719 wallpaper_info_dict->SetString(kNewWallpaperLocationNodeName, info.location);
721 wallpaper_info_dict->SetInteger(kNewWallpaperLayoutNodeName, info.layout); 720 wallpaper_info_dict->SetInteger(kNewWallpaperLayoutNodeName, info.layout);
722 wallpaper_info_dict->SetInteger(kNewWallpaperTypeNodeName, info.type); 721 wallpaper_info_dict->SetInteger(kNewWallpaperTypeNodeName, info.type);
723 wallpaper_update->SetWithoutPathExpansion(account_id.GetUserEmail(), 722 wallpaper_update->SetWithoutPathExpansion(account_id.GetUserEmail(),
724 std::move(wallpaper_info_dict)); 723 wallpaper_info_dict);
725 } 724 }
726 725
727 void WallpaperManager::ScheduleSetUserWallpaper(const AccountId& account_id, 726 void WallpaperManager::ScheduleSetUserWallpaper(const AccountId& account_id,
728 bool delayed) { 727 bool delayed) {
729 DCHECK_CURRENTLY_ON(BrowserThread::UI); 728 DCHECK_CURRENTLY_ON(BrowserThread::UI);
730 // Some unit tests come here without a UserManager or without a pref system. 729 // Some unit tests come here without a UserManager or without a pref system.
731 if (!user_manager::UserManager::IsInitialized() || 730 if (!user_manager::UserManager::IsInitialized() ||
732 !g_browser_process->local_state()) { 731 !g_browser_process->local_state()) {
733 return; 732 return;
734 } 733 }
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
1387 1386
1388 UMA_HISTOGRAM_ENUMERATION( 1387 UMA_HISTOGRAM_ENUMERATION(
1389 "Ash.Wallpaper.Apps", 1388 "Ash.Wallpaper.Apps",
1390 wallpaper_manager_util::ShouldUseAndroidWallpapersApp(profile) 1389 wallpaper_manager_util::ShouldUseAndroidWallpapersApp(profile)
1391 ? WALLPAPERS_APP_ANDROID 1390 ? WALLPAPERS_APP_ANDROID
1392 : WALLPAPERS_PICKER_APP_CHROMEOS, 1391 : WALLPAPERS_PICKER_APP_CHROMEOS,
1393 WALLPAPERS_APPS_NUM); 1392 WALLPAPERS_APPS_NUM);
1394 } 1393 }
1395 1394
1396 } // namespace chromeos 1395 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698