| OLD | NEW |
| 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> |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 | 47 |
| 48 bool GetDesktopShortcutTemplate(std::string* output) { | 48 bool GetDesktopShortcutTemplate(std::string* output) { |
| 49 std::vector<std::string> search_paths; | 49 std::vector<std::string> search_paths; |
| 50 | 50 |
| 51 const char* xdg_data_home = getenv("XDG_DATA_HOME"); | 51 const char* xdg_data_home = getenv("XDG_DATA_HOME"); |
| 52 if (xdg_data_home) | 52 if (xdg_data_home) |
| 53 search_paths.push_back(xdg_data_home); | 53 search_paths.push_back(xdg_data_home); |
| 54 | 54 |
| 55 const char* xdg_data_dirs = getenv("XDG_DATA_DIRS"); | 55 const char* xdg_data_dirs = getenv("XDG_DATA_DIRS"); |
| 56 if (xdg_data_dirs) { | 56 if (xdg_data_dirs) { |
| 57 StringTokenizer tokenizer(xdg_data_dirs, ":"); | 57 CStringTokenizer tokenizer(xdg_data_dirs, |
| 58 xdg_data_dirs + strlen(xdg_data_dirs), ":"); |
| 58 while (tokenizer.GetNext()) { | 59 while (tokenizer.GetNext()) { |
| 59 search_paths.push_back(tokenizer.token()); | 60 search_paths.push_back(tokenizer.token()); |
| 60 } | 61 } |
| 61 } | 62 } |
| 62 | 63 |
| 63 std::string template_filename(GetDesktopName()); | 64 std::string template_filename(GetDesktopName()); |
| 64 for (std::vector<std::string>::const_iterator i = search_paths.begin(); | 65 for (std::vector<std::string>::const_iterator i = search_paths.begin(); |
| 65 i != search_paths.end(); ++i) { | 66 i != search_paths.end(); ++i) { |
| 66 FilePath path = FilePath(*i).Append(template_filename); | 67 FilePath path = FilePath(*i).Append(template_filename); |
| 67 if (file_util::PathExists(path)) | 68 if (file_util::PathExists(path)) |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 } | 229 } |
| 229 } | 230 } |
| 230 return output_buffer; | 231 return output_buffer; |
| 231 } | 232 } |
| 232 | 233 |
| 233 void ShellIntegration::CreateDesktopShortcut(const GURL& url, | 234 void ShellIntegration::CreateDesktopShortcut(const GURL& url, |
| 234 const string16& title) { | 235 const string16& title) { |
| 235 g_browser_process->file_thread()->message_loop()->PostTask(FROM_HERE, | 236 g_browser_process->file_thread()->message_loop()->PostTask(FROM_HERE, |
| 236 new CreateDesktopShortcutTask(url, title)); | 237 new CreateDesktopShortcutTask(url, title)); |
| 237 } | 238 } |
| OLD | NEW |