Chromium Code Reviews| 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/options/advanced_options_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/path_service.h" | 13 #include "base/path_service.h" |
| 14 #include "base/threading/thread.h" | 14 #include "base/threading/thread.h" |
| 15 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
| 16 #include "content/public/browser/browser_thread.h" | 16 #include "content/public/browser/browser_thread.h" |
| 17 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
| 18 #include "content/public/browser/web_contents_view.h" | 18 #include "content/public/browser/web_contents_view.h" |
| 19 #include "ui/views/win/hwnd_util.h" | |
| 19 | 20 |
| 20 using content::BrowserThread; | 21 using content::BrowserThread; |
| 21 using content::WebContents; | 22 using content::WebContents; |
| 22 | 23 |
| 23 namespace options { | 24 namespace options { |
| 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 |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 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 WebContents* web_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 gfx::NativeWindow top_level_window = |
| 65 web_contents->GetView()->GetTopLevelNativeWindow(); | |
| 64 #if defined(USE_AURA) | 66 #if defined(USE_AURA) |
|
sky
2013/09/16 16:59:29
Can you use views::HWNDForNativeView to avoid the
scottmg
2013/09/16 17:26:38
Oops, didn't realize those were implemented for no
| |
| 65 NULL; | 67 cert_mgr.hwndParent = views::HWNDForNativeWindow(top_level_window); |
| 66 #else | 68 #else |
| 67 web_contents->GetView()->GetTopLevelNativeWindow(); | 69 cert_mgr.hwndParent = top_level_window; |
| 68 #endif | 70 #endif |
| 69 ::CryptUIDlgCertMgr(&cert_mgr); | 71 ::CryptUIDlgCertMgr(&cert_mgr); |
| 70 } | 72 } |
| 71 | 73 |
| 72 } // namespace options | 74 } // namespace options |
| OLD | NEW |