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

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

Issue 3029062: base: rename Environment::GetEnv to Environment::GetVar. (Closed) Base URL: git://git.chromium.org/chromium.git
Patch Set: Created 10 years, 4 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
« no previous file with comments | « chrome/browser/browser_init.cc ('k') | chrome/browser/shell_integration_unittest.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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 namespace { 42 namespace {
43 43
44 std::string GetDesktopName(base::Environment* env) { 44 std::string GetDesktopName(base::Environment* env) {
45 #if defined(GOOGLE_CHROME_BUILD) 45 #if defined(GOOGLE_CHROME_BUILD)
46 return "google-chrome.desktop"; 46 return "google-chrome.desktop";
47 #else // CHROMIUM_BUILD 47 #else // CHROMIUM_BUILD
48 // Allow $CHROME_DESKTOP to override the built-in value, so that development 48 // Allow $CHROME_DESKTOP to override the built-in value, so that development
49 // versions can set themselves as the default without interfering with 49 // versions can set themselves as the default without interfering with
50 // non-official, packaged versions using the built-in value. 50 // non-official, packaged versions using the built-in value.
51 std::string name; 51 std::string name;
52 if (env->GetEnv("CHROME_DESKTOP", &name) && !name.empty()) 52 if (env->GetVar("CHROME_DESKTOP", &name) && !name.empty())
53 return name; 53 return name;
54 return "chromium-browser.desktop"; 54 return "chromium-browser.desktop";
55 #endif 55 #endif
56 } 56 }
57 57
58 // Helper to launch xdg scripts. We don't want them to ask any questions on the 58 // Helper to launch xdg scripts. We don't want them to ask any questions on the
59 // terminal etc. 59 // terminal etc.
60 bool LaunchXdgUtility(const std::vector<std::string>& argv) { 60 bool LaunchXdgUtility(const std::vector<std::string>& argv) {
61 // xdg-settings internally runs xdg-mime, which uses mv to move newly-created 61 // xdg-settings internally runs xdg-mime, which uses mv to move newly-created
62 // files on top of originals after making changes to them. In the event that 62 // files on top of originals after making changes to them. In the event that
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 } 247 }
248 248
249 // static 249 // static
250 bool ShellIntegration::GetDesktopShortcutTemplate( 250 bool ShellIntegration::GetDesktopShortcutTemplate(
251 base::Environment* env, std::string* output) { 251 base::Environment* env, std::string* output) {
252 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE)); 252 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE));
253 253
254 std::vector<FilePath> search_paths; 254 std::vector<FilePath> search_paths;
255 255
256 std::string xdg_data_home; 256 std::string xdg_data_home;
257 if (env->GetEnv("XDG_DATA_HOME", &xdg_data_home) && 257 if (env->GetVar("XDG_DATA_HOME", &xdg_data_home) &&
258 !xdg_data_home.empty()) { 258 !xdg_data_home.empty()) {
259 search_paths.push_back(FilePath(xdg_data_home)); 259 search_paths.push_back(FilePath(xdg_data_home));
260 } 260 }
261 261
262 std::string xdg_data_dirs; 262 std::string xdg_data_dirs;
263 if (env->GetEnv("XDG_DATA_DIRS", &xdg_data_dirs) && 263 if (env->GetVar("XDG_DATA_DIRS", &xdg_data_dirs) &&
264 !xdg_data_dirs.empty()) { 264 !xdg_data_dirs.empty()) {
265 StringTokenizer tokenizer(xdg_data_dirs, ":"); 265 StringTokenizer tokenizer(xdg_data_dirs, ":");
266 while (tokenizer.GetNext()) { 266 while (tokenizer.GetNext()) {
267 FilePath data_dir(tokenizer.token()); 267 FilePath data_dir(tokenizer.token());
268 search_paths.push_back(data_dir); 268 search_paths.push_back(data_dir);
269 search_paths.push_back(data_dir.Append("applications")); 269 search_paths.push_back(data_dir.Append("applications"));
270 } 270 }
271 } 271 }
272 272
273 // Add some fallback paths for systems which don't have XDG_DATA_DIRS or have 273 // Add some fallback paths for systems which don't have XDG_DATA_DIRS or have
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 std::string contents = GetDesktopFileContents( 381 std::string contents = GetDesktopFileContents(
382 shortcut_template, shortcut_info.url, shortcut_info.extension_id, 382 shortcut_template, shortcut_info.url, shortcut_info.extension_id,
383 shortcut_info.title, icon_name); 383 shortcut_info.title, icon_name);
384 384
385 if (shortcut_info.create_on_desktop) 385 if (shortcut_info.create_on_desktop)
386 CreateShortcutOnDesktop(shortcut_filename, contents); 386 CreateShortcutOnDesktop(shortcut_filename, contents);
387 387
388 if (shortcut_info.create_in_applications_menu) 388 if (shortcut_info.create_in_applications_menu)
389 CreateShortcutInApplicationsMenu(shortcut_filename, contents); 389 CreateShortcutInApplicationsMenu(shortcut_filename, contents);
390 } 390 }
OLDNEW
« no previous file with comments | « chrome/browser/browser_init.cc ('k') | chrome/browser/shell_integration_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698