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

Side by Side Diff: chrome/browser/win/jumplist.cc

Issue 2852763003: Delete JumpList temp file when failing to write the icon's content to it (Closed)
Patch Set: Fix comments. Created 3 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/win/jumplist.h" 5 #include "chrome/browser/win/jumplist.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 std::vector<float> supported_scales = image_skia.GetSupportedScales(); 107 std::vector<float> supported_scales = image_skia.GetSupportedScales();
108 for (auto& scale : supported_scales) { 108 for (auto& scale : supported_scales) {
109 gfx::ImageSkiaRep image_skia_rep = image_skia.GetRepresentation(scale); 109 gfx::ImageSkiaRep image_skia_rep = image_skia.GetRepresentation(scale);
110 if (!image_skia_rep.is_null()) 110 if (!image_skia_rep.is_null())
111 image_family.Add( 111 image_family.Add(
112 gfx::Image::CreateFrom1xBitmap(image_skia_rep.sk_bitmap())); 112 gfx::Image::CreateFrom1xBitmap(image_skia_rep.sk_bitmap()));
113 } 113 }
114 } 114 }
115 115
116 if (!IconUtil::CreateIconFileFromImageFamily(image_family, path, 116 if (!IconUtil::CreateIconFileFromImageFamily(image_family, path,
117 IconUtil::NORMAL_WRITE)) 117 IconUtil::NORMAL_WRITE)) {
118 // Delete the file created by CreateTemporaryFileInDir as it won't be used.
119 base::DeleteFile(path, false);
118 return false; 120 return false;
121 }
119 122
120 // Add this icon file to the list and return its absolute path. 123 // Add this icon file to the list and return its absolute path.
121 // The IShellLink::SetIcon() function needs the absolute path to an icon. 124 // The IShellLink::SetIcon() function needs the absolute path to an icon.
122 *icon_path = path; 125 *icon_path = path;
123 return true; 126 return true;
124 } 127 }
125 128
126 // Helper method for RunUpdate to create icon files for the asynchrounously 129 // Helper method for RunUpdate to create icon files for the asynchrounously
127 // loaded icons. 130 // loaded icons.
128 void CreateIconFiles(const base::FilePath& icon_dir, 131 void CreateIconFiles(const base::FilePath& icon_dir,
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 void JumpList::TopSitesLoaded(history::TopSites* top_sites) { 704 void JumpList::TopSitesLoaded(history::TopSites* top_sites) {
702 } 705 }
703 706
704 void JumpList::TopSitesChanged(history::TopSites* top_sites, 707 void JumpList::TopSitesChanged(history::TopSites* top_sites,
705 ChangeReason change_reason) { 708 ChangeReason change_reason) {
706 top_sites->GetMostVisitedURLs( 709 top_sites->GetMostVisitedURLs(
707 base::Bind(&JumpList::OnMostVisitedURLsAvailable, 710 base::Bind(&JumpList::OnMostVisitedURLsAvailable,
708 weak_ptr_factory_.GetWeakPtr()), 711 weak_ptr_factory_.GetWeakPtr()),
709 false); 712 false);
710 } 713 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698