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

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

Issue 19579005: Move ReadFileToString to the base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 autostart_directory.Append(autostart_filename); 63 autostart_directory.Append(autostart_filename);
64 return base::DeleteFile(autostart_file, false); 64 return base::DeleteFile(autostart_file, false);
65 } 65 }
66 66
67 bool AutoStart::GetAutostartFileContents( 67 bool AutoStart::GetAutostartFileContents(
68 const std::string& autostart_filename, std::string* contents) { 68 const std::string& autostart_filename, std::string* contents) {
69 scoped_ptr<base::Environment> environment(base::Environment::Create()); 69 scoped_ptr<base::Environment> environment(base::Environment::Create());
70 base::FilePath autostart_directory = GetAutostartDirectory(environment.get()); 70 base::FilePath autostart_directory = GetAutostartDirectory(environment.get());
71 base::FilePath autostart_file = 71 base::FilePath autostart_file =
72 autostart_directory.Append(autostart_filename); 72 autostart_directory.Append(autostart_filename);
73 return file_util::ReadFileToString(autostart_file, contents); 73 return base::ReadFileToString(autostart_file, contents);
74 } 74 }
75 75
76 bool AutoStart::GetAutostartFileValue(const std::string& autostart_filename, 76 bool AutoStart::GetAutostartFileValue(const std::string& autostart_filename,
77 const std::string& value_name, 77 const std::string& value_name,
78 std::string* value) { 78 std::string* value) {
79 std::string contents; 79 std::string contents;
80 if (!GetAutostartFileContents(autostart_filename, &contents)) 80 if (!GetAutostartFileContents(autostart_filename, &contents))
81 return false; 81 return false;
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/user_style_sheet_watcher.cc ('k') | chrome/common/extensions/api/extension_api_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698