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

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

Issue 10453101: Convert most of the rest of chrome to ImageSkia (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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
« no previous file with comments | « chrome/browser/chrome_browser_main.cc ('k') | chrome/browser/custom_home_pages_table_model.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/shell.h" 9 #include "ash/shell.h"
10 #include "ash/desktop_background/desktop_background_controller.h" 10 #include "ash/desktop_background/desktop_background_controller.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "chrome/common/chrome_notification_types.h" 46 #include "chrome/common/chrome_notification_types.h"
47 #include "chrome/common/chrome_paths.h" 47 #include "chrome/common/chrome_paths.h"
48 #include "chrome/common/chrome_switches.h" 48 #include "chrome/common/chrome_switches.h"
49 #include "chrome/common/net/gaia/google_service_auth_error.h" 49 #include "chrome/common/net/gaia/google_service_auth_error.h"
50 #include "content/public/browser/browser_thread.h" 50 #include "content/public/browser/browser_thread.h"
51 #include "content/public/browser/notification_service.h" 51 #include "content/public/browser/notification_service.h"
52 #include "content/public/common/url_constants.h" 52 #include "content/public/common/url_constants.h"
53 #include "skia/ext/image_operations.h" 53 #include "skia/ext/image_operations.h"
54 #include "third_party/skia/include/core/SkBitmap.h" 54 #include "third_party/skia/include/core/SkBitmap.h"
55 #include "ui/gfx/codec/png_codec.h" 55 #include "ui/gfx/codec/png_codec.h"
56 #include "ui/gfx/image/image_skia.h"
56 57
57 using content::BrowserThread; 58 using content::BrowserThread;
58 59
59 typedef GoogleServiceAuthError AuthError; 60 typedef GoogleServiceAuthError AuthError;
60 61
61 namespace chromeos { 62 namespace chromeos {
62 63
63 namespace { 64 namespace {
64 65
65 // Incognito user is represented by an empty string (since some code already 66 // Incognito user is represented by an empty string (since some code already
(...skipping 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after
1275 } 1276 }
1276 return true; 1277 return true;
1277 } 1278 }
1278 1279
1279 void UserManagerImpl::InitDownloadedProfileImage() { 1280 void UserManagerImpl::InitDownloadedProfileImage() {
1280 DCHECK(logged_in_user_); 1281 DCHECK(logged_in_user_);
1281 if (downloaded_profile_image_.empty() && !logged_in_user_->image_is_stub()) { 1282 if (downloaded_profile_image_.empty() && !logged_in_user_->image_is_stub()) {
1282 VLOG(1) << "Profile image initialized"; 1283 VLOG(1) << "Profile image initialized";
1283 downloaded_profile_image_ = logged_in_user_->image(); 1284 downloaded_profile_image_ = logged_in_user_->image();
1284 downloaded_profile_image_data_url_ = 1285 downloaded_profile_image_data_url_ =
1285 web_ui_util::GetImageDataUrl(downloaded_profile_image_); 1286 web_ui_util::GetImageDataUrl(gfx::ImageSkia(downloaded_profile_image_));
1286 } 1287 }
1287 } 1288 }
1288 1289
1289 void UserManagerImpl::DeleteUserImage(const FilePath& image_path) { 1290 void UserManagerImpl::DeleteUserImage(const FilePath& image_path) {
1290 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 1291 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
1291 if (!file_util::Delete(image_path, false)) { 1292 if (!file_util::Delete(image_path, false)) {
1292 LOG(ERROR) << "Failed to remove user image."; 1293 LOG(ERROR) << "Failed to remove user image.";
1293 return; 1294 return;
1294 } 1295 }
1295 } 1296 }
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1355 UMA_HISTOGRAM_ENUMERATION("UserImage.ProfileDownloadResult", 1356 UMA_HISTOGRAM_ENUMERATION("UserImage.ProfileDownloadResult",
1356 result, kDownloadResultsCount); 1357 result, kDownloadResultsCount);
1357 1358
1358 DCHECK(!profile_image_load_start_time_.is_null()); 1359 DCHECK(!profile_image_load_start_time_.is_null());
1359 base::TimeDelta delta = base::Time::Now() - profile_image_load_start_time_; 1360 base::TimeDelta delta = base::Time::Now() - profile_image_load_start_time_;
1360 AddProfileImageTimeHistogram(result, profile_image_download_reason_, delta); 1361 AddProfileImageTimeHistogram(result, profile_image_download_reason_, delta);
1361 1362
1362 if (result == kDownloadSuccess) { 1363 if (result == kDownloadSuccess) {
1363 // Check if this image is not the same as already downloaded. 1364 // Check if this image is not the same as already downloaded.
1364 std::string new_image_data_url = 1365 std::string new_image_data_url =
1365 web_ui_util::GetImageDataUrl(downloader->GetProfilePicture()); 1366 web_ui_util::GetImageDataUrl(gfx::ImageSkia(
1367 downloader->GetProfilePicture()));
1366 if (!downloaded_profile_image_data_url_.empty() && 1368 if (!downloaded_profile_image_data_url_.empty() &&
1367 new_image_data_url == downloaded_profile_image_data_url_) 1369 new_image_data_url == downloaded_profile_image_data_url_)
1368 return; 1370 return;
1369 1371
1370 downloaded_profile_image_data_url_ = new_image_data_url; 1372 downloaded_profile_image_data_url_ = new_image_data_url;
1371 downloaded_profile_image_ = downloader->GetProfilePicture(); 1373 downloaded_profile_image_ = downloader->GetProfilePicture();
1372 1374
1373 if (GetLoggedInUser().image_index() == User::kProfileImageIndex) { 1375 if (GetLoggedInUser().image_index() == User::kProfileImageIndex) {
1374 VLOG(1) << "Updating profile image for logged-in user"; 1376 VLOG(1) << "Updating profile image for logged-in user";
1375 UMA_HISTOGRAM_ENUMERATION("UserImage.ProfileDownloadResult", 1377 UMA_HISTOGRAM_ENUMERATION("UserImage.ProfileDownloadResult",
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 BrowserThread::PostTask( 1467 BrowserThread::PostTask(
1466 BrowserThread::FILE, 1468 BrowserThread::FILE,
1467 FROM_HERE, 1469 FROM_HERE,
1468 base::Bind(&UserManagerImpl::DeleteUserImage, 1470 base::Bind(&UserManagerImpl::DeleteUserImage,
1469 base::Unretained(this), 1471 base::Unretained(this),
1470 image_path)); 1472 image_path));
1471 } 1473 }
1472 } 1474 }
1473 1475
1474 } // namespace chromeos 1476 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chrome_browser_main.cc ('k') | chrome/browser/custom_home_pages_table_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698