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

Side by Side Diff: chrome/browser/shell_integration_linux.cc

Issue 243076: Move the JPEG and PNG codecs from base/gfx to app/gfx/codec. Move the classes... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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.h" 5 #include "chrome/browser/shell_integration.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 #include <sys/stat.h> 9 #include <sys/stat.h>
10 #include <sys/types.h> 10 #include <sys/types.h>
11 #include <unistd.h> 11 #include <unistd.h>
12 12
13 #include <string> 13 #include <string>
14 #include <vector> 14 #include <vector>
15 15
16 #include "app/gfx/codec/png_codec.h"
16 #include "base/command_line.h" 17 #include "base/command_line.h"
17 #include "base/eintr_wrapper.h" 18 #include "base/eintr_wrapper.h"
18 #include "base/file_path.h" 19 #include "base/file_path.h"
19 #include "base/file_util.h" 20 #include "base/file_util.h"
20 #include "base/gfx/png_encoder.h"
21 #include "base/message_loop.h" 21 #include "base/message_loop.h"
22 #include "base/path_service.h" 22 #include "base/path_service.h"
23 #include "base/process_util.h" 23 #include "base/process_util.h"
24 #include "base/scoped_temp_dir.h" 24 #include "base/scoped_temp_dir.h"
25 #include "base/string_tokenizer.h" 25 #include "base/string_tokenizer.h"
26 #include "base/string_util.h" 26 #include "base/string_util.h"
27 #include "base/task.h" 27 #include "base/task.h"
28 #include "base/thread.h" 28 #include "base/thread.h"
29 #include "chrome/browser/browser_process.h" 29 #include "chrome/browser/browser_process.h"
30 #include "chrome/common/chrome_constants.h" 30 #include "chrome/common/chrome_constants.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 145
146 // TODO(phajdan.jr): Report errors from this function, possibly as infobars. 146 // TODO(phajdan.jr): Report errors from this function, possibly as infobars.
147 ScopedTempDir temp_dir; 147 ScopedTempDir temp_dir;
148 if (!temp_dir.CreateUniqueTempDir()) 148 if (!temp_dir.CreateUniqueTempDir())
149 return std::string(); 149 return std::string();
150 150
151 FilePath temp_file_path = temp_dir.path().Append( 151 FilePath temp_file_path = temp_dir.path().Append(
152 shortcut_filename.ReplaceExtension("png")); 152 shortcut_filename.ReplaceExtension("png"));
153 153
154 std::vector<unsigned char> png_data; 154 std::vector<unsigned char> png_data;
155 PNGEncoder::EncodeBGRASkBitmap(shortcut_info_.favicon, false, &png_data); 155 gfx::PNGCodec::EncodeBGRASkBitmap(shortcut_info_.favicon, false, &png_data);
156 int bytes_written = file_util::WriteFile(temp_file_path, 156 int bytes_written = file_util::WriteFile(temp_file_path,
157 reinterpret_cast<char*>(png_data.data()), png_data.size()); 157 reinterpret_cast<char*>(png_data.data()), png_data.size());
158 158
159 if (bytes_written != static_cast<int>(png_data.size())) 159 if (bytes_written != static_cast<int>(png_data.size()))
160 return std::string(); 160 return std::string();
161 161
162 std::vector<std::string> argv; 162 std::vector<std::string> argv;
163 argv.push_back("xdg-icon-resource"); 163 argv.push_back("xdg-icon-resource");
164 argv.push_back("install"); 164 argv.push_back("install");
165 165
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 } 363 }
364 } 364 }
365 return output_buffer; 365 return output_buffer;
366 } 366 }
367 367
368 void ShellIntegration::CreateDesktopShortcut( 368 void ShellIntegration::CreateDesktopShortcut(
369 const ShortcutInfo& shortcut_info) { 369 const ShortcutInfo& shortcut_info) {
370 g_browser_process->file_thread()->message_loop()->PostTask(FROM_HERE, 370 g_browser_process->file_thread()->message_loop()->PostTask(FROM_HERE,
371 new CreateDesktopShortcutTask(shortcut_info)); 371 new CreateDesktopShortcutTask(shortcut_info));
372 } 372 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698