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