| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_RENDERER_MOCK_RENDER_THREAD_H_ | 5 #ifndef CHROME_RENDERER_MOCK_RENDER_THREAD_H_ |
| 6 #define CHROME_RENDERER_MOCK_RENDER_THREAD_H_ | 6 #define CHROME_RENDERER_MOCK_RENDER_THREAD_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 // state. | 78 // state. |
| 79 void SendCloseMessage(); | 79 void SendCloseMessage(); |
| 80 | 80 |
| 81 // Returns the pseudo-printer instance. | 81 // Returns the pseudo-printer instance. |
| 82 MockPrinter* printer() const { return printer_.get(); } | 82 MockPrinter* printer() const { return printer_.get(); } |
| 83 | 83 |
| 84 // Call with |response| set to true if the user wants to print. | 84 // Call with |response| set to true if the user wants to print. |
| 85 // False if the user decides to cancel. | 85 // False if the user decides to cancel. |
| 86 void set_print_dialog_user_response(bool response); | 86 void set_print_dialog_user_response(bool response); |
| 87 | 87 |
| 88 // Cancel print preview when print preview has |page| remaining pages. |
| 89 void set_print_preview_cancel_page_number(int page); |
| 90 |
| 88 // Get the number of pages to generate for print preview. | 91 // Get the number of pages to generate for print preview. |
| 89 int print_preview_pages_remaining(); | 92 int print_preview_pages_remaining(); |
| 90 | 93 |
| 91 private: | 94 private: |
| 92 // This function operates as a regular IPC listener. | 95 // This function operates as a regular IPC listener. |
| 93 bool OnMessageReceived(const IPC::Message& msg); | 96 bool OnMessageReceived(const IPC::Message& msg); |
| 94 | 97 |
| 95 // The Widget expects to be returned valid route_id. | 98 // The Widget expects to be returned valid route_id. |
| 96 void OnMsgCreateWidget(int opener_id, | 99 void OnMsgCreateWidget(int opener_id, |
| 97 WebKit::WebPopupType popup_type, | 100 WebKit::WebPopupType popup_type, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 122 | 125 |
| 123 // PrintWebViewHelper expects final print settings from the user. | 126 // PrintWebViewHelper expects final print settings from the user. |
| 124 void OnScriptedPrint(const PrintHostMsg_ScriptedPrint_Params& params, | 127 void OnScriptedPrint(const PrintHostMsg_ScriptedPrint_Params& params, |
| 125 PrintMsg_PrintPages_Params* settings); | 128 PrintMsg_PrintPages_Params* settings); |
| 126 | 129 |
| 127 void OnDidGetPrintedPagesCount(int cookie, int number_pages); | 130 void OnDidGetPrintedPagesCount(int cookie, int number_pages); |
| 128 void OnDidPrintPage(const PrintHostMsg_DidPrintPage_Params& params); | 131 void OnDidPrintPage(const PrintHostMsg_DidPrintPage_Params& params); |
| 129 void OnDidGetPreviewPageCount( | 132 void OnDidGetPreviewPageCount( |
| 130 const PrintHostMsg_DidGetPreviewPageCount_Params& params); | 133 const PrintHostMsg_DidGetPreviewPageCount_Params& params); |
| 131 void OnDidPreviewPage(const PrintHostMsg_DidPreviewPage_Params& params); | 134 void OnDidPreviewPage(const PrintHostMsg_DidPreviewPage_Params& params); |
| 135 void OnCheckForCancel(const std::string& preview_ui_addr, |
| 136 int preview_request_id, |
| 137 bool* cancel); |
| 138 |
| 132 | 139 |
| 133 // For print preview, PrintWebViewHelper will update settings. | 140 // For print preview, PrintWebViewHelper will update settings. |
| 134 void OnUpdatePrintSettings(int document_cookie, | 141 void OnUpdatePrintSettings(int document_cookie, |
| 135 const DictionaryValue& job_settings, | 142 const DictionaryValue& job_settings, |
| 136 PrintMsg_PrintPages_Params* params); | 143 PrintMsg_PrintPages_Params* params); |
| 137 | 144 |
| 138 IPC::TestSink sink_; | 145 IPC::TestSink sink_; |
| 139 | 146 |
| 140 // Routing id what will be assigned to the Widget. | 147 // Routing id what will be assigned to the Widget. |
| 141 int32 routing_id_; | 148 int32 routing_id_; |
| 142 | 149 |
| 143 // Opener id reported by the Widget. | 150 // Opener id reported by the Widget. |
| 144 int32 opener_id_; | 151 int32 opener_id_; |
| 145 | 152 |
| 146 // We only keep track of one Widget, we learn its pointer when it | 153 // We only keep track of one Widget, we learn its pointer when it |
| 147 // adds a new route. | 154 // adds a new route. |
| 148 IPC::Channel::Listener* widget_; | 155 IPC::Channel::Listener* widget_; |
| 149 | 156 |
| 150 // The last known good deserializer for sync messages. | 157 // The last known good deserializer for sync messages. |
| 151 scoped_ptr<IPC::MessageReplyDeserializer> reply_deserializer_; | 158 scoped_ptr<IPC::MessageReplyDeserializer> reply_deserializer_; |
| 152 | 159 |
| 153 // A mock printer device used for printing tests. | 160 // A mock printer device used for printing tests. |
| 154 scoped_ptr<MockPrinter> printer_; | 161 scoped_ptr<MockPrinter> printer_; |
| 155 | 162 |
| 156 // True to simulate user clicking print. False to cancel. | 163 // True to simulate user clicking print. False to cancel. |
| 157 bool print_dialog_user_response_; | 164 bool print_dialog_user_response_; |
| 158 | 165 |
| 166 // Simulates cancelling print preview if |print_preview_pages_remaining_| |
| 167 // equals this. |
| 168 int print_preview_cancel_page_number_; |
| 169 |
| 159 // Number of pages to generate for print preview. | 170 // Number of pages to generate for print preview. |
| 160 int print_preview_pages_remaining_; | 171 int print_preview_pages_remaining_; |
| 161 }; | 172 }; |
| 162 | 173 |
| 163 #endif // CHROME_RENDERER_MOCK_RENDER_THREAD_H_ | 174 #endif // CHROME_RENDERER_MOCK_RENDER_THREAD_H_ |
| OLD | NEW |