Add Promise.negate.
[chromium-blink-merge.git] / remoting / host / usage_stats_consent_mac.cc
blob1a286b7afb17a36eec870c14f84986a3b149e6f0
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
3 // found in the LICENSE file.
5 #include "remoting/host/usage_stats_consent.h"
7 #include <string>
9 #include "base/command_line.h"
10 #include "base/files/file_path.h"
11 #include "base/logging.h"
12 #include "remoting/host/config_file_watcher.h"
13 #include "remoting/host/json_host_config.h"
15 namespace remoting {
17 bool GetUsageStatsConsent(bool* allowed, bool* set_by_policy) {
18 *set_by_policy = false;
19 *allowed = false;
21 // Normally, the ConfigFileWatcher class would be used for retrieving config
22 // settings, but this code needs to execute before Breakpad is initialised,
23 // which itself should happen as early as possible during startup.
24 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
25 if (command_line->HasSwitch(kHostConfigSwitchName)) {
26 base::FilePath config_file_path =
27 command_line->GetSwitchValuePath(kHostConfigSwitchName);
28 JsonHostConfig host_config(config_file_path);
29 if (host_config.Read()) {
30 return host_config.GetBoolean(kUsageStatsConsentConfigPath, allowed);
33 return false;
36 bool IsUsageStatsAllowed() {
37 bool allowed;
38 bool set_by_policy;
39 return GetUsageStatsConsent(&allowed, &set_by_policy) && allowed;
42 bool SetUsageStatsConsent(bool allowed) {
43 NOTIMPLEMENTED();
44 return false;
47 } // namespace remoting