| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/renderer/print_web_view_helper.h" | 5 #include "chrome/renderer/print_web_view_helper.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "base/gfx/size.h" | 8 #include "base/gfx/size.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "chrome/common/render_messages.h" | 10 #include "chrome/common/render_messages.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 IPC::SyncMessage* msg = | 57 IPC::SyncMessage* msg = |
| 58 new ViewHostMsg_GetDefaultPrintSettings(routing_id(), &default_settings); | 58 new ViewHostMsg_GetDefaultPrintSettings(routing_id(), &default_settings); |
| 59 if (Send(msg)) { | 59 if (Send(msg)) { |
| 60 msg = NULL; | 60 msg = NULL; |
| 61 // Check if the printer returned any settings, if the settings is empty, we | 61 // Check if the printer returned any settings, if the settings is empty, we |
| 62 // can safely assume there are no printer drivers configured. So we safely | 62 // can safely assume there are no printer drivers configured. So we safely |
| 63 // terminate. | 63 // terminate. |
| 64 if (default_settings.IsEmpty()) { | 64 if (default_settings.IsEmpty()) { |
| 65 // TODO: Create an async alert (http://crbug.com/14918). | 65 // TODO: Create an async alert (http://crbug.com/14918). |
| 66 render_view_->RunJavaScriptAlert(frame, | 66 render_view_->runModalAlertDialog(frame, |
| 67 l10n_util::GetString(IDS_DEFAULT_PRINTER_NOT_FOUND_WARNING)); | 67 l10n_util::GetString(IDS_DEFAULT_PRINTER_NOT_FOUND_WARNING)); |
| 68 return; | 68 return; |
| 69 } | 69 } |
| 70 | 70 |
| 71 // Continue only if the settings are valid. | 71 // Continue only if the settings are valid. |
| 72 if (default_settings.dpi && default_settings.document_cookie) { | 72 if (default_settings.dpi && default_settings.document_cookie) { |
| 73 int expected_pages_count = 0; | 73 int expected_pages_count = 0; |
| 74 | 74 |
| 75 // Prepare once to calculate the estimated page count. This must be in | 75 // Prepare once to calculate the estimated page count. This must be in |
| 76 // a scope for itself (see comments on PrepareFrameAndViewForPrint). | 76 // a scope for itself (see comments on PrepareFrameAndViewForPrint). |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 } | 277 } |
| 278 metafile.CloseEmf(); | 278 metafile.CloseEmf(); |
| 279 if (Send(new ViewHostMsg_DuplicateSection( | 279 if (Send(new ViewHostMsg_DuplicateSection( |
| 280 routing_id(), | 280 routing_id(), |
| 281 page_params.metafile_data_handle, | 281 page_params.metafile_data_handle, |
| 282 &page_params.metafile_data_handle))) { | 282 &page_params.metafile_data_handle))) { |
| 283 Send(new ViewHostMsg_DidPrintPage(routing_id(), page_params)); | 283 Send(new ViewHostMsg_DidPrintPage(routing_id(), page_params)); |
| 284 } | 284 } |
| 285 } | 285 } |
| 286 | 286 |
| OLD | NEW |