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