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(FROM_HERE, | 484 quit_timer.Start(TimeDelta::FromMilliseconds(kPrinterSettingsTimeout), |
485 TimeDelta::FromMilliseconds(kPrinterSettingsTimeout), | |
486 MessageLoop::current(), &MessageLoop::Quit); | 485 MessageLoop::current(), &MessageLoop::Quit); |
487 | 486 |
488 inside_inner_message_loop_ = true; | 487 inside_inner_message_loop_ = true; |
489 | 488 |
490 // Need to enable recursive task. | 489 // Need to enable recursive task. |
491 bool old_state = MessageLoop::current()->NestableTasksAllowed(); | 490 bool old_state = MessageLoop::current()->NestableTasksAllowed(); |
492 MessageLoop::current()->SetNestableTasksAllowed(true); | 491 MessageLoop::current()->SetNestableTasksAllowed(true); |
493 MessageLoop::current()->Run(); | 492 MessageLoop::current()->Run(); |
494 // Restore task state. | 493 // Restore task state. |
495 MessageLoop::current()->SetNestableTasksAllowed(old_state); | 494 MessageLoop::current()->SetNestableTasksAllowed(old_state); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 } | 534 } |
536 | 535 |
537 bool PrintViewManager::PrintNowInternal(IPC::Message* message) { | 536 bool PrintViewManager::PrintNowInternal(IPC::Message* message) { |
538 // Don't print / print preview interstitials. | 537 // Don't print / print preview interstitials. |
539 if (tab_contents()->showing_interstitial_page()) | 538 if (tab_contents()->showing_interstitial_page()) |
540 return false; | 539 return false; |
541 return Send(message); | 540 return Send(message); |
542 } | 541 } |
543 | 542 |
544 } // namespace printing | 543 } // namespace printing |
OLD | NEW |