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