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 #import <Cocoa/Cocoa.h>
7 #include "chrome/browser/ui/webui/options/advanced_options_utils.h"
9 #include "base/logging.h"
10 #include "base/mac/mac_logging.h"
11 #include "base/mac/scoped_aedesc.h"
13 using content::WebContents;
17 void AdvancedOptionsUtilities::ShowNetworkProxySettings(
18 WebContents* web_contents) {
19 NSArray* itemsToOpen = [NSArray arrayWithObject:[NSURL fileURLWithPath:
20 @"/System/Library/PreferencePanes/Network.prefPane"]];
22 const char* proxyPrefCommand = "Proxies";
23 base::mac::ScopedAEDesc<> openParams;
24 OSStatus status = AECreateDesc('ptru',
26 strlen(proxyPrefCommand),
27 openParams.OutPointer());
28 OSSTATUS_LOG_IF(ERROR, status != noErr, status)
29 << "Failed to create open params";
31 LSLaunchURLSpec launchSpec = { 0 };
32 launchSpec.itemURLs = (CFArrayRef)itemsToOpen;
33 launchSpec.passThruParams = openParams;
34 launchSpec.launchFlags = kLSLaunchAsync | kLSLaunchDontAddToRecents;
35 LSOpenFromURLSpec(&launchSpec, NULL);
38 void AdvancedOptionsUtilities::ShowManageSSLCertificates(
39 WebContents* web_contents) {
40 NSString* const kKeychainBundleId = @"com.apple.keychainaccess";
41 [[NSWorkspace sharedWorkspace]
42 launchAppWithBundleIdentifier:kKeychainBundleId
44 additionalEventParamDescriptor:nil
45 launchIdentifier:nil];
48 } // namespace options