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

Side by Side Diff: printing/printing_context_win.cc

Issue 478183005: Added PrintingContext::Delegate to get parent view handle and application locale. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Mon Aug 25 23:50:54 PDT 2014 Created 6 years, 3 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
« no previous file with comments | « printing/printing_context_win.h ('k') | printing/printing_context_win_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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
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 PrintingContext* PrintingContext::Create(const std::string& app_locale) { 48 scoped_ptr<PrintingContext> PrintingContext::Create(Delegate* delegate) {
49 return static_cast<PrintingContext*>(new PrintingContextWin(app_locale)); 49 return make_scoped_ptr<PrintingContext>(new PrintingContextWin(delegate));
50 } 50 }
51 51
52 PrintingContextWin::PrintingContextWin(const std::string& app_locale) 52 PrintingContextWin::PrintingContextWin(Delegate* delegate)
53 : PrintingContext(app_locale), context_(NULL), dialog_box_(NULL) {} 53 : PrintingContext(delegate), context_(NULL), dialog_box_(NULL) {
54 }
54 55
55 PrintingContextWin::~PrintingContextWin() { 56 PrintingContextWin::~PrintingContextWin() {
56 ReleaseContext(); 57 ReleaseContext();
57 } 58 }
58 59
59 void PrintingContextWin::AskUserForSettings( 60 void PrintingContextWin::AskUserForSettings(
60 gfx::NativeView view, int max_pages, bool has_selection, 61 int max_pages,
62 bool has_selection,
61 const PrintSettingsCallback& callback) { 63 const PrintSettingsCallback& callback) {
62 DCHECK(!in_print_job_); 64 DCHECK(!in_print_job_);
63 dialog_box_dismissed_ = false; 65 dialog_box_dismissed_ = false;
64 66
65 HWND window = GetRootWindow(view); 67 HWND window = GetRootWindow(delegate_->GetParentView());
66 DCHECK(window); 68 DCHECK(window);
67 69
68 // Show the OS-dependent dialog box. 70 // Show the OS-dependent dialog box.
69 // If the user press 71 // If the user press
70 // - OK, the settings are reset and reinitialized with the new settings. OK is 72 // - OK, the settings are reset and reinitialized with the new settings. OK is
71 // returned. 73 // returned.
72 // - Apply then Cancel, the settings are reset and reinitialized with the new 74 // - Apply then Cancel, the settings are reset and reinitialized with the new
73 // settings. CANCEL is returned. 75 // settings. CANCEL is returned.
74 // - Cancel, the settings are not changed, the previous setting, if it was 76 // - Cancel, the settings are not changed, the previous setting, if it was
75 // initialized before, are kept. CANCEL is returned. 77 // initialized before, are kept. CANCEL is returned.
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 605
604 if (dialog_options.hDevMode != NULL) 606 if (dialog_options.hDevMode != NULL)
605 GlobalFree(dialog_options.hDevMode); 607 GlobalFree(dialog_options.hDevMode);
606 if (dialog_options.hDevNames != NULL) 608 if (dialog_options.hDevNames != NULL)
607 GlobalFree(dialog_options.hDevNames); 609 GlobalFree(dialog_options.hDevNames);
608 610
609 return context_ ? OK : FAILED; 611 return context_ ? OK : FAILED;
610 } 612 }
611 613
612 } // namespace printing 614 } // namespace printing
OLDNEW
« no previous file with comments | « printing/printing_context_win.h ('k') | printing/printing_context_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698