| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 UserManager::Get()->UserLoggedIn(username, username_hash, false); | 123 UserManager::Get()->UserLoggedIn(username, username_hash, false); |
| 124 WaitAsyncWallpaperLoadStarted(); | 124 WaitAsyncWallpaperLoadStarted(); |
| 125 } | 125 } |
| 126 | 126 |
| 127 // Saves bitmap |resource_id| to disk. | 127 // Saves bitmap |resource_id| to disk. |
| 128 void SaveUserWallpaperData(const base::FilePath& wallpaper_path, | 128 void SaveUserWallpaperData(const base::FilePath& wallpaper_path, |
| 129 int resource_id) { | 129 int resource_id) { |
| 130 scoped_refptr<base::RefCountedStaticMemory> image_data( | 130 scoped_refptr<base::RefCountedStaticMemory> image_data( |
| 131 ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( | 131 ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( |
| 132 resource_id, ui::SCALE_FACTOR_100P)); | 132 resource_id, ui::SCALE_FACTOR_100P)); |
| 133 int written = file_util::WriteFile( | 133 int written = base::WriteFile( |
| 134 wallpaper_path, | 134 wallpaper_path, |
| 135 reinterpret_cast<const char*>(image_data->front()), | 135 reinterpret_cast<const char*>(image_data->front()), |
| 136 image_data->size()); | 136 image_data->size()); |
| 137 EXPECT_EQ(static_cast<int>(image_data->size()), written); | 137 EXPECT_EQ(static_cast<int>(image_data->size()), written); |
| 138 } | 138 } |
| 139 | 139 |
| 140 int LoadedWallpapers() { | 140 int LoadedWallpapers() { |
| 141 return WallpaperManager::Get()->loaded_wallpapers(); | 141 return WallpaperManager::Get()->loaded_wallpapers(); |
| 142 } | 142 } |
| 143 | 143 |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 EXPECT_TRUE(test_api->GetWallpaperFromCache(kTestUser1, &cached_wallpaper)); | 546 EXPECT_TRUE(test_api->GetWallpaperFromCache(kTestUser1, &cached_wallpaper)); |
| 547 EXPECT_TRUE(cached_wallpaper.BackedBySameObjectAs(green_wallpaper)); | 547 EXPECT_TRUE(cached_wallpaper.BackedBySameObjectAs(green_wallpaper)); |
| 548 | 548 |
| 549 wallpaper_manager->SetDefaultWallpaperNow(kTestUser1); | 549 wallpaper_manager->SetDefaultWallpaperNow(kTestUser1); |
| 550 WaitAsyncWallpaperLoadFinished(); | 550 WaitAsyncWallpaperLoadFinished(); |
| 551 // SetDefaultWallpaper should invalidate the user's wallpaper cache. | 551 // SetDefaultWallpaper should invalidate the user's wallpaper cache. |
| 552 EXPECT_FALSE(test_api->GetWallpaperFromCache(kTestUser1, &cached_wallpaper)); | 552 EXPECT_FALSE(test_api->GetWallpaperFromCache(kTestUser1, &cached_wallpaper)); |
| 553 } | 553 } |
| 554 | 554 |
| 555 } // namespace chromeos | 555 } // namespace chromeos |
| OLD | NEW |