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

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

Issue 2777063003: Stop passing raw pointers to base::Value API in c/b/chromeos and c/b/extensions (Closed)
Patch Set: Just rebased 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"
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 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 bool is_persistent) { 707 bool is_persistent) {
707 DCHECK_CURRENTLY_ON(BrowserThread::UI); 708 DCHECK_CURRENTLY_ON(BrowserThread::UI);
708 current_user_wallpaper_info_ = info; 709 current_user_wallpaper_info_ = info;
709 if (!is_persistent) 710 if (!is_persistent)
710 return; 711 return;
711 712
712 PrefService* local_state = g_browser_process->local_state(); 713 PrefService* local_state = g_browser_process->local_state();
713 DictionaryPrefUpdate wallpaper_update(local_state, 714 DictionaryPrefUpdate wallpaper_update(local_state,
714 wallpaper::kUsersWallpaperInfo); 715 wallpaper::kUsersWallpaperInfo);
715 716
716 base::DictionaryValue* wallpaper_info_dict = new base::DictionaryValue(); 717 auto wallpaper_info_dict = base::MakeUnique<base::DictionaryValue>();
717 wallpaper_info_dict->SetString(kNewWallpaperDateNodeName, 718 wallpaper_info_dict->SetString(kNewWallpaperDateNodeName,
718 base::Int64ToString(info.date.ToInternalValue())); 719 base::Int64ToString(info.date.ToInternalValue()));
719 wallpaper_info_dict->SetString(kNewWallpaperLocationNodeName, info.location); 720 wallpaper_info_dict->SetString(kNewWallpaperLocationNodeName, info.location);
720 wallpaper_info_dict->SetInteger(kNewWallpaperLayoutNodeName, info.layout); 721 wallpaper_info_dict->SetInteger(kNewWallpaperLayoutNodeName, info.layout);
721 wallpaper_info_dict->SetInteger(kNewWallpaperTypeNodeName, info.type); 722 wallpaper_info_dict->SetInteger(kNewWallpaperTypeNodeName, info.type);
722 wallpaper_update->SetWithoutPathExpansion(account_id.GetUserEmail(), 723 wallpaper_update->SetWithoutPathExpansion(account_id.GetUserEmail(),
723 wallpaper_info_dict); 724 std::move(wallpaper_info_dict));
724 } 725 }
725 726
726 void WallpaperManager::ScheduleSetUserWallpaper(const AccountId& account_id, 727 void WallpaperManager::ScheduleSetUserWallpaper(const AccountId& account_id,
727 bool delayed) { 728 bool delayed) {
728 DCHECK_CURRENTLY_ON(BrowserThread::UI); 729 DCHECK_CURRENTLY_ON(BrowserThread::UI);
729 // Some unit tests come here without a UserManager or without a pref system. 730 // Some unit tests come here without a UserManager or without a pref system.
730 if (!user_manager::UserManager::IsInitialized() || 731 if (!user_manager::UserManager::IsInitialized() ||
731 !g_browser_process->local_state()) { 732 !g_browser_process->local_state()) {
732 return; 733 return;
733 } 734 }
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
1386 1387
1387 UMA_HISTOGRAM_ENUMERATION( 1388 UMA_HISTOGRAM_ENUMERATION(
1388 "Ash.Wallpaper.Apps", 1389 "Ash.Wallpaper.Apps",
1389 wallpaper_manager_util::ShouldUseAndroidWallpapersApp(profile) 1390 wallpaper_manager_util::ShouldUseAndroidWallpapersApp(profile)
1390 ? WALLPAPERS_APP_ANDROID 1391 ? WALLPAPERS_APP_ANDROID
1391 : WALLPAPERS_PICKER_APP_CHROMEOS, 1392 : WALLPAPERS_PICKER_APP_CHROMEOS,
1392 WALLPAPERS_APPS_NUM); 1393 WALLPAPERS_APPS_NUM);
1393 } 1394 }
1394 1395
1395 } // namespace chromeos 1396 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698