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

Side by Side Diff: remoting/host/mac/me2me_preference_pane.mm

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/mac/me2me_preference_pane.h ('k') | remoting/host/me2me_desktop_environment.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 #import "remoting/host/mac/me2me_preference_pane.h" 5 #import "remoting/host/mac/me2me_preference_pane.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 #include <CommonCrypto/CommonHMAC.h> 8 #include <CommonCrypto/CommonHMAC.h>
9 #include <errno.h> 9 #include <errno.h>
10 #include <launch.h> 10 #include <launch.h>
11 #import <PreferencePanes/PreferencePanes.h> 11 #import <PreferencePanes/PreferencePanes.h>
12 #import <SecurityInterface/SFAuthorizationView.h> 12 #import <SecurityInterface/SFAuthorizationView.h>
13 #include <stddef.h> 13 #include <stddef.h>
14 #include <stdlib.h> 14 #include <stdlib.h>
15 #include <unistd.h> 15 #include <unistd.h>
16 16
17 #include <fstream> 17 #include <fstream>
18 #include <memory>
18 19
19 #include "base/mac/authorization_util.h" 20 #include "base/mac/authorization_util.h"
20 #include "base/mac/launchd.h" 21 #include "base/mac/launchd.h"
21 #include "base/mac/mac_logging.h" 22 #include "base/mac/mac_logging.h"
22 #include "base/mac/scoped_launch_data.h" 23 #include "base/mac/scoped_launch_data.h"
23 #include "base/memory/scoped_ptr.h"
24 #include "base/posix/eintr_wrapper.h" 24 #include "base/posix/eintr_wrapper.h"
25 #include "remoting/host/constants_mac.h" 25 #include "remoting/host/constants_mac.h"
26 #include "remoting/host/host_config.h" 26 #include "remoting/host/host_config.h"
27 #include "remoting/host/pin_hash.h"
28 #import "remoting/host/mac/me2me_preference_pane_confirm_pin.h" 27 #import "remoting/host/mac/me2me_preference_pane_confirm_pin.h"
29 #import "remoting/host/mac/me2me_preference_pane_disable.h" 28 #import "remoting/host/mac/me2me_preference_pane_disable.h"
29 #include "remoting/host/pin_hash.h"
30 #include "third_party/jsoncpp/source/include/json/reader.h" 30 #include "third_party/jsoncpp/source/include/json/reader.h"
31 #include "third_party/jsoncpp/source/include/json/writer.h" 31 #include "third_party/jsoncpp/source/include/json/writer.h"
32 32
33 namespace { 33 namespace {
34 34
35 bool GetTemporaryConfigFilePath(std::string* path) { 35 bool GetTemporaryConfigFilePath(std::string* path) {
36 NSString* filename = NSTemporaryDirectory(); 36 NSString* filename = NSTemporaryDirectory();
37 if (filename == nil) 37 if (filename == nil)
38 return false; 38 return false;
39 39
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 - (void)readNewConfig { 238 - (void)readNewConfig {
239 std::string file; 239 std::string file;
240 if (!GetTemporaryConfigFilePath(&file)) { 240 if (!GetTemporaryConfigFilePath(&file)) {
241 NSLog(@"Failed to get path of configuration data."); 241 NSLog(@"Failed to get path of configuration data.");
242 [self showError]; 242 [self showError];
243 return; 243 return;
244 } 244 }
245 if (access(file.c_str(), F_OK) != 0) 245 if (access(file.c_str(), F_OK) != 0)
246 return; 246 return;
247 247
248 scoped_ptr<remoting::JsonHostConfig> new_config_( 248 std::unique_ptr<remoting::JsonHostConfig> new_config_(
249 new remoting::JsonHostConfig(file)); 249 new remoting::JsonHostConfig(file));
250 if (!new_config_->Read()) { 250 if (!new_config_->Read()) {
251 // Report the error, because the file exists but couldn't be read. The 251 // Report the error, because the file exists but couldn't be read. The
252 // case of non-existence is normal and expected. 252 // case of non-existence is normal and expected.
253 NSLog(@"Error reading configuration data from %s", file.c_str()); 253 NSLog(@"Error reading configuration data from %s", file.c_str());
254 [self showError]; 254 [self showError];
255 return; 255 return;
256 } 256 }
257 remove(file.c_str()); 257 remove(file.c_str());
258 if (!IsConfigValid(new_config_.get())) { 258 if (!IsConfigValid(new_config_.get())) {
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 NSArray* arguments = [NSArray arrayWithObjects:@"--relaunch-prefpane", nil]; 580 NSArray* arguments = [NSArray arrayWithObjects:@"--relaunch-prefpane", nil];
581 [task setLaunchPath:command]; 581 [task setLaunchPath:command];
582 [task setArguments:arguments]; 582 [task setArguments:arguments];
583 [task setStandardInput:[NSPipe pipe]]; 583 [task setStandardInput:[NSPipe pipe]];
584 [task launch]; 584 [task launch];
585 [task release]; 585 [task release];
586 [NSApp terminate:nil]; 586 [NSApp terminate:nil];
587 } 587 }
588 588
589 @end 589 @end
OLDNEW
« no previous file with comments | « remoting/host/mac/me2me_preference_pane.h ('k') | remoting/host/me2me_desktop_environment.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698