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

Side by Side Diff: chrome/browser/ui/metro_pin_tab_helper_win.cc

Issue 184563006: Move WriteFile and WriteFileDescriptor from file_util to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
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/ui/metro_pin_tab_helper_win.h" 5 #include "chrome/browser/ui/metro_pin_tab_helper_win.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/base_paths.h" 9 #include "base/base_paths.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 int left = (kLogoWidth - bitmap.width()) / 2; 101 int left = (kLogoWidth - bitmap.width()) / 2;
102 int top = (kLogoHeight - kCaptionHeight - bitmap.height()) / 2; 102 int top = (kLogoHeight - kCaptionHeight - bitmap.height()) / 2;
103 canvas.DrawImageInt(gfx::ImageSkia::CreateFrom1xBitmap(bitmap), left, top); 103 canvas.DrawImageInt(gfx::ImageSkia::CreateFrom1xBitmap(bitmap), left, top);
104 104
105 SkBitmap logo_bitmap = canvas.ExtractImageRep().sk_bitmap(); 105 SkBitmap logo_bitmap = canvas.ExtractImageRep().sk_bitmap();
106 std::vector<unsigned char> logo_png; 106 std::vector<unsigned char> logo_png;
107 if (!gfx::PNGCodec::EncodeBGRASkBitmap(logo_bitmap, true, &logo_png)) 107 if (!gfx::PNGCodec::EncodeBGRASkBitmap(logo_bitmap, true, &logo_png))
108 return false; 108 return false;
109 109
110 *logo_path = logo_dir.Append(tile_id).ReplaceExtension(L".png"); 110 *logo_path = logo_dir.Append(tile_id).ReplaceExtension(L".png");
111 return file_util::WriteFile(*logo_path, 111 return base::WriteFile(*logo_path,
112 reinterpret_cast<char*>(&logo_png[0]), 112 reinterpret_cast<char*>(&logo_png[0]),
113 logo_png.size()) > 0; 113 logo_png.size()) > 0;
114 } 114 }
115 115
116 // Get the path to the backup logo. If the backup logo already exists in 116 // Get the path to the backup logo. If the backup logo already exists in
117 // |logo_dir|, it will be used, otherwise it will be copied out of the install 117 // |logo_dir|, it will be used, otherwise it will be copied out of the install
118 // folder. (The version in the install folder is not used as it may disappear 118 // folder. (The version in the install folder is not used as it may disappear
119 // after an upgrade, causing tiles to lose their images if Windows rebuilds 119 // after an upgrade, causing tiles to lose their images if Windows rebuilds
120 // its tile image cache.) 120 // its tile image cache.)
121 // The path to the logo is returned in |logo_path|, with the return value 121 // The path to the logo is returned in |logo_path|, with the return value
122 // indicating success. 122 // indicating success.
123 bool GetPathToBackupLogo(const base::FilePath& logo_dir, 123 bool GetPathToBackupLogo(const base::FilePath& logo_dir,
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 450
451 GURL url = web_contents()->GetURL(); 451 GURL url = web_contents()->GetURL();
452 base::string16 tile_id = GenerateTileId(base::UTF8ToUTF16(url.spec())); 452 base::string16 tile_id = GenerateTileId(base::UTF8ToUTF16(url.spec()));
453 metro_un_pin_from_start_screen(tile_id, 453 metro_un_pin_from_start_screen(tile_id,
454 base::Bind(&PinPageReportUmaCallback)); 454 base::Bind(&PinPageReportUmaCallback));
455 } 455 }
456 456
457 void MetroPinTabHelper::FaviconDownloaderFinished() { 457 void MetroPinTabHelper::FaviconDownloaderFinished() {
458 favicon_chooser_.reset(); 458 favicon_chooser_.reset();
459 } 459 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/libgtk2ui/app_indicator_icon.cc ('k') | chrome/browser/ui/network_profile_bubble.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698