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

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

Issue 18584011: Rename base::Delete to base::DeleteFile (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
OLDNEW
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/login/wallpaper_manager.h" 5 #include "chrome/browser/chromeos/login/wallpaper_manager.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 } 387 }
388 388
389 void WallpaperManager::ResizeAndSaveWallpaper(const UserImage& wallpaper, 389 void WallpaperManager::ResizeAndSaveWallpaper(const UserImage& wallpaper,
390 const base::FilePath& path, 390 const base::FilePath& path,
391 ash::WallpaperLayout layout, 391 ash::WallpaperLayout layout,
392 int preferred_width, 392 int preferred_width,
393 int preferred_height) { 393 int preferred_height) {
394 if (layout == ash::WALLPAPER_LAYOUT_CENTER) { 394 if (layout == ash::WALLPAPER_LAYOUT_CENTER) {
395 // TODO(bshe): Generates cropped custom wallpaper for CENTER layout. 395 // TODO(bshe): Generates cropped custom wallpaper for CENTER layout.
396 if (base::PathExists(path)) 396 if (base::PathExists(path))
397 base::Delete(path, false); 397 base::DeleteFile(path, false);
398 return; 398 return;
399 } 399 }
400 scoped_refptr<base::RefCountedBytes> data; 400 scoped_refptr<base::RefCountedBytes> data;
401 if (ResizeWallpaper(wallpaper, layout, preferred_width, preferred_height, 401 if (ResizeWallpaper(wallpaper, layout, preferred_width, preferred_height,
402 &data)) { 402 &data)) {
403 SaveWallpaperInternal(path, 403 SaveWallpaperInternal(path,
404 reinterpret_cast<const char*>(data->front()), 404 reinterpret_cast<const char*>(data->front()),
405 data->size()); 405 data->size());
406 } 406 }
407 } 407 }
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 wallpapers_pref->Clear(); 669 wallpapers_pref->Clear();
670 } 670 }
671 671
672 void WallpaperManager::DeleteAllExcept(const base::FilePath& path) { 672 void WallpaperManager::DeleteAllExcept(const base::FilePath& path) {
673 base::FilePath dir = path.DirName(); 673 base::FilePath dir = path.DirName();
674 if (base::DirectoryExists(dir)) { 674 if (base::DirectoryExists(dir)) {
675 base::FileEnumerator files(dir, false, base::FileEnumerator::FILES); 675 base::FileEnumerator files(dir, false, base::FileEnumerator::FILES);
676 for (base::FilePath current = files.Next(); !current.empty(); 676 for (base::FilePath current = files.Next(); !current.empty();
677 current = files.Next()) { 677 current = files.Next()) {
678 if (current != path) 678 if (current != path)
679 base::Delete(current, false); 679 base::DeleteFile(current, false);
680 } 680 }
681 } 681 }
682 } 682 }
683 683
684 void WallpaperManager::DeleteWallpaperInList( 684 void WallpaperManager::DeleteWallpaperInList(
685 const std::vector<base::FilePath>& file_list) { 685 const std::vector<base::FilePath>& file_list) {
686 for (std::vector<base::FilePath>::const_iterator it = file_list.begin(); 686 for (std::vector<base::FilePath>::const_iterator it = file_list.begin();
687 it != file_list.end(); ++it) { 687 it != file_list.end(); ++it) {
688 base::FilePath path = *it; 688 base::FilePath path = *it;
689 // Some users may still have legacy wallpapers with png extension. We need 689 // Some users may still have legacy wallpapers with png extension. We need
690 // to delete these wallpapers too. 690 // to delete these wallpapers too.
691 if (!base::Delete(path, true) && 691 if (!base::DeleteFile(path, true) &&
692 !base::Delete(path.AddExtension(".png"), false)) { 692 !base::DeleteFile(path.AddExtension(".png"), false)) {
693 LOG(ERROR) << "Failed to remove user wallpaper at " << path.value(); 693 LOG(ERROR) << "Failed to remove user wallpaper at " << path.value();
694 } 694 }
695 } 695 }
696 } 696 }
697 697
698 void WallpaperManager::DeleteUserWallpapers(const std::string& email) { 698 void WallpaperManager::DeleteUserWallpapers(const std::string& email) {
699 std::vector<base::FilePath> file_to_remove; 699 std::vector<base::FilePath> file_to_remove;
700 // Remove small user wallpaper. 700 // Remove small user wallpaper.
701 base::FilePath wallpaper_path = GetWallpaperPathForUser(email, true); 701 base::FilePath wallpaper_path = GetWallpaperPathForUser(email, true);
702 file_to_remove.push_back(wallpaper_path); 702 file_to_remove.push_back(wallpaper_path);
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
1098 1098
1099 void WallpaperManager::SystemResumed(const base::TimeDelta& sleep_duration) { 1099 void WallpaperManager::SystemResumed(const base::TimeDelta& sleep_duration) {
1100 BatchUpdateWallpaper(); 1100 BatchUpdateWallpaper();
1101 } 1101 }
1102 1102
1103 void WallpaperManager::TimezoneChanged(const icu::TimeZone& timezone) { 1103 void WallpaperManager::TimezoneChanged(const icu::TimeZone& timezone) {
1104 RestartTimer(); 1104 RestartTimer();
1105 } 1105 }
1106 1106
1107 } // namespace chromeos 1107 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/user_image_manager_impl.cc ('k') | chrome/browser/chromeos/policy/app_pack_updater.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698