OLD | NEW |
---|---|
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 Loading... | |
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>(), |
viettrungluu
2014/02/28 21:47:24
"
| |
149 png_data->size()); | 149 png_data->size()); |
150 | 150 |
151 if (bytes_written != static_cast<int>(png_data->size())) | 151 if (bytes_written != static_cast<int>(png_data->size())) |
152 return base::FilePath(); | 152 return base::FilePath(); |
153 return new_file_path; | 153 return new_file_path; |
154 } | 154 } |
155 | 155 |
156 void DeleteTempImagePath(const base::FilePath& icon_file_path) { | 156 void DeleteTempImagePath(const base::FilePath& icon_file_path) { |
157 if (icon_file_path.empty()) | 157 if (icon_file_path.empty()) |
158 return; | 158 return; |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
363 int id; | 363 int id; |
364 if (!GetMenuItemID(menu_item, &id)) | 364 if (!GetMenuItemID(menu_item, &id)) |
365 return; | 365 return; |
366 | 366 |
367 // The menu item can still be activated by hotkeys even if it is disabled. | 367 // The menu item can still be activated by hotkeys even if it is disabled. |
368 if (menu_model_->IsEnabledAt(id)) | 368 if (menu_model_->IsEnabledAt(id)) |
369 ExecuteCommand(model, id); | 369 ExecuteCommand(model, id); |
370 } | 370 } |
371 | 371 |
372 } // namespace libgtk2ui | 372 } // namespace libgtk2ui |
OLD | NEW |