Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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. | |
| 4 | |
| 5 #include "chrome/browser/printing/printer_manager_dialog.h" | |
| 6 | |
| 7 #include <windows.h> | |
| 8 #include <shellapi.h> | |
| 9 | |
| 10 #include "base/file_util.h" | |
|
Lei Zhang
2011/04/28 01:14:12
nit: you only need file_path.h.
kmadhusu
2011/04/28 15:44:21
Done.
| |
| 11 #include "base/path_service.h" | |
| 12 #include "base/threading/thread.h" | |
| 13 #include "chrome/browser/browser_process.h" | |
| 14 | |
| 15 namespace printing { | |
| 16 | |
| 17 // A helper method that opens the printer management dialog. | |
| 18 class OpenPrintersDialogTask : public Task { | |
| 19 public: | |
| 20 OpenPrintersDialogTask() {} | |
| 21 | |
| 22 virtual void Run() { | |
| 23 FilePath rundll32; | |
| 24 PathService::Get(base::DIR_SYSTEM, &rundll32); | |
| 25 rundll32 = rundll32.AppendASCII("rundll32.exe"); | |
| 26 | |
| 27 FilePath shell32dll; | |
| 28 PathService::Get(base::DIR_SYSTEM, &shell32dll); | |
|
Lei Zhang
2011/04/28 01:14:12
only need to call PathService::Get() once:
FilePa
kmadhusu
2011/04/28 15:44:21
Done.
| |
| 29 shell32dll = shell32dll.AppendASCII("shell32.dll"); | |
| 30 | |
| 31 std::wstring args(shell32dll.value()); | |
| 32 args.append(L",SHHelpShortcuts_RunDLL PrintersFolder"); | |
| 33 ShellExecute(NULL, L"open", rundll32.value().c_str(), args.c_str(), NULL, | |
| 34 SW_SHOWNORMAL); | |
| 35 } | |
| 36 | |
| 37 private: | |
| 38 DISALLOW_COPY_AND_ASSIGN(OpenPrintersDialogTask); | |
| 39 }; | |
| 40 | |
| 41 void PrinterManagerDialog::ShowPrinterManagerDialog() { | |
| 42 base::Thread* thread = g_browser_process->file_thread(); | |
| 43 DCHECK(thread); | |
|
Lei Zhang
2011/04/28 01:14:12
nit: you don't need this DCHECK. If |thread| is nu
kmadhusu
2011/04/28 15:44:21
Done.
| |
| 44 thread->message_loop()->PostTask(FROM_HERE, new OpenPrintersDialogTask); | |
| 45 } | |
| 46 | |
| 47 } // namespace printing | |
| OLD | NEW |