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/web_applications/web_app.h" | 5 #include "chrome/browser/web_applications/web_app.h" |
6 | 6 |
7 #include <shlobj.h> | 7 #include <shlobj.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 // Calculates image checksum using MD5. | 28 // Calculates image checksum using MD5. |
29 void GetImageCheckSum(const SkBitmap& image, base::MD5Digest* digest) { | 29 void GetImageCheckSum(const SkBitmap& image, base::MD5Digest* digest) { |
30 DCHECK(digest); | 30 DCHECK(digest); |
31 | 31 |
32 SkAutoLockPixels image_lock(image); | 32 SkAutoLockPixels image_lock(image); |
33 MD5Sum(image.getPixels(), image.getSize(), digest); | 33 MD5Sum(image.getPixels(), image.getSize(), digest); |
34 } | 34 } |
35 | 35 |
36 // Saves |image| as an |icon_file| with the checksum. | 36 // Saves |image| as an |icon_file| with the checksum. |
37 bool SaveIconWithCheckSum(const FilePath& icon_file, const SkBitmap& image) { | 37 bool SaveIconWithCheckSum(const FilePath& icon_file, const SkBitmap& image) { |
38 if (!IconUtil::CreateIconFileFromSkBitmap(image, icon_file)) | 38 if (!IconUtil::CreateIconFileFromSkBitmap(image, SkBitmap(), icon_file)) |
39 return false; | 39 return false; |
40 | 40 |
41 base::MD5Digest digest; | 41 base::MD5Digest digest; |
42 GetImageCheckSum(image, &digest); | 42 GetImageCheckSum(image, &digest); |
43 | 43 |
44 FilePath cheksum_file(icon_file.ReplaceExtension(kIconChecksumFileExt)); | 44 FilePath cheksum_file(icon_file.ReplaceExtension(kIconChecksumFileExt)); |
45 return file_util::WriteFile(cheksum_file, | 45 return file_util::WriteFile(cheksum_file, |
46 reinterpret_cast<const char*>(&digest), | 46 reinterpret_cast<const char*>(&digest), |
47 sizeof(digest)) == sizeof(digest); | 47 sizeof(digest)) == sizeof(digest); |
48 } | 48 } |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 // they are all unpinned. | 351 // they are all unpinned. |
352 base::win::TaskbarUnpinShortcutLink(j->value().c_str()); | 352 base::win::TaskbarUnpinShortcutLink(j->value().c_str()); |
353 file_util::Delete(*j, false); | 353 file_util::Delete(*j, false); |
354 } | 354 } |
355 } | 355 } |
356 } | 356 } |
357 | 357 |
358 } // namespace internals | 358 } // namespace internals |
359 | 359 |
360 } // namespace web_app | 360 } // namespace web_app |
OLD | NEW |