OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 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. |
| 4 |
| 5 #include "chrome/browser/ui/webui/options2/advanced_options_utils.h" |
| 6 |
| 7 #include <windows.h> |
| 8 #include <cryptuiapi.h> |
| 9 #pragma comment(lib, "cryptui.lib") |
| 10 #include <shellapi.h> |
| 11 |
| 12 #include "base/bind.h" |
| 13 #include "base/file_util.h" |
| 14 #include "base/path_service.h" |
| 15 #include "base/threading/thread.h" |
| 16 #include "chrome/browser/browser_process.h" |
| 17 #include "content/browser/tab_contents/tab_contents.h" |
| 18 #include "content/browser/tab_contents/tab_contents_view.h" |
| 19 #include "content/public/browser/browser_thread.h" |
| 20 |
| 21 using content::BrowserThread; |
| 22 |
| 23 // Callback that opens the Internet Options control panel dialog with the |
| 24 // Connections tab selected. |
| 25 void OpenConnectionDialogCallback() { |
| 26 // Using rundll32 seems better than LaunchConnectionDialog which causes a |
| 27 // new dialog to be made for each call. rundll32 uses the same global |
| 28 // dialog and it seems to share with the shortcut in control panel. |
| 29 FilePath rundll32; |
| 30 PathService::Get(base::DIR_SYSTEM, &rundll32); |
| 31 rundll32 = rundll32.AppendASCII("rundll32.exe"); |
| 32 |
| 33 FilePath shell32dll; |
| 34 PathService::Get(base::DIR_SYSTEM, &shell32dll); |
| 35 shell32dll = shell32dll.AppendASCII("shell32.dll"); |
| 36 |
| 37 FilePath inetcpl; |
| 38 PathService::Get(base::DIR_SYSTEM, &inetcpl); |
| 39 inetcpl = inetcpl.AppendASCII("inetcpl.cpl,,4"); |
| 40 |
| 41 std::wstring args(shell32dll.value()); |
| 42 args.append(L",Control_RunDLL "); |
| 43 args.append(inetcpl.value()); |
| 44 |
| 45 ShellExecute(NULL, L"open", rundll32.value().c_str(), args.c_str(), NULL, |
| 46 SW_SHOWNORMAL); |
| 47 } |
| 48 |
| 49 void AdvancedOptionsUtilities::ShowNetworkProxySettings( |
| 50 TabContents* tab_contents) { |
| 51 DCHECK(BrowserThread::IsMessageLoopValid(BrowserThread::FILE)); |
| 52 BrowserThread::PostTask(BrowserThread::FILE, |
| 53 FROM_HERE, |
| 54 base::Bind(&OpenConnectionDialogCallback)); |
| 55 } |
| 56 |
| 57 void AdvancedOptionsUtilities::ShowManageSSLCertificates( |
| 58 TabContents* tab_contents) { |
| 59 CRYPTUI_CERT_MGR_STRUCT cert_mgr = { 0 }; |
| 60 cert_mgr.dwSize = sizeof(CRYPTUI_CERT_MGR_STRUCT); |
| 61 cert_mgr.hwndParent = |
| 62 #if defined(USE_AURA) |
| 63 NULL; |
| 64 #else |
| 65 tab_contents->view()->GetTopLevelNativeWindow(); |
| 66 #endif |
| 67 ::CryptUIDlgCertMgr(&cert_mgr); |
| 68 } |
OLD | NEW |