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/desktop_background/desktop_background_resources.h" | 7 #include "ash/desktop_background/desktop_background_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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 MessageLoop::current()->Run(); | 81 MessageLoop::current()->Run(); |
82 } | 82 } |
83 | 83 |
84 virtual void OnWallpaperDataChanged() OVERRIDE { | 84 virtual void OnWallpaperDataChanged() OVERRIDE { |
85 MessageLoop::current()->Quit(); | 85 MessageLoop::current()->Quit(); |
86 } | 86 } |
87 | 87 |
88 // Sets |username| wallpaper. | 88 // Sets |username| wallpaper. |
89 void SetUserWallpaper(const std::string& username) { | 89 void SetUserWallpaper(const std::string& username) { |
90 ListPrefUpdate users_pref(local_state_, "LoggedInUsers"); | 90 ListPrefUpdate users_pref(local_state_, "LoggedInUsers"); |
91 users_pref->AppendIfNotPresent(base::Value::CreateStringValue(username)); | 91 users_pref->AppendIfNotPresent(new base::StringValue(username)); |
92 WallpaperManager::Get()->SetUserWallpaper(username); | 92 WallpaperManager::Get()->SetUserWallpaper(username); |
93 } | 93 } |
94 | 94 |
95 protected: | 95 protected: |
96 // Saves bitmap |resource_id| to disk. | 96 // Saves bitmap |resource_id| to disk. |
97 void SaveUserWallpaperData(const std::string& username, | 97 void SaveUserWallpaperData(const std::string& username, |
98 const FilePath& wallpaper_path, | 98 const FilePath& wallpaper_path, |
99 int resource_id) { | 99 int resource_id) { |
100 scoped_refptr<base::RefCountedStaticMemory> image_data( | 100 scoped_refptr<base::RefCountedStaticMemory> image_data( |
101 ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( | 101 ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 // Loads the same wallpaper before the initial one finished. It should be | 265 // Loads the same wallpaper before the initial one finished. It should be |
266 // prevented. | 266 // prevented. |
267 SetUserWallpaper(kTestUser1); | 267 SetUserWallpaper(kTestUser1); |
268 EXPECT_EQ(2, LoadedWallpapers()); | 268 EXPECT_EQ(2, LoadedWallpapers()); |
269 WaitAsyncWallpaperLoad(); | 269 WaitAsyncWallpaperLoad(); |
270 SetUserWallpaper(kTestUser1); | 270 SetUserWallpaper(kTestUser1); |
271 EXPECT_EQ(2, LoadedWallpapers()); | 271 EXPECT_EQ(2, LoadedWallpapers()); |
272 } | 272 } |
273 | 273 |
274 } // namepace chromeos | 274 } // namepace chromeos |
OLD | NEW |