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

Side by Side Diff: chrome/browser/ui/libgtk2ui/app_indicator_icon.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
« no previous file with comments | « chrome/browser/ui/certificate_dialogs.cc ('k') | chrome/browser/ui/metro_pin_tab_helper_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/libgtk2ui/app_indicator_icon.h" 5 #include "chrome/browser/ui/libgtk2ui/app_indicator_icon.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 #include <dlfcn.h> 8 #include <dlfcn.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 base::FilePath new_file_path; 137 base::FilePath new_file_path;
138 138
139 // Create a new temporary directory for each image since using a single 139 // Create a new temporary directory for each image since using a single
140 // temporary directory seems to have issues when changing icons in quick 140 // temporary directory seems to have issues when changing icons in quick
141 // succession. 141 // succession.
142 if (!base::CreateNewTempDirectory(base::FilePath::StringType(), &temp_dir)) 142 if (!base::CreateNewTempDirectory(base::FilePath::StringType(), &temp_dir))
143 return base::FilePath(); 143 return base::FilePath();
144 new_file_path = 144 new_file_path =
145 temp_dir.Append(id + base::StringPrintf("_%d.png", icon_change_count)); 145 temp_dir.Append(id + base::StringPrintf("_%d.png", icon_change_count));
146 int bytes_written = 146 int bytes_written =
147 file_util::WriteFile(new_file_path, 147 base::WriteFile(new_file_path,
148 png_data->front_as<char>(), 148 png_data->front_as<char>(), png_data->size());
149 png_data->size());
150 149
151 if (bytes_written != static_cast<int>(png_data->size())) 150 if (bytes_written != static_cast<int>(png_data->size()))
152 return base::FilePath(); 151 return base::FilePath();
153 return new_file_path; 152 return new_file_path;
154 } 153 }
155 154
156 void DeleteTempImagePath(const base::FilePath& icon_file_path) { 155 void DeleteTempImagePath(const base::FilePath& icon_file_path) {
157 if (icon_file_path.empty()) 156 if (icon_file_path.empty())
158 return; 157 return;
159 base::DeleteFile(icon_file_path, true); 158 base::DeleteFile(icon_file_path, true);
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 int id; 362 int id;
364 if (!GetMenuItemID(menu_item, &id)) 363 if (!GetMenuItemID(menu_item, &id))
365 return; 364 return;
366 365
367 // The menu item can still be activated by hotkeys even if it is disabled. 366 // The menu item can still be activated by hotkeys even if it is disabled.
368 if (menu_model_->IsEnabledAt(id)) 367 if (menu_model_->IsEnabledAt(id))
369 ExecuteCommand(model, id); 368 ExecuteCommand(model, id);
370 } 369 }
371 370
372 } // namespace libgtk2ui 371 } // namespace libgtk2ui
OLDNEW
« no previous file with comments | « chrome/browser/ui/certificate_dialogs.cc ('k') | chrome/browser/ui/metro_pin_tab_helper_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698