| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/options/advanced_options_utils.h" | 5 #include "chrome/browser/ui/webui/settings_utils.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/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
| 14 #include "base/location.h" | 14 #include "base/location.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
| 17 #include "base/path_service.h" | 17 #include "base/path_service.h" |
| 18 #include "base/threading/thread.h" | 18 #include "base/threading/thread.h" |
| 19 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
| 20 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
| 21 #include "content/public/browser/web_contents.h" | 21 #include "content/public/browser/web_contents.h" |
| 22 #include "ui/shell_dialogs/base_shell_dialog_win.h" | 22 #include "ui/shell_dialogs/base_shell_dialog_win.h" |
| 23 #include "ui/views/win/hwnd_util.h" | 23 #include "ui/views/win/hwnd_util.h" |
| 24 | 24 |
| 25 using content::BrowserThread; | 25 using content::BrowserThread; |
| 26 using content::WebContents; | |
| 27 | 26 |
| 28 namespace options { | 27 namespace settings_utils { |
| 29 | 28 |
| 30 namespace { | 29 namespace { |
| 31 | 30 |
| 32 // Shows a Windows certificate management dialog on the dialog thread. | 31 // Shows a Windows certificate management dialog on the dialog thread. |
| 33 class ManageCertificatesDialog : public ui::BaseShellDialogImpl { | 32 class ManageCertificatesDialog : public ui::BaseShellDialogImpl { |
| 34 public: | 33 public: |
| 35 ManageCertificatesDialog() {} | 34 ManageCertificatesDialog() {} |
| 36 | 35 |
| 37 // Shows the dialog and calls |callback| when the dialog closes. The caller | 36 // Shows the dialog and calls |callback| when the dialog closes. The caller |
| 38 // must ensure the ManageCertificatesDialog remains valid until then. | 37 // must ensure the ManageCertificatesDialog remains valid until then. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 inetcpl = inetcpl.AppendASCII("inetcpl.cpl,,4"); | 88 inetcpl = inetcpl.AppendASCII("inetcpl.cpl,,4"); |
| 90 | 89 |
| 91 std::wstring args(shell32dll.value()); | 90 std::wstring args(shell32dll.value()); |
| 92 args.append(L",Control_RunDLL "); | 91 args.append(L",Control_RunDLL "); |
| 93 args.append(inetcpl.value()); | 92 args.append(inetcpl.value()); |
| 94 | 93 |
| 95 ShellExecute(NULL, L"open", rundll32.value().c_str(), args.c_str(), NULL, | 94 ShellExecute(NULL, L"open", rundll32.value().c_str(), args.c_str(), NULL, |
| 96 SW_SHOWNORMAL); | 95 SW_SHOWNORMAL); |
| 97 } | 96 } |
| 98 | 97 |
| 99 void AdvancedOptionsUtilities::ShowNetworkProxySettings( | 98 void ShowNetworkProxySettings(content::WebContents* web_contents) { |
| 100 WebContents* web_contents) { | |
| 101 DCHECK(BrowserThread::IsMessageLoopValid(BrowserThread::FILE)); | 99 DCHECK(BrowserThread::IsMessageLoopValid(BrowserThread::FILE)); |
| 102 BrowserThread::PostTask(BrowserThread::FILE, | 100 BrowserThread::PostTask(BrowserThread::FILE, |
| 103 FROM_HERE, | 101 FROM_HERE, |
| 104 base::Bind(&OpenConnectionDialogCallback)); | 102 base::Bind(&OpenConnectionDialogCallback)); |
| 105 } | 103 } |
| 106 | 104 |
| 107 void AdvancedOptionsUtilities::ShowManageSSLCertificates( | 105 void ShowManageSSLCertificates(content::WebContents* web_contents) { |
| 108 WebContents* web_contents) { | |
| 109 HWND parent = | 106 HWND parent = |
| 110 views::HWNDForNativeWindow(web_contents->GetTopLevelNativeWindow()); | 107 views::HWNDForNativeWindow(web_contents->GetTopLevelNativeWindow()); |
| 111 | 108 |
| 112 ManageCertificatesDialog* dialog = new ManageCertificatesDialog; | 109 ManageCertificatesDialog* dialog = new ManageCertificatesDialog; |
| 113 dialog->Show( | 110 dialog->Show( |
| 114 parent, | 111 parent, |
| 115 base::Bind(&base::DeletePointer<ManageCertificatesDialog>, dialog)); | 112 base::Bind(&base::DeletePointer<ManageCertificatesDialog>, dialog)); |
| 116 } | 113 } |
| 117 | 114 |
| 118 } // namespace options | 115 } // namespace settings_utils |
| OLD | NEW |