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 | 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // Saves |image| as an |icon_file| with the checksum. | 57 // Saves |image| as an |icon_file| with the checksum. |
58 bool SaveIconWithCheckSum(const base::FilePath& icon_file, | 58 bool SaveIconWithCheckSum(const base::FilePath& icon_file, |
59 const gfx::ImageFamily& image) { | 59 const gfx::ImageFamily& image) { |
60 if (!IconUtil::CreateIconFileFromImageFamily(image, icon_file)) | 60 if (!IconUtil::CreateIconFileFromImageFamily(image, icon_file)) |
61 return false; | 61 return false; |
62 | 62 |
63 base::MD5Digest digest; | 63 base::MD5Digest digest; |
64 GetImageCheckSum(image, &digest); | 64 GetImageCheckSum(image, &digest); |
65 | 65 |
66 base::FilePath cheksum_file(icon_file.ReplaceExtension(kIconChecksumFileExt)); | 66 base::FilePath cheksum_file(icon_file.ReplaceExtension(kIconChecksumFileExt)); |
67 return file_util::WriteFile(cheksum_file, | 67 return base::WriteFile(cheksum_file, |
68 reinterpret_cast<const char*>(&digest), | 68 reinterpret_cast<const char*>(&digest), |
69 sizeof(digest)) == sizeof(digest); | 69 sizeof(digest)) == sizeof(digest); |
70 } | 70 } |
71 | 71 |
72 // Returns true if |icon_file| is missing or different from |image|. | 72 // Returns true if |icon_file| is missing or different from |image|. |
73 bool ShouldUpdateIcon(const base::FilePath& icon_file, | 73 bool ShouldUpdateIcon(const base::FilePath& icon_file, |
74 const gfx::ImageFamily& image) { | 74 const gfx::ImageFamily& image) { |
75 base::FilePath checksum_file( | 75 base::FilePath checksum_file( |
76 icon_file.ReplaceExtension(kIconChecksumFileExt)); | 76 icon_file.ReplaceExtension(kIconChecksumFileExt)); |
77 | 77 |
78 // Returns true if icon_file or checksum file is missing. | 78 // Returns true if icon_file or checksum file is missing. |
79 if (!base::PathExists(icon_file) || | 79 if (!base::PathExists(icon_file) || |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 } | 531 } |
532 shortcut_paths.push_back(path); | 532 shortcut_paths.push_back(path); |
533 } | 533 } |
534 } | 534 } |
535 return shortcut_paths; | 535 return shortcut_paths; |
536 } | 536 } |
537 | 537 |
538 } // namespace internals | 538 } // namespace internals |
539 | 539 |
540 } // namespace web_app | 540 } // namespace web_app |
OLD | NEW |