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 "printing/printing_context_win.h" | 5 #include "printing/printing_context_win.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 return GetDesktopWindow(); | 38 return GetDesktopWindow(); |
39 } | 39 } |
40 return window; | 40 return window; |
41 } | 41 } |
42 | 42 |
43 } // anonymous namespace | 43 } // anonymous namespace |
44 | 44 |
45 namespace printing { | 45 namespace printing { |
46 | 46 |
47 // static | 47 // static |
48 scoped_ptr<PrintingContext> PrintingContext::Create(Delegate* delegate) { | 48 PrintingContext* PrintingContext::Create(const std::string& app_locale) { |
49 return make_scoped_ptr<PrintingContext>(new PrintingContextWin(delegate)); | 49 return static_cast<PrintingContext*>(new PrintingContextWin(app_locale)); |
50 } | 50 } |
51 | 51 |
52 PrintingContextWin::PrintingContextWin(Delegate* delegate) | 52 PrintingContextWin::PrintingContextWin(const std::string& app_locale) |
53 : PrintingContext(delegate), context_(NULL), dialog_box_(NULL) { | 53 : PrintingContext(app_locale), context_(NULL), dialog_box_(NULL) {} |
54 } | |
55 | 54 |
56 PrintingContextWin::~PrintingContextWin() { | 55 PrintingContextWin::~PrintingContextWin() { |
57 ReleaseContext(); | 56 ReleaseContext(); |
58 } | 57 } |
59 | 58 |
60 void PrintingContextWin::AskUserForSettings( | 59 void PrintingContextWin::AskUserForSettings( |
61 int max_pages, | 60 gfx::NativeView view, int max_pages, bool has_selection, |
62 bool has_selection, | |
63 const PrintSettingsCallback& callback) { | 61 const PrintSettingsCallback& callback) { |
64 DCHECK(!in_print_job_); | 62 DCHECK(!in_print_job_); |
65 dialog_box_dismissed_ = false; | 63 dialog_box_dismissed_ = false; |
66 | 64 |
67 HWND window = GetRootWindow(delegate_->GetParentView()); | 65 HWND window = GetRootWindow(view); |
68 DCHECK(window); | 66 DCHECK(window); |
69 | 67 |
70 // Show the OS-dependent dialog box. | 68 // Show the OS-dependent dialog box. |
71 // If the user press | 69 // If the user press |
72 // - OK, the settings are reset and reinitialized with the new settings. OK is | 70 // - OK, the settings are reset and reinitialized with the new settings. OK is |
73 // returned. | 71 // returned. |
74 // - Apply then Cancel, the settings are reset and reinitialized with the new | 72 // - Apply then Cancel, the settings are reset and reinitialized with the new |
75 // settings. CANCEL is returned. | 73 // settings. CANCEL is returned. |
76 // - Cancel, the settings are not changed, the previous setting, if it was | 74 // - Cancel, the settings are not changed, the previous setting, if it was |
77 // initialized before, are kept. CANCEL is returned. | 75 // initialized before, are kept. CANCEL is returned. |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 | 603 |
606 if (dialog_options.hDevMode != NULL) | 604 if (dialog_options.hDevMode != NULL) |
607 GlobalFree(dialog_options.hDevMode); | 605 GlobalFree(dialog_options.hDevMode); |
608 if (dialog_options.hDevNames != NULL) | 606 if (dialog_options.hDevNames != NULL) |
609 GlobalFree(dialog_options.hDevNames); | 607 GlobalFree(dialog_options.hDevNames); |
610 | 608 |
611 return context_ ? OK : FAILED; | 609 return context_ ? OK : FAILED; |
612 } | 610 } |
613 | 611 |
614 } // namespace printing | 612 } // namespace printing |
OLD | NEW |