| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/ash_resources/grit/ash_resources.h" | 7 #include "ash/ash_resources/grit/ash_resources.h" |
| 8 #include "ash/desktop_background/desktop_background_controller.h" | 8 #include "ash/desktop_background/desktop_background_controller.h" |
| 9 #include "ash/desktop_background/desktop_background_controller_observer.h" | 9 #include "ash/desktop_background/desktop_background_controller_observer.h" |
| 10 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 protected: | 96 protected: |
| 97 // Return custom wallpaper path. Create directory if not exist. | 97 // Return custom wallpaper path. Create directory if not exist. |
| 98 base::FilePath GetCustomWallpaperPath(const char* sub_dir, | 98 base::FilePath GetCustomWallpaperPath(const char* sub_dir, |
| 99 const std::string& username_hash, | 99 const std::string& username_hash, |
| 100 const std::string& id) { | 100 const std::string& id) { |
| 101 base::FilePath wallpaper_path = | 101 base::FilePath wallpaper_path = |
| 102 WallpaperManager::Get()->GetCustomWallpaperPath(sub_dir, | 102 WallpaperManager::Get()->GetCustomWallpaperPath(sub_dir, |
| 103 username_hash, | 103 username_hash, |
| 104 id); | 104 id); |
| 105 if (!base::DirectoryExists(wallpaper_path.DirName())) | 105 if (!base::DirectoryExists(wallpaper_path.DirName())) |
| 106 file_util::CreateDirectory(wallpaper_path.DirName()); | 106 base::CreateDirectory(wallpaper_path.DirName()); |
| 107 | 107 |
| 108 return wallpaper_path; | 108 return wallpaper_path; |
| 109 } | 109 } |
| 110 | 110 |
| 111 // Logs in |username|. | 111 // Logs in |username|. |
| 112 void LogIn(const std::string& username, const std::string& username_hash) { | 112 void LogIn(const std::string& username, const std::string& username_hash) { |
| 113 UserManager::Get()->UserLoggedIn(username, username_hash, false); | 113 UserManager::Get()->UserLoggedIn(username, username_hash, false); |
| 114 } | 114 } |
| 115 | 115 |
| 116 // Saves bitmap |resource_id| to disk. | 116 // Saves bitmap |resource_id| to disk. |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 } | 417 } |
| 418 | 418 |
| 419 // Test for crbug.com/270278. It simulates a browser crash and verifies if user | 419 // Test for crbug.com/270278. It simulates a browser crash and verifies if user |
| 420 // wallpaper is loaded. | 420 // wallpaper is loaded. |
| 421 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestCrashRestore, | 421 IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTestCrashRestore, |
| 422 RestoreWallpaper) { | 422 RestoreWallpaper) { |
| 423 EXPECT_EQ(1, LoadedWallpapers()); | 423 EXPECT_EQ(1, LoadedWallpapers()); |
| 424 } | 424 } |
| 425 | 425 |
| 426 } // namespace chromeos | 426 } // namespace chromeos |
| OLD | NEW |