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