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

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

Issue 2713293002: Allow $TMPDIR to set temporary directory on OS X. (Closed)
Patch Set: Fix typo Created 3 years, 9 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 | « chrome/browser/file_select_helper_mac.mm ('k') | no next file » | 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 #include <memory>
19 19
20 #include "base/files/file_util.h"
20 #include "base/mac/authorization_util.h" 21 #include "base/mac/authorization_util.h"
21 #include "base/mac/launchd.h" 22 #include "base/mac/launchd.h"
22 #include "base/mac/mac_logging.h" 23 #include "base/mac/mac_logging.h"
23 #include "base/mac/scoped_launch_data.h" 24 #include "base/mac/scoped_launch_data.h"
24 #include "base/posix/eintr_wrapper.h" 25 #include "base/posix/eintr_wrapper.h"
25 #include "remoting/host/host_config.h" 26 #include "remoting/host/host_config.h"
26 #include "remoting/host/mac/constants_mac.h" 27 #include "remoting/host/mac/constants_mac.h"
27 #import "remoting/host/mac/me2me_preference_pane_confirm_pin.h" 28 #import "remoting/host/mac/me2me_preference_pane_confirm_pin.h"
28 #import "remoting/host/mac/me2me_preference_pane_disable.h" 29 #import "remoting/host/mac/me2me_preference_pane_disable.h"
29 #include "remoting/host/pin_hash.h" 30 #include "remoting/host/pin_hash.h"
30 #include "third_party/jsoncpp/source/include/json/reader.h" 31 #include "third_party/jsoncpp/source/include/json/reader.h"
31 #include "third_party/jsoncpp/source/include/json/writer.h" 32 #include "third_party/jsoncpp/source/include/json/writer.h"
32 33
33 namespace { 34 namespace {
34 35
35 bool GetTemporaryConfigFilePath(std::string* path) { 36 bool GetTemporaryConfigFilePath(std::string* path) {
36 NSString* filename = NSTemporaryDirectory(); 37 base::FilePath ret;
37 if (filename == nil) 38
39 if (!base::GetTempDir(&ret)) {
38 return false; 40 return false;
41 }
39 42
40 *path = [[NSString stringWithFormat:@"%@/%s", 43 ret = ret.Append(remoting::kHostConfigFileName);
41 filename, remoting::kHostConfigFileName] UTF8String]; 44
45 // This should be safe on OS X because utf8 is always supported.
46 *path = ret.AsUTF8Unsafe();
42 return true; 47 return true;
43 } 48 }
44 49
45 bool IsConfigValid(const remoting::JsonHostConfig* config) { 50 bool IsConfigValid(const remoting::JsonHostConfig* config) {
46 std::string value; 51 std::string value;
47 return (config->GetString(remoting::kHostIdConfigPath, &value) && 52 return (config->GetString(remoting::kHostIdConfigPath, &value) &&
48 config->GetString(remoting::kHostSecretHashConfigPath, &value) && 53 config->GetString(remoting::kHostSecretHashConfigPath, &value) &&
49 config->GetString(remoting::kXmppLoginConfigPath, &value)); 54 config->GetString(remoting::kXmppLoginConfigPath, &value));
50 } 55 }
51 56
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 NSArray* arguments = [NSArray arrayWithObjects:@"--relaunch-prefpane", nil]; 585 NSArray* arguments = [NSArray arrayWithObjects:@"--relaunch-prefpane", nil];
581 [task setLaunchPath:command]; 586 [task setLaunchPath:command];
582 [task setArguments:arguments]; 587 [task setArguments:arguments];
583 [task setStandardInput:[NSPipe pipe]]; 588 [task setStandardInput:[NSPipe pipe]];
584 [task launch]; 589 [task launch];
585 [task release]; 590 [task release];
586 [NSApp terminate:nil]; 591 [NSApp terminate:nil];
587 } 592 }
588 593
589 @end 594 @end
OLDNEW
« no previous file with comments | « chrome/browser/file_select_helper_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698