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_win.h" | 5 #include "chrome/browser/web_applications/web_app_win.h" |
6 | 6 |
7 #include <shlobj.h> | 7 #include <shlobj.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 // The checksum is derived from all of the icons in the family. | 46 // The checksum is derived from all of the icons in the family. |
47 void GetImageCheckSum(const gfx::ImageFamily& image, base::MD5Digest* digest) { | 47 void GetImageCheckSum(const gfx::ImageFamily& image, base::MD5Digest* digest) { |
48 DCHECK(digest); | 48 DCHECK(digest); |
49 base::MD5Context md5_context; | 49 base::MD5Context md5_context; |
50 base::MD5Init(&md5_context); | 50 base::MD5Init(&md5_context); |
51 | 51 |
52 for (gfx::ImageFamily::const_iterator it = image.begin(); it != image.end(); | 52 for (gfx::ImageFamily::const_iterator it = image.begin(); it != image.end(); |
53 ++it) { | 53 ++it) { |
54 SkBitmap bitmap = it->AsBitmap(); | 54 SkBitmap bitmap = it->AsBitmap(); |
55 | 55 |
56 SkAutoLockPixels image_lock(bitmap); | |
57 base::StringPiece image_data( | 56 base::StringPiece image_data( |
58 reinterpret_cast<const char*>(bitmap.getPixels()), bitmap.getSize()); | 57 reinterpret_cast<const char*>(bitmap.getPixels()), bitmap.getSize()); |
59 base::MD5Update(&md5_context, image_data); | 58 base::MD5Update(&md5_context, image_data); |
60 } | 59 } |
61 | 60 |
62 base::MD5Final(digest, &md5_context); | 61 base::MD5Final(digest, &md5_context); |
63 } | 62 } |
64 | 63 |
65 // Saves |image| as an |icon_file| with the checksum. | 64 // Saves |image| as an |icon_file| with the checksum. |
66 bool SaveIconWithCheckSum(const base::FilePath& icon_file, | 65 bool SaveIconWithCheckSum(const base::FilePath& icon_file, |
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 | 611 |
613 } // namespace internals | 612 } // namespace internals |
614 | 613 |
615 void UpdateShortcutForTabContents(content::WebContents* web_contents) { | 614 void UpdateShortcutForTabContents(content::WebContents* web_contents) { |
616 // UpdateShortcutWorker will delete itself when it's done. | 615 // UpdateShortcutWorker will delete itself when it's done. |
617 UpdateShortcutWorker* worker = new UpdateShortcutWorker(web_contents); | 616 UpdateShortcutWorker* worker = new UpdateShortcutWorker(web_contents); |
618 worker->Run(); | 617 worker->Run(); |
619 } | 618 } |
620 | 619 |
621 } // namespace web_app | 620 } // namespace web_app |
OLD | NEW |