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 #include "chrome/browser/printing/print_view_manager.h" | 5 #include "chrome/browser/printing/print_view_manager.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/printing/print_job.h" | 10 #include "chrome/browser/printing/print_job.h" |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 // here is that some poor users have their print server away on a VPN over a | 474 // here is that some poor users have their print server away on a VPN over a |
475 // slow connection. In this situation, the simple fact of opening the printer | 475 // slow connection. In this situation, the simple fact of opening the printer |
476 // can be dead slow. On the other side, we don't want to die infinitely for a | 476 // can be dead slow. On the other side, we don't want to die infinitely for a |
477 // real network error. Give the printer 60 seconds to comply. | 477 // real network error. Give the printer 60 seconds to comply. |
478 // | 478 // |
479 // - If we're looping because of renderer page generation, the renderer could | 479 // - If we're looping because of renderer page generation, the renderer could |
480 // be CPU bound, the page overly complex/large or the system just | 480 // be CPU bound, the page overly complex/large or the system just |
481 // memory-bound. | 481 // memory-bound. |
482 static const int kPrinterSettingsTimeout = 60000; | 482 static const int kPrinterSettingsTimeout = 60000; |
483 base::OneShotTimer<MessageLoop> quit_timer; | 483 base::OneShotTimer<MessageLoop> quit_timer; |
484 quit_timer.Start(TimeDelta::FromMilliseconds(kPrinterSettingsTimeout), | 484 quit_timer.Start(FROM_HERE, |
| 485 TimeDelta::FromMilliseconds(kPrinterSettingsTimeout), |
485 MessageLoop::current(), &MessageLoop::Quit); | 486 MessageLoop::current(), &MessageLoop::Quit); |
486 | 487 |
487 inside_inner_message_loop_ = true; | 488 inside_inner_message_loop_ = true; |
488 | 489 |
489 // Need to enable recursive task. | 490 // Need to enable recursive task. |
490 bool old_state = MessageLoop::current()->NestableTasksAllowed(); | 491 bool old_state = MessageLoop::current()->NestableTasksAllowed(); |
491 MessageLoop::current()->SetNestableTasksAllowed(true); | 492 MessageLoop::current()->SetNestableTasksAllowed(true); |
492 MessageLoop::current()->Run(); | 493 MessageLoop::current()->Run(); |
493 // Restore task state. | 494 // Restore task state. |
494 MessageLoop::current()->SetNestableTasksAllowed(old_state); | 495 MessageLoop::current()->SetNestableTasksAllowed(old_state); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 } | 535 } |
535 | 536 |
536 bool PrintViewManager::PrintNowInternal(IPC::Message* message) { | 537 bool PrintViewManager::PrintNowInternal(IPC::Message* message) { |
537 // Don't print / print preview interstitials. | 538 // Don't print / print preview interstitials. |
538 if (tab_contents()->showing_interstitial_page()) | 539 if (tab_contents()->showing_interstitial_page()) |
539 return false; | 540 return false; |
540 return Send(message); | 541 return Send(message); |
541 } | 542 } |
542 | 543 |
543 } // namespace printing | 544 } // namespace printing |
OLD | NEW |