| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <fstream> | 8 #include <fstream> |
| 9 #include <iostream> | 9 #include <iostream> |
| 10 #include <iterator> | 10 #include <iterator> |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 | 134 |
| 135 // Actually stops the message loop so that the test can proceed. | 135 // Actually stops the message loop so that the test can proceed. |
| 136 void EndLoop() { | 136 void EndLoop() { |
| 137 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, quit_closure_); | 137 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, quit_closure_); |
| 138 } | 138 } |
| 139 | 139 |
| 140 bool OnMessageReceived(const IPC::Message& message) override { | 140 bool OnMessageReceived(const IPC::Message& message) override { |
| 141 IPC_BEGIN_MESSAGE_MAP(PrintPreviewObserver, message) | 141 IPC_BEGIN_MESSAGE_MAP(PrintPreviewObserver, message) |
| 142 IPC_MESSAGE_HANDLER(PrintHostMsg_DidGetPreviewPageCount, | 142 IPC_MESSAGE_HANDLER(PrintHostMsg_DidGetPreviewPageCount, |
| 143 OnDidGetPreviewPageCount) | 143 OnDidGetPreviewPageCount) |
| 144 IPC_END_MESSAGE_MAP(); | 144 IPC_END_MESSAGE_MAP() |
| 145 return false; | 145 return false; |
| 146 } | 146 } |
| 147 | 147 |
| 148 // Gets the web contents for the print preview dialog so that the UI and | 148 // Gets the web contents for the print preview dialog so that the UI and |
| 149 // other elements can be accessed. | 149 // other elements can be accessed. |
| 150 WebContents* GetDialog() { | 150 WebContents* GetDialog() { |
| 151 WebContents* tab = browser_->tab_strip_model()->GetActiveWebContents(); | 151 WebContents* tab = browser_->tab_strip_model()->GetActiveWebContents(); |
| 152 PrintPreviewDialogController* dialog_controller = | 152 PrintPreviewDialogController* dialog_controller = |
| 153 PrintPreviewDialogController::GetInstance(); | 153 PrintPreviewDialogController::GetInstance(); |
| 154 return dialog_controller->GetPrintPreviewForContents(tab); | 154 return dialog_controller->GetPrintPreviewForContents(tab); |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 // waiting for this message and start waiting for the image data. | 638 // waiting for this message and start waiting for the image data. |
| 639 std::cout << "#EOF\n"; | 639 std::cout << "#EOF\n"; |
| 640 std::cout.flush(); | 640 std::cout.flush(); |
| 641 | 641 |
| 642 SendPng(); | 642 SendPng(); |
| 643 Reset(); | 643 Reset(); |
| 644 } | 644 } |
| 645 } | 645 } |
| 646 | 646 |
| 647 } // namespace printing | 647 } // namespace printing |
| OLD | NEW |