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

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

Issue 10883062: Resize and save custom wallpaper to large and small size (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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) 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/user_manager_impl.h" 5 #include "chrome/browser/chromeos/login/user_manager_impl.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/desktop_background/desktop_background_controller.h" 9 #include "ash/desktop_background/desktop_background_controller.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 if (IsCurrentUserEphemeral()) 540 if (IsCurrentUserEphemeral())
541 return; 541 return;
542 const chromeos::User& user = GetLoggedInUser(); 542 const chromeos::User& user = GetLoggedInUser();
543 std::string username = user.email(); 543 std::string username = user.email();
544 DCHECK(!username.empty()); 544 DCHECK(!username.empty());
545 545
546 std::string file_path = WallpaperManager::Get()-> 546 std::string file_path = WallpaperManager::Get()->
547 GetWallpaperPathForUser(username, false).value(); 547 GetWallpaperPathForUser(username, false).value();
548 SaveWallpaperToLocalState(username, file_path, layout, User::CUSTOMIZED); 548 SaveWallpaperToLocalState(username, file_path, layout, User::CUSTOMIZED);
549 // Load wallpaper from file. 549 // Load wallpaper from file.
550 WallpaperManager::Get()->OnUserSelected(username); 550 WallpaperManager::Get()->SetUserWallpaper(username);
551 } 551 }
552 552
553 void UserManagerImpl::SaveUserImageFromFile(const std::string& username, 553 void UserManagerImpl::SaveUserImageFromFile(const std::string& username,
554 const FilePath& path) { 554 const FilePath& path) {
555 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 555 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
556 image_loader_->Start( 556 image_loader_->Start(
557 path.value(), login::kMaxUserImageSize, 557 path.value(), login::kMaxUserImageSize,
558 base::Bind(&UserManagerImpl::SaveUserImage, 558 base::Bind(&UserManagerImpl::SaveUserImage,
559 base::Unretained(this), username)); 559 base::Unretained(this), username));
560 } 560 }
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after
1346 wallpaper_thumb_path)); 1346 wallpaper_thumb_path));
1347 // Remove user wallpaper 1347 // Remove user wallpaper
1348 FilePath wallpaper_path = WallpaperManager::Get()-> 1348 FilePath wallpaper_path = WallpaperManager::Get()->
1349 GetWallpaperPathForUser(email, false); 1349 GetWallpaperPathForUser(email, false);
1350 BrowserThread::PostTask( 1350 BrowserThread::PostTask(
1351 BrowserThread::FILE, 1351 BrowserThread::FILE,
1352 FROM_HERE, 1352 FROM_HERE,
1353 base::Bind(&UserManagerImpl::DeleteUserImage, 1353 base::Bind(&UserManagerImpl::DeleteUserImage,
1354 base::Unretained(this), 1354 base::Unretained(this),
1355 wallpaper_path)); 1355 wallpaper_path));
1356 FilePath wallpaper_original_path = WallpaperManager::Get()->
1357 GetOriginalWallpaperPathForUser(email);
1358 BrowserThread::PostTask(
1359 BrowserThread::FILE,
1360 FROM_HERE,
1361 base::Bind(&UserManagerImpl::DeleteUserImage,
1362 base::Unretained(this),
1363 wallpaper_original_path));
1356 1364
1357 DictionaryPrefUpdate prefs_images_update(prefs, kUserImages); 1365 DictionaryPrefUpdate prefs_images_update(prefs, kUserImages);
1358 std::string image_path_string; 1366 std::string image_path_string;
1359 prefs_images_update->GetStringWithoutPathExpansion(email, &image_path_string); 1367 prefs_images_update->GetStringWithoutPathExpansion(email, &image_path_string);
1360 prefs_images_update->RemoveWithoutPathExpansion(email, NULL); 1368 prefs_images_update->RemoveWithoutPathExpansion(email, NULL);
1361 1369
1362 DictionaryPrefUpdate prefs_oauth_update(prefs, kUserOAuthTokenStatus); 1370 DictionaryPrefUpdate prefs_oauth_update(prefs, kUserOAuthTokenStatus);
1363 int oauth_status; 1371 int oauth_status;
1364 prefs_oauth_update->GetIntegerWithoutPathExpansion(email, &oauth_status); 1372 prefs_oauth_update->GetIntegerWithoutPathExpansion(email, &oauth_status);
1365 prefs_oauth_update->RemoveWithoutPathExpansion(email, NULL); 1373 prefs_oauth_update->RemoveWithoutPathExpansion(email, NULL);
(...skipping 16 matching lines...) Expand all
1382 BrowserThread::PostTask( 1390 BrowserThread::PostTask(
1383 BrowserThread::FILE, 1391 BrowserThread::FILE,
1384 FROM_HERE, 1392 FROM_HERE,
1385 base::Bind(&UserManagerImpl::DeleteUserImage, 1393 base::Bind(&UserManagerImpl::DeleteUserImage,
1386 base::Unretained(this), 1394 base::Unretained(this),
1387 image_path)); 1395 image_path));
1388 } 1396 }
1389 } 1397 }
1390 1398
1391 } // namespace chromeos 1399 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698