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

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

Issue 4011001: Convert LOG(INFO) to VLOG(1) - chrome/browser/chromeos/login/.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 2 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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.h" 5 #include "chrome/browser/chromeos/login/user_manager.h"
6 6
7 #include "app/resource_bundle.h" 7 #include "app/resource_bundle.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 static UserManager* user_manager_ = NULL; 62 static UserManager* user_manager_ = NULL;
63 63
64 // Stores path to the image in local state. Runs on UI thread. 64 // Stores path to the image in local state. Runs on UI thread.
65 void SavePathToLocalState(const std::string& username, 65 void SavePathToLocalState(const std::string& username,
66 const std::string& image_path) { 66 const std::string& image_path) {
67 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 67 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
68 PrefService* local_state = g_browser_process->local_state(); 68 PrefService* local_state = g_browser_process->local_state();
69 DictionaryValue* images = 69 DictionaryValue* images =
70 local_state->GetMutableDictionary(kUserImages); 70 local_state->GetMutableDictionary(kUserImages);
71 images->SetWithoutPathExpansion(username, new StringValue(image_path)); 71 images->SetWithoutPathExpansion(username, new StringValue(image_path));
72 DLOG(INFO) << "Saving path to user image in Local State."; 72 DVLOG(1) << "Saving path to user image in Local State.";
73 local_state->SavePersistentPrefs(); 73 local_state->SavePersistentPrefs();
74 } 74 }
75 75
76 // Saves image to file with specified path. Runs on FILE thread. 76 // Saves image to file with specified path. Runs on FILE thread.
77 // Posts task for saving image path to local state on UI thread. 77 // Posts task for saving image path to local state on UI thread.
78 void SaveImageToFile(const SkBitmap& image, 78 void SaveImageToFile(const SkBitmap& image,
79 const FilePath& image_path, 79 const FilePath& image_path,
80 const std::string& username) { 80 const std::string& username) {
81 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 81 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
82 std::vector<unsigned char> encoded_image; 82 std::vector<unsigned char> encoded_image;
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 OnImageLoaded(logged_in_user_.email(), image); 294 OnImageLoaded(logged_in_user_.email(), image);
295 } 295 }
296 296
297 void UserManager::SaveUserImage(const std::string& username, 297 void UserManager::SaveUserImage(const std::string& username,
298 const SkBitmap& image) { 298 const SkBitmap& image) {
299 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 299 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
300 std::string filename = username + ".png"; 300 std::string filename = username + ".png";
301 FilePath user_data_dir; 301 FilePath user_data_dir;
302 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir); 302 PathService::Get(chrome::DIR_USER_DATA, &user_data_dir);
303 FilePath image_path = user_data_dir.AppendASCII(filename); 303 FilePath image_path = user_data_dir.AppendASCII(filename);
304 DLOG(INFO) << "Saving user image to " << image_path.value(); 304 DVLOG(1) << "Saving user image to " << image_path.value();
305 305
306 BrowserThread::PostTask( 306 BrowserThread::PostTask(
307 BrowserThread::FILE, 307 BrowserThread::FILE,
308 FROM_HERE, 308 FROM_HERE,
309 NewRunnableFunction(&SaveImageToFile, 309 NewRunnableFunction(&SaveImageToFile,
310 image, image_path, username)); 310 image, image_path, username));
311 } 311 }
312 312
313 void UserManager::SetDefaultUserImage(const std::string& username) { 313 void UserManager::SetDefaultUserImage(const std::string& username) {
314 if (!g_browser_process) 314 if (!g_browser_process)
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 int resource_id = kDefaultImageResources[selected_id]; 348 int resource_id = kDefaultImageResources[selected_id];
349 SkBitmap user_image = *ResourceBundle::GetSharedInstance().GetBitmapNamed( 349 SkBitmap user_image = *ResourceBundle::GetSharedInstance().GetBitmapNamed(
350 resource_id); 350 resource_id);
351 351
352 SavePathToLocalState(username, user_image_path); 352 SavePathToLocalState(username, user_image_path);
353 SetLoggedInUserImage(user_image); 353 SetLoggedInUserImage(user_image);
354 } 354 }
355 355
356 void UserManager::OnImageLoaded(const std::string& username, 356 void UserManager::OnImageLoaded(const std::string& username,
357 const SkBitmap& image) { 357 const SkBitmap& image) {
358 DLOG(INFO) << "Loaded image for " << username; 358 DVLOG(1) << "Loaded image for " << username;
359 user_images_[username] = image; 359 user_images_[username] = image;
360 User user; 360 User user;
361 user.set_email(username); 361 user.set_email(username);
362 user.set_image(image); 362 user.set_image(image);
363 NotificationService::current()->Notify( 363 NotificationService::current()->Notify(
364 NotificationType::LOGIN_USER_IMAGE_CHANGED, 364 NotificationType::LOGIN_USER_IMAGE_CHANGED,
365 Source<UserManager>(this), 365 Source<UserManager>(this),
366 Details<const User>(&user)); 366 Details<const User>(&user));
367 } 367 }
368 368
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 void UserManager::Observe(NotificationType type, 402 void UserManager::Observe(NotificationType type,
403 const NotificationSource& source, 403 const NotificationSource& source,
404 const NotificationDetails& details) { 404 const NotificationDetails& details) {
405 if (type == NotificationType::OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED) { 405 if (type == NotificationType::OWNER_KEY_FETCH_ATTEMPT_SUCCEEDED) {
406 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, 406 BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
407 NewRunnableFunction(&CheckOwnership)); 407 NewRunnableFunction(&CheckOwnership));
408 } 408 }
409 } 409 }
410 410
411 } // namespace chromeos 411 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/user_image_downloader.cc ('k') | chrome/browser/chromeos/login/wizard_accessibility_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698