Popular sites on the NTP: check that experiment group StartsWith (rather than IS...
[chromium-blink-merge.git] / chrome / browser / printing / printer_manager_dialog_win.cc
blob5e71976ebb12018648da9799cd30191e53526d3e
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
3 // found in the LICENSE file.
5 #include "chrome/browser/printing/printer_manager_dialog.h"
7 #include <windows.h>
8 #include <shellapi.h>
10 #include "base/bind.h"
11 #include "base/files/file_path.h"
12 #include "base/path_service.h"
13 #include "base/threading/thread.h"
14 #include "chrome/browser/browser_process.h"
15 #include "content/public/browser/browser_thread.h"
17 using content::BrowserThread;
19 namespace printing {
21 // A helper callback that opens the printer management dialog.
22 void OpenPrintersDialogCallback() {
23 base::FilePath sys_dir;
24 PathService::Get(base::DIR_SYSTEM, &sys_dir);
25 base::FilePath rundll32 = sys_dir.AppendASCII("rundll32.exe");
26 base::FilePath shell32dll = sys_dir.AppendASCII("shell32.dll");
28 std::wstring args(shell32dll.value());
29 args.append(L",SHHelpShortcuts_RunDLL PrintersFolder");
30 ShellExecute(NULL, L"open", rundll32.value().c_str(), args.c_str(), NULL,
31 SW_SHOWNORMAL);
34 void PrinterManagerDialog::ShowPrinterManagerDialog() {
35 BrowserThread::PostTask(
36 BrowserThread::FILE,
37 FROM_HERE,
38 base::Bind(OpenPrintersDialogCallback));
41 } // namespace printing