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

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

Issue 19052005: Move PathIsWritable, DirectoryExists, ContentsEqual, and TextContentsEqual to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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) 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/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_util.h" 8 #include "base/file_util.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 14 matching lines...) Expand all
25 } 25 }
26 26
27 } // namespace 27 } // namespace
28 28
29 bool AutoStart::AddApplication(const std::string& autostart_filename, 29 bool AutoStart::AddApplication(const std::string& autostart_filename,
30 const std::string& application_name, 30 const std::string& application_name,
31 const std::string& command_line, 31 const std::string& command_line,
32 bool is_terminal_app) { 32 bool is_terminal_app) {
33 scoped_ptr<base::Environment> environment(base::Environment::Create()); 33 scoped_ptr<base::Environment> environment(base::Environment::Create());
34 base::FilePath autostart_directory = GetAutostartDirectory(environment.get()); 34 base::FilePath autostart_directory = GetAutostartDirectory(environment.get());
35 if (!file_util::DirectoryExists(autostart_directory) && 35 if (!base::DirectoryExists(autostart_directory) &&
36 !file_util::CreateDirectory(autostart_directory)) { 36 !file_util::CreateDirectory(autostart_directory)) {
37 return false; 37 return false;
38 } 38 }
39 39
40 base::FilePath autostart_file = 40 base::FilePath autostart_file =
41 autostart_directory.Append(autostart_filename); 41 autostart_directory.Append(autostart_filename);
42 std::string terminal = is_terminal_app ? "true" : "false"; 42 std::string terminal = is_terminal_app ? "true" : "false";
43 std::string autostart_file_contents = 43 std::string autostart_file_contents =
44 "[Desktop Entry]\n" 44 "[Desktop Entry]\n"
45 "Type=Application\n" 45 "Type=Application\n"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 base::StringTokenizer tokenizer(contents, "\n"); 82 base::StringTokenizer tokenizer(contents, "\n");
83 std::string token = value_name + "="; 83 std::string token = value_name + "=";
84 while (tokenizer.GetNext()) { 84 while (tokenizer.GetNext()) {
85 if (tokenizer.token().substr(0, token.length()) == token) { 85 if (tokenizer.token().substr(0, token.length()) == token) {
86 *value = tokenizer.token().substr(token.length()); 86 *value = tokenizer.token().substr(token.length());
87 return true; 87 return true;
88 } 88 }
89 } 89 }
90 return false; 90 return false;
91 } 91 }
OLDNEW
« no previous file with comments | « chrome/browser/web_applications/web_app_mac.mm ('k') | chrome/common/extensions/extension_file_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698