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