OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "android_webview/browser/aw_print_manager.h" | 5 #include "android_webview/browser/aw_print_manager.h" |
6 | 6 |
7 #include "components/printing/browser/print_manager_utils.h" | 7 #include "components/printing/browser/print_manager_utils.h" |
8 #include "components/printing/common/print_messages.h" | 8 #include "components/printing/common/print_messages.h" |
9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 } | 37 } |
38 | 38 |
39 AwPrintManager::~AwPrintManager() { | 39 AwPrintManager::~AwPrintManager() { |
40 } | 40 } |
41 | 41 |
42 bool AwPrintManager::PrintNow() { | 42 bool AwPrintManager::PrintNow() { |
43 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 43 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
44 return Send(new PrintMsg_PrintPages(routing_id())); | 44 return Send(new PrintMsg_PrintPages(routing_id())); |
45 } | 45 } |
46 | 46 |
47 bool AwPrintManager::OnMessageReceived(const IPC::Message& message) { | 47 bool AwPrintManager::OnMessageReceived( |
| 48 const IPC::Message& message, |
| 49 content::RenderFrameHost* render_frame_host) { |
48 bool handled = true; | 50 bool handled = true; |
49 IPC_BEGIN_MESSAGE_MAP(AwPrintManager, message) | 51 IPC_BEGIN_MESSAGE_MAP(AwPrintManager, message) |
50 IPC_MESSAGE_HANDLER_DELAY_REPLY(PrintHostMsg_GetDefaultPrintSettings, | 52 IPC_MESSAGE_HANDLER_DELAY_REPLY(PrintHostMsg_GetDefaultPrintSettings, |
51 OnGetDefaultPrintSettings) | 53 OnGetDefaultPrintSettings) |
52 IPC_MESSAGE_UNHANDLED(handled = false) | 54 IPC_MESSAGE_UNHANDLED(handled = false) |
53 IPC_END_MESSAGE_MAP() | 55 IPC_END_MESSAGE_MAP() |
54 return handled ? true : PrintManager::OnMessageReceived(message); | 56 return handled ? true |
| 57 : PrintManager::OnMessageReceived(message, render_frame_host); |
55 } | 58 } |
56 | 59 |
57 void AwPrintManager::OnGetDefaultPrintSettings(IPC::Message* reply_msg) { | 60 void AwPrintManager::OnGetDefaultPrintSettings(IPC::Message* reply_msg) { |
58 // Unlike the printing_message_filter, we do process this in UI thread. | 61 // Unlike the printing_message_filter, we do process this in UI thread. |
59 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 62 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
60 PrintMsg_Print_Params params; | 63 PrintMsg_Print_Params params; |
61 printing::RenderParamsFromPrintSettings(settings_, ¶ms); | 64 printing::RenderParamsFromPrintSettings(settings_, ¶ms); |
62 params.document_cookie = cookie_; | 65 params.document_cookie = cookie_; |
63 PrintHostMsg_GetDefaultPrintSettings::WriteReplyParams(reply_msg, params); | 66 PrintHostMsg_GetDefaultPrintSettings::WriteReplyParams(reply_msg, params); |
64 Send(reply_msg); | 67 Send(reply_msg); |
65 } | 68 } |
66 | 69 |
67 } // namespace android_webview | 70 } // namespace android_webview |
OLD | NEW |