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

Side by Side Diff: chrome/common/auto_start_linux.cc

Issue 10548019: Cleanup: Consolidate declarations of XDG variables. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 6 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
« no previous file with comments | « base/nix/xdg_util.cc ('k') | chrome/common/chrome_paths_linux.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) 2011 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/common/auto_start_linux.h" 5 #include "chrome/common/auto_start_linux.h"
6 6
7 #include "base/environment.h" 7 #include "base/environment.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/nix/xdg_util.h" 11 #include "base/nix/xdg_util.h"
12 #include "base/string_tokenizer.h" 12 #include "base/string_tokenizer.h"
13 13
14 namespace { 14 namespace {
15 15
16 const FilePath::CharType kAutostart[] = "autostart"; 16 const FilePath::CharType kAutostart[] = "autostart";
17 const FilePath::CharType kConfig[] = ".config";
18 const char kXdgConfigHome[] = "XDG_CONFIG_HOME";
19 17
20 FilePath GetAutostartDirectory(base::Environment* environment) { 18 FilePath GetAutostartDirectory(base::Environment* environment) {
21 FilePath result = 19 FilePath result = base::nix::GetXDGDirectory(environment,
22 base::nix::GetXDGDirectory(environment, kXdgConfigHome, kConfig); 20 base::nix::kXdgConfigHomeEnvVar,
21 base::nix::kDotConfigDir);
23 result = result.Append(kAutostart); 22 result = result.Append(kAutostart);
24 return result; 23 return result;
25 } 24 }
26 25
27 } // namespace 26 } // namespace
28 27
29 bool AutoStart::AddApplication(const std::string& autostart_filename, 28 bool AutoStart::AddApplication(const std::string& autostart_filename,
30 const std::string& application_name, 29 const std::string& application_name,
31 const std::string& command_line, 30 const std::string& command_line,
32 bool is_terminal_app) { 31 bool is_terminal_app) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 StringTokenizer tokenizer(contents, "\n"); 78 StringTokenizer tokenizer(contents, "\n");
80 std::string token = value_name + "="; 79 std::string token = value_name + "=";
81 while (tokenizer.GetNext()) { 80 while (tokenizer.GetNext()) {
82 if (tokenizer.token().substr(0, token.length()) == token) { 81 if (tokenizer.token().substr(0, token.length()) == token) {
83 *value = tokenizer.token().substr(token.length()); 82 *value = tokenizer.token().substr(token.length());
84 return true; 83 return true;
85 } 84 }
86 } 85 }
87 return false; 86 return false;
88 } 87 }
OLDNEW
« no previous file with comments | « base/nix/xdg_util.cc ('k') | chrome/common/chrome_paths_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698