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/shell_integration_linux.h" | 5 #include "chrome/browser/shell_integration_linux.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <glib.h> | 8 #include <glib.h> |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 #include <sys/stat.h> | 10 #include <sys/stat.h> |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 it != icon_images.end(); ++it) { | 97 it != icon_images.end(); ++it) { |
98 int width = it->Width(); | 98 int width = it->Width(); |
99 scoped_refptr<base::RefCountedMemory> png_data = it->As1xPNGBytes(); | 99 scoped_refptr<base::RefCountedMemory> png_data = it->As1xPNGBytes(); |
100 if (png_data->size() == 0) { | 100 if (png_data->size() == 0) { |
101 // If the bitmap could not be encoded to PNG format, skip it. | 101 // If the bitmap could not be encoded to PNG format, skip it. |
102 LOG(WARNING) << "Could not encode icon " << icon_name << ".png at size " | 102 LOG(WARNING) << "Could not encode icon " << icon_name << ".png at size " |
103 << width << "."; | 103 << width << "."; |
104 continue; | 104 continue; |
105 } | 105 } |
106 int bytes_written = file_util::WriteFile(temp_file_path, | 106 int bytes_written = file_util::WriteFile(temp_file_path, |
107 reinterpret_cast<const char*>(png_data->front()), png_data->size()); | 107 png_data->front_as<char>(), |
| 108 png_data->size()); |
108 | 109 |
109 if (bytes_written != static_cast<int>(png_data->size())) | 110 if (bytes_written != static_cast<int>(png_data->size())) |
110 return std::string(); | 111 return std::string(); |
111 | 112 |
112 std::vector<std::string> argv; | 113 std::vector<std::string> argv; |
113 argv.push_back("xdg-icon-resource"); | 114 argv.push_back("xdg-icon-resource"); |
114 argv.push_back("install"); | 115 argv.push_back("install"); |
115 | 116 |
116 // Always install in user mode, even if someone runs the browser as root | 117 // Always install in user mode, even if someone runs the browser as root |
117 // (people do that). | 118 // (people do that). |
(...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1026 for (std::vector<base::FilePath>::const_iterator it = | 1027 for (std::vector<base::FilePath>::const_iterator it = |
1027 shortcut_filenames_app_menu.begin(); | 1028 shortcut_filenames_app_menu.begin(); |
1028 it != shortcut_filenames_app_menu.end(); ++it) { | 1029 it != shortcut_filenames_app_menu.end(); ++it) { |
1029 DeleteShortcutInApplicationsMenu(*it, | 1030 DeleteShortcutInApplicationsMenu(*it, |
1030 base::FilePath(kDirectoryFilename)); | 1031 base::FilePath(kDirectoryFilename)); |
1031 } | 1032 } |
1032 } | 1033 } |
1033 } | 1034 } |
1034 | 1035 |
1035 } // namespace ShellIntegrationLinux | 1036 } // namespace ShellIntegrationLinux |
OLD | NEW |