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

Side by Side Diff: remoting/host/setup/daemon_controller_delegate_mac.mm

Issue 2393753003: Remove deprecated method LSOpenFSRef. (Closed)
Patch Set: nit Created 4 years, 2 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 | « no previous file | 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/setup/daemon_controller_delegate_mac.h" 5 #include "remoting/host/setup/daemon_controller_delegate_mac.h"
6 6
7 #import <AppKit/AppKit.h>
8
7 #include <CoreFoundation/CoreFoundation.h> 9 #include <CoreFoundation/CoreFoundation.h>
8 #include <launch.h> 10 #include <launch.h>
9 #include <stdio.h> 11 #include <stdio.h>
10 #include <sys/types.h> 12 #include <sys/types.h>
11 13
12 #include "base/bind.h" 14 #include "base/bind.h"
13 #include "base/callback_helpers.h" 15 #include "base/callback_helpers.h"
14 #include "base/compiler_specific.h" 16 #include "base/compiler_specific.h"
15 #include "base/files/file_path.h" 17 #include "base/files/file_path.h"
16 #include "base/files/file_util.h" 18 #include "base/files/file_util.h"
17 #include "base/logging.h" 19 #include "base/logging.h"
18 #include "base/mac/foundation_util.h" 20 #include "base/mac/foundation_util.h"
19 #include "base/mac/launchd.h" 21 #include "base/mac/launchd.h"
20 #include "base/mac/mac_logging.h" 22 #include "base/mac/mac_logging.h"
21 #include "base/mac/mac_util.h" 23 #include "base/mac/mac_util.h"
22 #include "base/mac/scoped_launch_data.h" 24 #include "base/mac/scoped_launch_data.h"
23 #include "base/memory/ptr_util.h" 25 #include "base/memory/ptr_util.h"
26 #include "base/strings/sys_string_conversions.h"
24 #include "base/time/time.h" 27 #include "base/time/time.h"
25 #include "base/values.h" 28 #include "base/values.h"
26 #include "remoting/host/constants_mac.h" 29 #include "remoting/host/constants_mac.h"
27 #include "remoting/host/host_config.h" 30 #include "remoting/host/host_config.h"
28 #include "remoting/host/usage_stats_consent.h" 31 #include "remoting/host/usage_stats_consent.h"
29 32
30 namespace remoting { 33 namespace remoting {
31 34
32 DaemonControllerDelegateMac::DaemonControllerDelegateMac() { 35 DaemonControllerDelegateMac::DaemonControllerDelegateMac() {
33 } 36 }
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 207
205 base::FilePath pane_path; 208 base::FilePath pane_path;
206 // TODO(lambroslambrou): Use NSPreferencePanesDirectory once we start 209 // TODO(lambroslambrou): Use NSPreferencePanesDirectory once we start
207 // building against SDK 10.6. 210 // building against SDK 10.6.
208 if (!base::mac::GetLocalDirectory(NSLibraryDirectory, &pane_path)) { 211 if (!base::mac::GetLocalDirectory(NSLibraryDirectory, &pane_path)) {
209 LOG(ERROR) << "Failed to get directory for local preference panes."; 212 LOG(ERROR) << "Failed to get directory for local preference panes.";
210 return false; 213 return false;
211 } 214 }
212 pane_path = pane_path.Append("PreferencePanes").Append(kPrefPaneFileName); 215 pane_path = pane_path.Append("PreferencePanes").Append(kPrefPaneFileName);
213 216
214 FSRef pane_path_ref; 217 bool success = [[NSWorkspace sharedWorkspace]
215 if (!base::mac::FSRefFromPath(pane_path.value(), &pane_path_ref)) { 218 openFile:base::SysUTF8ToNSString(pane_path.value())];
216 LOG(ERROR) << "Failed to create FSRef"; 219 if (!success) {
217 return false; 220 LOG(ERROR) << "Failed to open preferences pane: " << pane_path.value();
218 }
219 OSStatus status = LSOpenFSRef(&pane_path_ref, nullptr);
220 if (status != noErr) {
221 OSSTATUS_LOG(ERROR, status) << "LSOpenFSRef failed for path: "
222 << pane_path.value();
223 return false; 221 return false;
224 } 222 }
225 223
226 CFNotificationCenterRef center = 224 CFNotificationCenterRef center =
227 CFNotificationCenterGetDistributedCenter(); 225 CFNotificationCenterGetDistributedCenter();
228 base::ScopedCFTypeRef<CFStringRef> service_name(CFStringCreateWithCString( 226 base::ScopedCFTypeRef<CFStringRef> service_name(CFStringCreateWithCString(
229 kCFAllocatorDefault, remoting::kServiceName, kCFStringEncodingUTF8)); 227 kCFAllocatorDefault, remoting::kServiceName, kCFStringEncodingUTF8));
230 CFNotificationCenterPostNotification(center, service_name, nullptr, nullptr, 228 CFNotificationCenterPostNotification(center, service_name, nullptr, nullptr,
231 TRUE); 229 TRUE);
232 return true; 230 return true;
(...skipping 15 matching lines...) Expand all
248 246
249 self->PreferencePaneCallbackDelegate(name); 247 self->PreferencePaneCallbackDelegate(name);
250 } 248 }
251 249
252 scoped_refptr<DaemonController> DaemonController::Create() { 250 scoped_refptr<DaemonController> DaemonController::Create() {
253 return new DaemonController( 251 return new DaemonController(
254 base::WrapUnique(new DaemonControllerDelegateMac())); 252 base::WrapUnique(new DaemonControllerDelegateMac()));
255 } 253 }
256 254
257 } // namespace remoting 255 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698