Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Side by Side Diff: chrome/service/cloud_print/print_system_win.cc

Issue 9582045: Making GenericScopedHandle capable of handling handle types other than HANDLE. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixup. Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/service/cloud_print/print_system.h" 5 #include "chrome/service/cloud_print/print_system.h"
6 6
7 #include <objidl.h> 7 #include <objidl.h>
8 #include <winspool.h> 8 #include <winspool.h>
9 #include <xpsprint.h> 9 #include <xpsprint.h>
10 10
(...skipping 15 matching lines...) Expand all
26 #include "printing/emf_win.h" 26 #include "printing/emf_win.h"
27 #include "printing/page_range.h" 27 #include "printing/page_range.h"
28 #include "printing/pdf_render_settings.h" 28 #include "printing/pdf_render_settings.h"
29 #include "ui/base/l10n/l10n_util.h" 29 #include "ui/base/l10n/l10n_util.h"
30 #include "ui/gfx/rect.h" 30 #include "ui/gfx/rect.h"
31 31
32 #pragma comment(lib, "rpcrt4.lib") // for UuidToString & Co. 32 #pragma comment(lib, "rpcrt4.lib") // for UuidToString & Co.
33 33
34 namespace { 34 namespace {
35 35
36 class PrinterChangeHandleTraits { 36 class PrinterChangeHandleTraits {
Vitaly Buka (NO REVIEWS) 2012/03/05 18:52:14 : pubic HandleTraits
alexeypa (please no reviews) 2012/03/05 18:56:58 No, why? HandleTraits and PrinterChangeHandleTrait
brettw 2012/03/05 18:58:44 I would not necessarily expect that the traits cla
37 public: 37 public:
38 typedef HANDLE Handle;
39
38 static bool CloseHandle(HANDLE handle) { 40 static bool CloseHandle(HANDLE handle) {
39 return ::FindClosePrinterChangeNotification(handle) != FALSE; 41 return ::FindClosePrinterChangeNotification(handle) != FALSE;
40 } 42 }
43
44 static bool IsHandleValid(HANDLE handle) {
45 return handle != NULL;
46 }
47
48 static HANDLE NullHandle() {
49 return NULL;
50 }
51
52 private:
53 DISALLOW_IMPLICIT_CONSTRUCTORS(PrinterChangeHandleTraits);
41 }; 54 };
42 55
43 typedef base::win::GenericScopedHandle<PrinterChangeHandleTraits> 56 typedef base::win::GenericScopedHandle<PrinterChangeHandleTraits>
44 ScopedPrinterChangeHandle; 57 ScopedPrinterChangeHandle;
45 58
46 class DevMode { 59 class DevMode {
47 public: 60 public:
48 DevMode() : dm_(NULL) {} 61 DevMode() : dm_(NULL) {}
49 ~DevMode() { Free(); } 62 ~DevMode() { Free(); }
50 63
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 RpcStringFree(reinterpret_cast<RPC_WSTR *>(&proxy_id_as_string)); 895 RpcStringFree(reinterpret_cast<RPC_WSTR *>(&proxy_id_as_string));
883 return ret; 896 return ret;
884 } 897 }
885 898
886 scoped_refptr<PrintSystem> PrintSystem::CreateInstance( 899 scoped_refptr<PrintSystem> PrintSystem::CreateInstance(
887 const base::DictionaryValue* print_system_settings) { 900 const base::DictionaryValue* print_system_settings) {
888 return new PrintSystemWin; 901 return new PrintSystemWin;
889 } 902 }
890 903
891 } // namespace cloud_print 904 } // namespace cloud_print
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698