Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Unified Diff: chrome/browser/ui/browser.cc

Issue 8520011: Print Preview: Make print preview tab modal. (try 2) (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: disable tests in touch_ui, fix failing test Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/print_preview/print_preview.js ('k') | chrome/browser/ui/browser_list_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser.cc
===================================================================
--- chrome/browser/ui/browser.cc (revision 110066)
+++ chrome/browser/ui/browser.cc (working copy)
@@ -69,7 +69,6 @@
#include "chrome/browser/prefs/incognito_mode_prefs.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prerender/prerender_tab_helper.h"
-#include "chrome/browser/printing/background_printing_manager.h"
#include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h"
#include "chrome/browser/printing/print_preview_tab_controller.h"
#include "chrome/browser/printing/print_view_manager.h"
@@ -3552,19 +3551,6 @@
return;
}
- // Various sites have a pattern which open a new window with output formatted
- // for printing, then include a print button, which does window.print();
- // window.close(); An example is printing Virgin America boarding
- // pass. Instead of closing, when a print tab is associated with this tab,
- // tell the BackgroundPrintingManager to own it, which causes it to be
- // hidden and eventually closed when the print window is closed.
- TabContentsWrapper* source_wrapper =
- TabContentsWrapper::GetCurrentWrapperForContents(source);
- if (g_browser_process->background_printing_manager()->
- OwnInitiatorTab(source_wrapper)) {
- return;
- }
-
int index = tab_handler_->GetTabStripModel()->GetWrapperIndex(source);
if (index == TabStripModel::kNoTab) {
NOTREACHED() << "CloseContents called for tab not in our strip";
@@ -3847,6 +3833,21 @@
}
void Browser::RendererUnresponsive(TabContents* source) {
+ // Ignore hangs if print preview is open.
+ TabContentsWrapper* source_wrapper =
+ TabContentsWrapper::GetCurrentWrapperForContents(source);
+ if (source_wrapper) {
+ printing::PrintPreviewTabController* controller =
+ printing::PrintPreviewTabController::GetInstance();
+ if (controller) {
+ TabContentsWrapper* preview_tab =
+ controller->GetPrintPreviewForTab(source_wrapper);
+ if (preview_tab && preview_tab != source_wrapper) {
+ return;
+ }
+ }
+ }
+
browser::ShowHungRendererDialog(source);
}
@@ -4790,9 +4791,8 @@
// where advanced printing is always enabled.
printing::PrintPreviewTabController* controller =
printing::PrintPreviewTabController::GetInstance();
- if (controller &&
- wrapper &&
- wrapper == controller->GetPrintPreviewForTab(wrapper)) {
+ if (controller && (controller->GetPrintPreviewForTab(wrapper) ||
Lei Zhang 2011/11/15 11:40:34 It turns out the code removed in http://codereview
+ controller->is_creating_print_preview_tab())) {
advanced_print_enabled = true;
}
}
« no previous file with comments | « chrome/browser/resources/print_preview/print_preview.js ('k') | chrome/browser/ui/browser_list_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698