| 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/printing/printer_manager_dialog.h" | 5 #include "chrome/browser/printing/printer_manager_dialog.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <shellapi.h> | 8 #include <shellapi.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
| 12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 13 #include "base/threading/thread.h" | 13 #include "base/threading/thread.h" |
| 14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
| 15 #include "content/public/browser/browser_thread.h" |
| 16 |
| 17 using content::BrowserThread; |
| 15 | 18 |
| 16 namespace printing { | 19 namespace printing { |
| 17 | 20 |
| 18 // A helper callback that opens the printer management dialog. | 21 // A helper callback that opens the printer management dialog. |
| 19 void OpenPrintersDialogCallback() { | 22 void OpenPrintersDialogCallback() { |
| 20 FilePath sys_dir; | 23 FilePath sys_dir; |
| 21 PathService::Get(base::DIR_SYSTEM, &sys_dir); | 24 PathService::Get(base::DIR_SYSTEM, &sys_dir); |
| 22 FilePath rundll32 = sys_dir.AppendASCII("rundll32.exe"); | 25 FilePath rundll32 = sys_dir.AppendASCII("rundll32.exe"); |
| 23 FilePath shell32dll = sys_dir.AppendASCII("shell32.dll"); | 26 FilePath shell32dll = sys_dir.AppendASCII("shell32.dll"); |
| 24 | 27 |
| 25 std::wstring args(shell32dll.value()); | 28 std::wstring args(shell32dll.value()); |
| 26 args.append(L",SHHelpShortcuts_RunDLL PrintersFolder"); | 29 args.append(L",SHHelpShortcuts_RunDLL PrintersFolder"); |
| 27 ShellExecute(NULL, L"open", rundll32.value().c_str(), args.c_str(), NULL, | 30 ShellExecute(NULL, L"open", rundll32.value().c_str(), args.c_str(), NULL, |
| 28 SW_SHOWNORMAL); | 31 SW_SHOWNORMAL); |
| 29 } | 32 } |
| 30 | 33 |
| 31 void PrinterManagerDialog::ShowPrinterManagerDialog() { | 34 void PrinterManagerDialog::ShowPrinterManagerDialog() { |
| 32 g_browser_process->file_thread()->message_loop()->PostTask( | 35 BrowserThread::PostTask( |
| 33 FROM_HERE, base::Bind(OpenPrintersDialogCallback)); | 36 BrowserThread::FILE, |
| 37 FROM_HERE, |
| 38 base::Bind(OpenPrintersDialogCallback)); |
| 34 } | 39 } |
| 35 | 40 |
| 36 } // namespace printing | 41 } // namespace printing |
| OLD | NEW |