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

Side by Side Diff: remoting/host/setup/daemon_controller_delegate_win.cc

Issue 1513043002: clang/win: Let remaining chromium_code targets build with -Wextra. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years 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
« no previous file with comments | « remoting/host/local_input_monitor_win.cc ('k') | rlz/win/lib/machine_deal.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "remoting/host/setup/daemon_controller_delegate_win.h" 5 #include "remoting/host/setup/daemon_controller_delegate_win.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 return false; 172 return false;
173 } 173 }
174 std::string host_id, host_secret_hash; 174 std::string host_id, host_secret_hash;
175 if (!config_dict->GetString(kHostIdConfigPath, &host_id) || 175 if (!config_dict->GetString(kHostIdConfigPath, &host_id) ||
176 !config_dict->GetString(kHostSecretHashConfigPath, &host_secret_hash)) { 176 !config_dict->GetString(kHostSecretHashConfigPath, &host_secret_hash)) {
177 return false; 177 return false;
178 } 178 }
179 179
180 // Extract the unprivileged fields from the configuration. 180 // Extract the unprivileged fields from the configuration.
181 base::DictionaryValue unprivileged_config_dict; 181 base::DictionaryValue unprivileged_config_dict;
182 for (int i = 0; i < arraysize(kUnprivilegedConfigKeys); ++i) { 182 for (const char* key : kUnprivilegedConfigKeys) {
183 const char* key = kUnprivilegedConfigKeys[i];
184 base::string16 value; 183 base::string16 value;
185 if (config_dict->GetString(key, &value)) { 184 if (config_dict->GetString(key, &value)) {
186 unprivileged_config_dict.SetString(key, value); 185 unprivileged_config_dict.SetString(key, value);
187 } 186 }
188 } 187 }
189 std::string unprivileged_config_str; 188 std::string unprivileged_config_str;
190 base::JSONWriter::Write(unprivileged_config_dict, &unprivileged_config_str); 189 base::JSONWriter::Write(unprivileged_config_dict, &unprivileged_config_str);
191 190
192 // Write the full configuration file to a temporary location. 191 // Write the full configuration file to a temporary location.
193 base::FilePath full_config_file_path = 192 base::FilePath full_config_file_path =
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 if (!ReadConfig(config_dir.Append(kUnprivilegedConfigFileName), &config)) 374 if (!ReadConfig(config_dir.Append(kUnprivilegedConfigFileName), &config))
376 return nullptr; 375 return nullptr;
377 376
378 return config; 377 return config;
379 } 378 }
380 379
381 void DaemonControllerDelegateWin::UpdateConfig( 380 void DaemonControllerDelegateWin::UpdateConfig(
382 scoped_ptr<base::DictionaryValue> config, 381 scoped_ptr<base::DictionaryValue> config,
383 const DaemonController::CompletionCallback& done) { 382 const DaemonController::CompletionCallback& done) {
384 // Check for bad keys. 383 // Check for bad keys.
385 for (int i = 0; i < arraysize(kReadonlyKeys); ++i) { 384 for (size_t i = 0; i < arraysize(kReadonlyKeys); ++i) {
386 if (config->HasKey(kReadonlyKeys[i])) { 385 if (config->HasKey(kReadonlyKeys[i])) {
387 LOG(ERROR) << "Cannot update config: '" << kReadonlyKeys[i] 386 LOG(ERROR) << "Cannot update config: '" << kReadonlyKeys[i]
388 << "' is read only."; 387 << "' is read only.";
389 InvokeCompletionCallback(done, false); 388 InvokeCompletionCallback(done, false);
390 return; 389 return;
391 } 390 }
392 } 391 }
393 // Get the old config. 392 // Get the old config.
394 base::FilePath config_dir = remoting::GetConfigDir(); 393 base::FilePath config_dir = remoting::GetConfigDir();
395 scoped_ptr<base::DictionaryValue> config_old; 394 scoped_ptr<base::DictionaryValue> config_old;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 InvokeCompletionCallback(done, StartDaemon()); 466 InvokeCompletionCallback(done, StartDaemon());
468 } 467 }
469 468
470 scoped_refptr<DaemonController> DaemonController::Create() { 469 scoped_refptr<DaemonController> DaemonController::Create() {
471 scoped_ptr<DaemonController::Delegate> delegate( 470 scoped_ptr<DaemonController::Delegate> delegate(
472 new DaemonControllerDelegateWin()); 471 new DaemonControllerDelegateWin());
473 return new DaemonController(delegate.Pass()); 472 return new DaemonController(delegate.Pass());
474 } 473 }
475 474
476 } // namespace remoting 475 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/local_input_monitor_win.cc ('k') | rlz/win/lib/machine_deal.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698