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

Unified Diff: chrome/common/auto_start_linux.cc

Issue 6591002: Removed the command line from ServiceProcessState::AddToAutoRun() and had the... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/auto_start_linux.cc
===================================================================
--- chrome/common/auto_start_linux.cc (revision 76012)
+++ chrome/common/auto_start_linux.cc (working copy)
@@ -9,6 +9,7 @@
#include "base/file_util.h"
#include "base/logging.h"
#include "base/nix/xdg_util.h"
+#include "base/string_tokenizer.h"
namespace {
@@ -60,3 +61,28 @@
FilePath autostart_file = autostart_directory.Append(autostart_filename);
return file_util::Delete(autostart_file, false);
}
+
+bool AutoStart::GetAutostartFileContents(
+ const std::string& autostart_filename, std::string* contents) {
+ scoped_ptr<base::Environment> environment(base::Environment::Create());
+ FilePath autostart_directory = GetAutostartDirectory(environment.get());
+ FilePath autostart_file = autostart_directory.Append(autostart_filename);
+ return file_util::ReadFileToString(autostart_file, contents);
+}
+
+bool AutoStart::GetAutostartFileValue(const std::string& autostart_filename,
+ const std::string& value_name,
+ std::string* value) {
+ std::string contents;
+ if (!GetAutostartFileContents(autostart_filename, &contents))
+ return false;
+ StringTokenizer tokenizer(contents, "\n");
+ std::string token = value_name + "=";
+ while (tokenizer.GetNext()) {
+ if (tokenizer.token().substr(0, token.length()) == token) {
+ *value = tokenizer.token().substr(token.length());
+ return true;
+ }
+ }
+ return false;
+}

Powered by Google App Engine
This is Rietveld 408576698