OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/install_static/install_util.h" | 5 #include "chrome/install_static/install_util.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <assert.h> | 8 #include <assert.h> |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <iostream> | 10 #include <iostream> |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 if (!nt::CreateRegKey(nt::HKCU, registry_path.c_str(), KEY_SET_VALUE, | 446 if (!nt::CreateRegKey(nt::HKCU, registry_path.c_str(), KEY_SET_VALUE, |
447 &key_handle)) { | 447 &key_handle)) { |
448 nt::CloseRegKey(key_handle); | 448 nt::CloseRegKey(key_handle); |
449 return false; | 449 return false; |
450 } | 450 } |
451 | 451 |
452 return nt::SetRegValueDWORD(key_handle, kRegValueChromeStatsSample, | 452 return nt::SetRegValueDWORD(key_handle, kRegValueChromeStatsSample, |
453 in_sample ? 1 : 0); | 453 in_sample ? 1 : 0); |
454 } | 454 } |
455 | 455 |
456 bool ReportingIsEnforcedByPolicy(bool* metrics_is_enforced_by_policy) { | 456 bool ReportingIsEnforcedByPolicy(bool* crash_reporting_enabled) { |
457 DWORD value = 0; | 457 DWORD value = 0; |
458 | 458 |
459 // First, try HKLM. | 459 // First, try HKLM. |
460 if (nt::QueryRegValueDWORD(nt::HKLM, kRegPathChromePolicy, | 460 if (nt::QueryRegValueDWORD(nt::HKLM, kRegPathChromePolicy, |
461 kMetricsReportingEnabled, &value)) { | 461 kMetricsReportingEnabled, &value)) { |
462 *metrics_is_enforced_by_policy = (value != 0); | 462 *crash_reporting_enabled = (value != 0); |
463 return true; | 463 return true; |
464 } | 464 } |
465 | 465 |
466 // Second, try HKCU. | 466 // Second, try HKCU. |
467 if (nt::QueryRegValueDWORD(nt::HKCU, kRegPathChromePolicy, | 467 if (nt::QueryRegValueDWORD(nt::HKCU, kRegPathChromePolicy, |
468 kMetricsReportingEnabled, &value)) { | 468 kMetricsReportingEnabled, &value)) { |
469 *metrics_is_enforced_by_policy = (value != 0); | 469 *crash_reporting_enabled = (value != 0); |
470 return true; | 470 return true; |
471 } | 471 } |
472 | 472 |
473 return false; | 473 return false; |
474 } | 474 } |
475 | 475 |
476 void InitializeProcessType() { | 476 void InitializeProcessType() { |
477 assert(g_process_type == ProcessType::UNINITIALIZED); | 477 assert(g_process_type == ProcessType::UNINITIALIZED); |
478 typedef bool (*IsSandboxedProcessFunc)(); | 478 typedef bool (*IsSandboxedProcessFunc)(); |
479 IsSandboxedProcessFunc is_sandboxed_process_func = | 479 IsSandboxedProcessFunc is_sandboxed_process_func = |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 switch_value_end_offset = command_line_copy.length(); | 889 switch_value_end_offset = command_line_copy.length(); |
890 | 890 |
891 std::string switch_value = command_line_copy.substr( | 891 std::string switch_value = command_line_copy.substr( |
892 switch_value_start_offset, | 892 switch_value_start_offset, |
893 switch_value_end_offset - (switch_offset + switch_token.length())); | 893 switch_value_end_offset - (switch_offset + switch_token.length())); |
894 TrimT<std::string>(&switch_value); | 894 TrimT<std::string>(&switch_value); |
895 return switch_value; | 895 return switch_value; |
896 } | 896 } |
897 | 897 |
898 } // namespace install_static | 898 } // namespace install_static |
OLD | NEW |