Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / ui / webui / options / advanced_options_utils_mac.mm
blobc294b86904accfd5b9c341d13faeddcfade32a5a
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;
15 namespace options {
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',
25                                  proxyPrefCommand,
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
43    options:0L
44    additionalEventParamDescriptor:nil
45    launchIdentifier:nil];
48 }  // namespace options