Update content setting for app banners to store more information.
[chromium-blink-merge.git] / remoting / host / usage_stats_consent_mac.cc
blob2a7f86aba636b4177380477bf54d87ee4e50d411
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 "base/memory/scoped_ptr.h"
13 #include "base/values.h"
14 #include "remoting/host/config_file_watcher.h"
15 #include "remoting/host/host_config.h"
17 namespace remoting {
19 bool GetUsageStatsConsent(bool* allowed, bool* set_by_policy) {
20 *set_by_policy = false;
21 *allowed = false;
23 // Normally, the ConfigFileWatcher class would be used for retrieving config
24 // settings, but this code needs to execute before Breakpad is initialised,
25 // which itself should happen as early as possible during startup.
26 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
27 if (command_line->HasSwitch(kHostConfigSwitchName)) {
28 base::FilePath config_file_path =
29 command_line->GetSwitchValuePath(kHostConfigSwitchName);
30 scoped_ptr<base::DictionaryValue> host_config(
31 HostConfigFromJsonFile(config_file_path));
32 if (host_config) {
33 return host_config->GetBoolean(kUsageStatsConsentConfigPath, allowed);
36 return false;
39 bool IsUsageStatsAllowed() {
40 bool allowed;
41 bool set_by_policy;
42 return GetUsageStatsConsent(&allowed, &set_by_policy) && allowed;
45 bool SetUsageStatsConsent(bool allowed) {
46 NOTIMPLEMENTED();
47 return false;
50 } // namespace remoting