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

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

Issue 12087091: Move string tokenizer to base/strings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sort Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/gtk/browser_titlebar.cc ('k') | chrome/common/extensions/csp_validator.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) 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_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/strings/string_tokenizer.h"
13 13
14 namespace { 14 namespace {
15 15
16 const FilePath::CharType kAutostart[] = "autostart"; 16 const FilePath::CharType kAutostart[] = "autostart";
17 17
18 FilePath GetAutostartDirectory(base::Environment* environment) { 18 FilePath GetAutostartDirectory(base::Environment* environment) {
19 FilePath result = base::nix::GetXDGDirectory(environment, 19 FilePath result = base::nix::GetXDGDirectory(environment,
20 base::nix::kXdgConfigHomeEnvVar, 20 base::nix::kXdgConfigHomeEnvVar,
21 base::nix::kDotConfigDir); 21 base::nix::kDotConfigDir);
22 result = result.Append(kAutostart); 22 result = result.Append(kAutostart);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 FilePath autostart_file = autostart_directory.Append(autostart_filename); 68 FilePath autostart_file = autostart_directory.Append(autostart_filename);
69 return file_util::ReadFileToString(autostart_file, contents); 69 return file_util::ReadFileToString(autostart_file, contents);
70 } 70 }
71 71
72 bool AutoStart::GetAutostartFileValue(const std::string& autostart_filename, 72 bool AutoStart::GetAutostartFileValue(const std::string& autostart_filename,
73 const std::string& value_name, 73 const std::string& value_name,
74 std::string* value) { 74 std::string* value) {
75 std::string contents; 75 std::string contents;
76 if (!GetAutostartFileContents(autostart_filename, &contents)) 76 if (!GetAutostartFileContents(autostart_filename, &contents))
77 return false; 77 return false;
78 StringTokenizer tokenizer(contents, "\n"); 78 base::StringTokenizer tokenizer(contents, "\n");
79 std::string token = value_name + "="; 79 std::string token = value_name + "=";
80 while (tokenizer.GetNext()) { 80 while (tokenizer.GetNext()) {
81 if (tokenizer.token().substr(0, token.length()) == token) { 81 if (tokenizer.token().substr(0, token.length()) == token) {
82 *value = tokenizer.token().substr(token.length()); 82 *value = tokenizer.token().substr(token.length());
83 return true; 83 return true;
84 } 84 }
85 } 85 }
86 return false; 86 return false;
87 } 87 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/browser_titlebar.cc ('k') | chrome/common/extensions/csp_validator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698