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

Side by Side Diff: cloud_print/service/win/chrome_launcher.cc

Issue 13196006: Move path functions from file_util to FilePath object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: git try Created 7 years, 8 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 "cloud_print/service/win/chrome_launcher.h" 5 #include "cloud_print/service/win/chrome_launcher.h"
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 &result); 114 &result);
115 return result; 115 return result;
116 } 116 }
117 117
118 void DeleteAutorunKeys(const base::FilePath& user_data_dir) { 118 void DeleteAutorunKeys(const base::FilePath& user_data_dir) {
119 base::win::RegKey key(HKEY_CURRENT_USER, kAutoRunKeyPath, KEY_SET_VALUE); 119 base::win::RegKey key(HKEY_CURRENT_USER, kAutoRunKeyPath, KEY_SET_VALUE);
120 if (!key.Valid()) 120 if (!key.Valid())
121 return; 121 return;
122 std::vector<string16> to_delete; 122 std::vector<string16> to_delete;
123 123
124 base::FilePath abs_user_data_dir = user_data_dir; 124 base::FilePath abs_user_data_dir = base::MakeAbsoluteFilePath(user_data_dir);
125 file_util::AbsolutePath(&abs_user_data_dir);
126 125
127 { 126 {
128 base::win::RegistryValueIterator value(HKEY_CURRENT_USER, kAutoRunKeyPath); 127 base::win::RegistryValueIterator value(HKEY_CURRENT_USER, kAutoRunKeyPath);
129 for (; value.Valid(); ++value) { 128 for (; value.Valid(); ++value) {
130 if (value.Type() == REG_SZ && value.Value()) { 129 if (value.Type() == REG_SZ && value.Value()) {
131 CommandLine cmd = CommandLine::FromString(value.Value()); 130 CommandLine cmd = CommandLine::FromString(value.Value());
132 if (cmd.GetSwitchValueASCII(switches::kProcessType) == 131 if (cmd.GetSwitchValueASCII(switches::kProcessType) ==
133 switches::kServiceProcess && 132 switches::kServiceProcess &&
134 cmd.HasSwitch(switches::kUserDataDir)) { 133 cmd.HasSwitch(switches::kUserDataDir)) {
135 base::FilePath path_from_reg = 134 base::FilePath path_from_reg = base::MakeAbsoluteFilePath(
136 cmd.GetSwitchValuePath(switches::kUserDataDir); 135 cmd.GetSwitchValuePath(switches::kUserDataDir));
137 file_util::AbsolutePath(&path_from_reg);
138 if (path_from_reg == abs_user_data_dir) { 136 if (path_from_reg == abs_user_data_dir) {
139 to_delete.push_back(value.Name()); 137 to_delete.push_back(value.Name());
140 } 138 }
141 } 139 }
142 } 140 }
143 } 141 }
144 } 142 }
145 143
146 for (size_t i = 0; i < to_delete.size(); ++i) { 144 for (size_t i = 0; i < to_delete.size(); ++i) {
147 key.DeleteValue(to_delete[i].c_str()); 145 key.DeleteValue(to_delete[i].c_str());
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 298
301 std::string json; 299 std::string json;
302 if (!file_util::ReadFileToString( 300 if (!file_util::ReadFileToString(
303 temp_user_data.path().Append(chrome::kServiceStateFileName), &json)) { 301 temp_user_data.path().Append(chrome::kServiceStateFileName), &json)) {
304 return result; 302 return result;
305 } 303 }
306 304
307 return UpdateServiceState(json, proxy_id); 305 return UpdateServiceState(json, proxy_id);
308 } 306 }
309 307
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698