| 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/profiles/profile_shortcut_manager_win.h" | 5 #include "chrome/browser/profiles/profile_shortcut_manager_win.h" |
| 6 | 6 |
| 7 #include <shlobj.h> // For SHChangeNotify(). | 7 #include <shlobj.h> // For SHChangeNotify(). |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 | 668 |
| 669 return sanitized; | 669 return sanitized; |
| 670 } | 670 } |
| 671 | 671 |
| 672 // Returns a copied SkBitmap for the given image that can be safely passed to | 672 // Returns a copied SkBitmap for the given image that can be safely passed to |
| 673 // another thread. | 673 // another thread. |
| 674 SkBitmap GetSkBitmapCopy(const gfx::Image& image) { | 674 SkBitmap GetSkBitmapCopy(const gfx::Image& image) { |
| 675 DCHECK(!image.IsEmpty()); | 675 DCHECK(!image.IsEmpty()); |
| 676 const SkBitmap* image_bitmap = image.ToSkBitmap(); | 676 const SkBitmap* image_bitmap = image.ToSkBitmap(); |
| 677 SkBitmap bitmap_copy; | 677 SkBitmap bitmap_copy; |
| 678 image_bitmap->deepCopyTo(&bitmap_copy); | 678 if (bitmap_copy.tryAllocPixels(image_bitmap->info())) |
| 679 image_bitmap->readPixels(bitmap_copy.info(), bitmap_copy.getPixels(), |
| 680 bitmap_copy.rowBytes(), 0, 0); |
| 679 return bitmap_copy; | 681 return bitmap_copy; |
| 680 } | 682 } |
| 681 | 683 |
| 682 // Returns a copied SkBitmap for the given resource id that can be safely passed | 684 // Returns a copied SkBitmap for the given resource id that can be safely passed |
| 683 // to another thread. | 685 // to another thread. |
| 684 SkBitmap GetImageResourceSkBitmapCopy(int resource_id) { | 686 SkBitmap GetImageResourceSkBitmapCopy(int resource_id) { |
| 685 const gfx::Image image = | 687 const gfx::Image image = |
| 686 ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id); | 688 ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id); |
| 687 return GetSkBitmapCopy(image); | 689 return GetSkBitmapCopy(image); |
| 688 } | 690 } |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1003 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_CREATED, type); | 1005 DCHECK_EQ(chrome::NOTIFICATION_PROFILE_CREATED, type); |
| 1004 | 1006 |
| 1005 Profile* profile = | 1007 Profile* profile = |
| 1006 content::Source<Profile>(source).ptr()->GetOriginalProfile(); | 1008 content::Source<Profile>(source).ptr()->GetOriginalProfile(); |
| 1007 if (profile->GetPrefs()->GetInteger(prefs::kProfileIconVersion) < | 1009 if (profile->GetPrefs()->GetInteger(prefs::kProfileIconVersion) < |
| 1008 kCurrentProfileIconVersion) { | 1010 kCurrentProfileIconVersion) { |
| 1009 // Ensure the profile's icon file has been created. | 1011 // Ensure the profile's icon file has been created. |
| 1010 CreateOrUpdateProfileIcon(profile->GetPath()); | 1012 CreateOrUpdateProfileIcon(profile->GetPath()); |
| 1011 } | 1013 } |
| 1012 } | 1014 } |
| OLD | NEW |