diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-12 19:26:40 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-12 19:26:40 +0000 |
commit | fc790462b4f248712bbc8c3734664dd6b05f80f2 (patch) | |
tree | 4ef04b11c6620ac2c95fb3f87e0d722e7bbcd1ee /chrome | |
parent | 1d0ee423b6a0bb307c7c19fe28c95d8761691e9a (diff) | |
download | chromium_src-fc790462b4f248712bbc8c3734664dd6b05f80f2.zip chromium_src-fc790462b4f248712bbc8c3734664dd6b05f80f2.tar.gz chromium_src-fc790462b4f248712bbc8c3734664dd6b05f80f2.tar.bz2 |
Set the job name for the print job on the Mac.
BUG=http://crbug.com/29188
TEST=as in bug
Review URL: http://codereview.chromium.org/1997016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47056 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/printing/print_job_worker.cc | 10 | ||||
-rw-r--r-- | chrome/browser/printing/print_job_worker.h | 4 | ||||
-rw-r--r-- | chrome/browser/printing/printer_query.cc | 4 | ||||
-rw-r--r-- | chrome/browser/printing/printer_query.h | 6 | ||||
-rw-r--r-- | chrome/browser/renderer_host/resource_message_filter.cc | 24 |
5 files changed, 17 insertions, 31 deletions
diff --git a/chrome/browser/printing/print_job_worker.cc b/chrome/browser/printing/print_job_worker.cc index 34d14dc..3a9ae03 100644 --- a/chrome/browser/printing/print_job_worker.cc +++ b/chrome/browser/printing/print_job_worker.cc @@ -65,7 +65,7 @@ void PrintJobWorker::SetNewOwner(PrintJobWorkerOwner* new_owner) { } void PrintJobWorker::GetSettings(bool ask_user_for_settings, - gfx::NativeWindow parent_window, + gfx::NativeView parent_view, int document_page_count, bool has_selection, bool use_overlays) { @@ -82,11 +82,11 @@ void PrintJobWorker::GetSettings(bool ask_user_for_settings, ChromeThread::PostTask( ChromeThread::UI, FROM_HERE, NewRunnableMethod(this, &PrintJobWorker::GetSettingsWithUI, - parent_window, document_page_count, + parent_view, document_page_count, has_selection)); #else PrintingContext::Result result = printing_context_.AskUserForSettings( - parent_window, document_page_count, has_selection); + parent_view, document_page_count, has_selection); GetSettingsDone(result); #endif } else { @@ -111,13 +111,13 @@ void PrintJobWorker::GetSettingsDone(PrintingContext::Result result) { } #if defined(OS_MACOSX) -void PrintJobWorker::GetSettingsWithUI(gfx::NativeWindow parent_window, +void PrintJobWorker::GetSettingsWithUI(gfx::NativeView parent_view, int document_page_count, bool has_selection) { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); PrintingContext::Result result = printing_context_.AskUserForSettings( - parent_window, document_page_count, has_selection); + parent_view, document_page_count, has_selection); message_loop()->PostTask(FROM_HERE, NewRunnableMethod( this, &PrintJobWorker::GetSettingsDone, result)); } diff --git a/chrome/browser/printing/print_job_worker.h b/chrome/browser/printing/print_job_worker.h index 8562ea9..ece1659 100644 --- a/chrome/browser/printing/print_job_worker.h +++ b/chrome/browser/printing/print_job_worker.h @@ -34,7 +34,7 @@ class PrintJobWorker : public base::Thread { // Initializes the print settings. If |ask_user_for_settings| is true, a // Print... dialog box will be shown to ask the user his preference. void GetSettings(bool ask_user_for_settings, - gfx::NativeWindow parent_window, + gfx::NativeView parent_view, int document_page_count, bool has_selection, bool use_overlays); @@ -83,7 +83,7 @@ class PrintJobWorker : public base::Thread { #if defined(OS_MACOSX) // Asks the user for print settings. Must be called on the UI thread. // Mac-only since Windows can display UI from non-main threads. - void GetSettingsWithUI(gfx::NativeWindow parent_window, + void GetSettingsWithUI(gfx::NativeView parent_view, int document_page_count, bool has_selection); #endif diff --git a/chrome/browser/printing/printer_query.cc b/chrome/browser/printing/printer_query.cc index 86c0f67..9b5772fb 100644 --- a/chrome/browser/printing/printer_query.cc +++ b/chrome/browser/printing/printer_query.cc @@ -62,7 +62,7 @@ PrintJobWorker* PrinterQuery::DetachWorker(PrintJobWorkerOwner* new_owner) { } void PrinterQuery::GetSettings(GetSettingsAskParam ask_user_for_settings, - gfx::NativeWindow parent_window, + gfx::NativeView parent_view, int expected_page_count, bool has_selection, bool use_overlays, @@ -92,7 +92,7 @@ void PrinterQuery::GetSettings(GetSettingsAskParam ask_user_for_settings, worker_.get(), &PrintJobWorker::GetSettings, is_print_dialog_box_shown_, - parent_window, + parent_view, expected_page_count, has_selection, use_overlays)); diff --git a/chrome/browser/printing/printer_query.h b/chrome/browser/printing/printer_query.h index 8810022..d1d054d 100644 --- a/chrome/browser/printing/printer_query.h +++ b/chrome/browser/printing/printer_query.h @@ -43,11 +43,11 @@ class PrinterQuery : public PrintJobWorkerOwner { virtual int cookie() const { return cookie_; } // Initializes the printing context. It is fine to call this function multiple - // times to reinitialize the settings. |parent_window| parameter will be the - // owner of the print setting dialog box. It is unused when + // times to reinitialize the settings. |parent_view| parameter's window will + // be the owner of the print setting dialog box. It is unused when // |ask_for_user_settings| is DEFAULTS. void GetSettings(GetSettingsAskParam ask_user_for_settings, - gfx::NativeWindow parent_window, + gfx::NativeView parent_view, int expected_page_count, bool has_selection, bool use_overlays, diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc index bf79fa5..791cd5b 100644 --- a/chrome/browser/renderer_host/resource_message_filter.cc +++ b/chrome/browser/renderer_host/resource_message_filter.cc @@ -433,7 +433,8 @@ bool ResourceMessageFilter::OnMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(ViewHostMsg_CreateWidget, OnMsgCreateWidget) IPC_MESSAGE_HANDLER(ViewHostMsg_SetCookie, OnSetCookie) IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetCookies, OnGetCookies) - IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetRawCookies, OnGetRawCookies) + IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetRawCookies, + OnGetRawCookies) IPC_MESSAGE_HANDLER(ViewHostMsg_DeleteCookie, OnDeleteCookie) IPC_MESSAGE_HANDLER(ViewHostMsg_GetCookiesEnabled, OnGetCookiesEnabled) #if defined(OS_WIN) // This hack is Windows-specific. @@ -1131,12 +1132,8 @@ void ResourceMessageFilter::OnGetDefaultPrintSettingsReply( void ResourceMessageFilter::OnScriptedPrint( const ViewHostMsg_ScriptedPrint_Params& params, IPC::Message* reply_msg) { -#if defined(OS_WIN) - HWND host_window = gfx::NativeViewFromId(params.host_window_id); -#elif defined(OS_MACOSX) - gfx::NativeWindow host_window = NULL; - // TODO: Get an actual window ref here, to allow a sheet-based print dialog. -#endif + gfx::NativeView host_view = + gfx::NativeViewFromIdInBrowser(params.host_window_id); scoped_refptr<printing::PrinterQuery> printer_query; print_job_manager_->PopPrinterQuery(params.cookie, &printer_query); @@ -1150,20 +1147,9 @@ void ResourceMessageFilter::OnScriptedPrint( printer_query, params.routing_id, reply_msg); -#if defined(OS_WIN) - // Shows the Print... dialog box. This is asynchronous, only the IPC message - // sender will hang until the Print dialog is dismissed. - if (!host_window || !IsWindow(host_window)) { - // TODO(maruel): bug 1214347 Get the right browser window instead. - host_window = GetDesktopWindow(); - } else { - host_window = GetAncestor(host_window, GA_ROOTOWNER); - } - DCHECK(host_window); -#endif printer_query->GetSettings(printing::PrinterQuery::ASK_USER, - host_window, + host_view, params.expected_pages_count, params.has_selection, params.use_overlays, |