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

Side by Side Diff: remoting/host/usage_stats_consent_mac.cc

Issue 1864213002: Convert //remoting to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac IWYU Created 4 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
« no previous file with comments | « remoting/host/touch_injector_win_unittest.cc ('k') | remoting/host/win/host_service.h » ('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 (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 "remoting/host/usage_stats_consent.h" 5 #include "remoting/host/usage_stats_consent.h"
6 6
7 #include <memory>
7 #include <string> 8 #include <string>
8 9
9 #include "base/command_line.h" 10 #include "base/command_line.h"
10 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
11 #include "base/logging.h" 12 #include "base/logging.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "remoting/host/config_file_watcher.h" 14 #include "remoting/host/config_file_watcher.h"
15 #include "remoting/host/host_config.h" 15 #include "remoting/host/host_config.h"
16 16
17 namespace remoting { 17 namespace remoting {
18 18
19 bool GetUsageStatsConsent(bool* allowed, bool* set_by_policy) { 19 bool GetUsageStatsConsent(bool* allowed, bool* set_by_policy) {
20 *set_by_policy = false; 20 *set_by_policy = false;
21 *allowed = false; 21 *allowed = false;
22 22
23 // Normally, the ConfigFileWatcher class would be used for retrieving config 23 // Normally, the ConfigFileWatcher class would be used for retrieving config
24 // settings, but this code needs to execute before Breakpad is initialised, 24 // settings, but this code needs to execute before Breakpad is initialised,
25 // which itself should happen as early as possible during startup. 25 // which itself should happen as early as possible during startup.
26 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 26 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
27 if (command_line->HasSwitch(kHostConfigSwitchName)) { 27 if (command_line->HasSwitch(kHostConfigSwitchName)) {
28 base::FilePath config_file_path = 28 base::FilePath config_file_path =
29 command_line->GetSwitchValuePath(kHostConfigSwitchName); 29 command_line->GetSwitchValuePath(kHostConfigSwitchName);
30 scoped_ptr<base::DictionaryValue> host_config( 30 std::unique_ptr<base::DictionaryValue> host_config(
31 HostConfigFromJsonFile(config_file_path)); 31 HostConfigFromJsonFile(config_file_path));
32 if (host_config) { 32 if (host_config) {
33 return host_config->GetBoolean(kUsageStatsConsentConfigPath, allowed); 33 return host_config->GetBoolean(kUsageStatsConsentConfigPath, allowed);
34 } 34 }
35 } 35 }
36 return false; 36 return false;
37 } 37 }
38 38
39 bool IsUsageStatsAllowed() { 39 bool IsUsageStatsAllowed() {
40 bool allowed; 40 bool allowed;
41 bool set_by_policy; 41 bool set_by_policy;
42 return GetUsageStatsConsent(&allowed, &set_by_policy) && allowed; 42 return GetUsageStatsConsent(&allowed, &set_by_policy) && allowed;
43 } 43 }
44 44
45 bool SetUsageStatsConsent(bool allowed) { 45 bool SetUsageStatsConsent(bool allowed) {
46 NOTIMPLEMENTED(); 46 NOTIMPLEMENTED();
47 return false; 47 return false;
48 } 48 }
49 49
50 } // namespace remoting 50 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/touch_injector_win_unittest.cc ('k') | remoting/host/win/host_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698