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/multi_display_manager.h" | 10 #include "ash/display/multi_display_manager.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 MessageLoop::current()->Run(); | 85 MessageLoop::current()->Run(); |
86 } | 86 } |
87 | 87 |
88 virtual void OnWallpaperDataChanged() OVERRIDE { | 88 virtual void OnWallpaperDataChanged() OVERRIDE { |
89 MessageLoop::current()->Quit(); | 89 MessageLoop::current()->Quit(); |
90 } | 90 } |
91 | 91 |
92 // Sets |username| wallpaper. | 92 // Sets |username| wallpaper. |
93 void SetUserWallpaper(const std::string& username) { | 93 void SetUserWallpaper(const std::string& username) { |
94 ListPrefUpdate users_pref(local_state_, "LoggedInUsers"); | 94 ListPrefUpdate users_pref(local_state_, "LoggedInUsers"); |
95 users_pref->AppendIfNotPresent(base::Value::CreateStringValue(username)); | 95 users_pref->AppendIfNotPresent(new base::StringValue(username)); |
96 WallpaperManager::Get()->SetUserWallpaper(username); | 96 WallpaperManager::Get()->SetUserWallpaper(username); |
97 } | 97 } |
98 | 98 |
99 protected: | 99 protected: |
100 // Saves bitmap |resource_id| to disk. | 100 // Saves bitmap |resource_id| to disk. |
101 void SaveUserWallpaperData(const std::string& username, | 101 void SaveUserWallpaperData(const std::string& username, |
102 const FilePath& wallpaper_path, | 102 const FilePath& wallpaper_path, |
103 int resource_id) { | 103 int resource_id) { |
104 scoped_refptr<base::RefCountedStaticMemory> image_data( | 104 scoped_refptr<base::RefCountedStaticMemory> image_data( |
105 ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( | 105 ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 UpdateDisplay("800x600,2000x2000"); | 214 UpdateDisplay("800x600,2000x2000"); |
215 WaitAsyncWallpaperLoad(); | 215 WaitAsyncWallpaperLoad(); |
216 wallpaper = controller_->GetWallpaper(); | 216 wallpaper = controller_->GetWallpaper(); |
217 | 217 |
218 // The large resolution custom wallpaper is expected. | 218 // The large resolution custom wallpaper is expected. |
219 EXPECT_EQ(kExpectedLargeWallpaperWidth, wallpaper.width()); | 219 EXPECT_EQ(kExpectedLargeWallpaperWidth, wallpaper.width()); |
220 EXPECT_EQ(kExpectedLargeWallpaperHeight, wallpaper.height()); | 220 EXPECT_EQ(kExpectedLargeWallpaperHeight, wallpaper.height()); |
221 } | 221 } |
222 | 222 |
223 } // namepace chromeos | 223 } // namepace chromeos |
OLD | NEW |