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

Side by Side Diff: chrome/browser/ui/browser.cc

Issue 7800036: Print Preview: Hold on to tabs that do window.print(); window.close() until print preview finishes. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 3 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/ui/browser.h" 5 #include "chrome/browser/ui/browser.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #endif // OS_WIN 10 #endif // OS_WIN
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 #include "chrome/browser/infobars/infobar_tab_helper.h" 54 #include "chrome/browser/infobars/infobar_tab_helper.h"
55 #include "chrome/browser/instant/instant_controller.h" 55 #include "chrome/browser/instant/instant_controller.h"
56 #include "chrome/browser/instant/instant_unload_handler.h" 56 #include "chrome/browser/instant/instant_unload_handler.h"
57 #include "chrome/browser/intents/register_intent_handler_infobar_delegate.h" 57 #include "chrome/browser/intents/register_intent_handler_infobar_delegate.h"
58 #include "chrome/browser/net/browser_url_util.h" 58 #include "chrome/browser/net/browser_url_util.h"
59 #include "chrome/browser/net/url_fixer_upper.h" 59 #include "chrome/browser/net/url_fixer_upper.h"
60 #include "chrome/browser/notifications/notification_ui_manager.h" 60 #include "chrome/browser/notifications/notification_ui_manager.h"
61 #include "chrome/browser/platform_util.h" 61 #include "chrome/browser/platform_util.h"
62 #include "chrome/browser/prefs/incognito_mode_prefs.h" 62 #include "chrome/browser/prefs/incognito_mode_prefs.h"
63 #include "chrome/browser/prefs/pref_service.h" 63 #include "chrome/browser/prefs/pref_service.h"
64 #include "chrome/browser/printing/background_printing_manager.h"
64 #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h" 65 #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h"
65 #include "chrome/browser/printing/print_preview_tab_controller.h" 66 #include "chrome/browser/printing/print_preview_tab_controller.h"
66 #include "chrome/browser/printing/print_view_manager.h" 67 #include "chrome/browser/printing/print_view_manager.h"
67 #include "chrome/browser/profiles/profile.h" 68 #include "chrome/browser/profiles/profile.h"
68 #include "chrome/browser/sessions/restore_tab_helper.h" 69 #include "chrome/browser/sessions/restore_tab_helper.h"
69 #include "chrome/browser/sessions/session_service.h" 70 #include "chrome/browser/sessions/session_service.h"
70 #include "chrome/browser/sessions/session_service_factory.h" 71 #include "chrome/browser/sessions/session_service_factory.h"
71 #include "chrome/browser/sessions/session_types.h" 72 #include "chrome/browser/sessions/session_types.h"
72 #include "chrome/browser/sessions/tab_restore_service.h" 73 #include "chrome/browser/sessions/tab_restore_service.h"
73 #include "chrome/browser/sessions/tab_restore_service_factory.h" 74 #include "chrome/browser/sessions/tab_restore_service_factory.h"
(...skipping 3366 matching lines...) Expand 10 before | Expand all | Expand 10 after
3440 void Browser::CloseContents(TabContents* source) { 3441 void Browser::CloseContents(TabContents* source) {
3441 if (is_attempting_to_close_browser_) { 3442 if (is_attempting_to_close_browser_) {
3442 // If we're trying to close the browser, just clear the state related to 3443 // If we're trying to close the browser, just clear the state related to
3443 // waiting for unload to fire. Don't actually try to close the tab as it 3444 // waiting for unload to fire. Don't actually try to close the tab as it
3444 // will go down the slow shutdown path instead of the fast path of killing 3445 // will go down the slow shutdown path instead of the fast path of killing
3445 // all the renderer processes. 3446 // all the renderer processes.
3446 ClearUnloadState(source, true); 3447 ClearUnloadState(source, true);
3447 return; 3448 return;
3448 } 3449 }
3449 3450
3451 // Various sites have a pattern which open a new window with output formatted
3452 // for printing, then include a print button, which does window.print();
3453 // window.close(); An example is printing Virgin America boarding
3454 // pass. Instead of closing, when a print tab is associated with this tab,
3455 // tell the BackgroundPrintingManager to own it, which causes it to be
3456 // hidden and eventually closed when the print window is closed.
3457 TabContentsWrapper* source_wrapper =
3458 TabContentsWrapper::GetCurrentWrapperForContents(source);
3459 if (g_browser_process->background_printing_manager()->
3460 OwnInitiatorTab(source_wrapper)) {
kmadhusu 2011/09/07 23:21:10 nit: Fix indentation.
Lei Zhang 2011/09/07 23:41:16 Done.
3461 return;
3462 }
3463
3450 int index = tab_handler_->GetTabStripModel()->GetWrapperIndex(source); 3464 int index = tab_handler_->GetTabStripModel()->GetWrapperIndex(source);
3451 if (index == TabStripModel::kNoTab) { 3465 if (index == TabStripModel::kNoTab) {
3452 NOTREACHED() << "CloseContents called for tab not in our strip"; 3466 NOTREACHED() << "CloseContents called for tab not in our strip";
3453 return; 3467 return;
3454 } 3468 }
3455 tab_handler_->GetTabStripModel()->CloseTabContentsAt( 3469 tab_handler_->GetTabStripModel()->CloseTabContentsAt(
3456 index, 3470 index,
3457 TabStripModel::CLOSE_CREATE_HISTORICAL_TAB); 3471 TabStripModel::CLOSE_CREATE_HISTORICAL_TAB);
3458 } 3472 }
3459 3473
(...skipping 1728 matching lines...) Expand 10 before | Expand all | Expand 10 after
5188 profile()->GetOriginalProfile()->GetProfileSyncService(); 5202 profile()->GetOriginalProfile()->GetProfileSyncService();
5189 if (service->HasSyncSetupCompleted()) 5203 if (service->HasSyncSetupCompleted())
5190 ShowOptionsTab(chrome::kSyncSetupSubPage); 5204 ShowOptionsTab(chrome::kSyncSetupSubPage);
5191 else 5205 else
5192 service->ShowLoginDialog(); 5206 service->ShowLoginDialog();
5193 } 5207 }
5194 5208
5195 void Browser::ToggleSpeechInput() { 5209 void Browser::ToggleSpeechInput() {
5196 GetSelectedTabContentsWrapper()->render_view_host()->ToggleSpeechInput(); 5210 GetSelectedTabContentsWrapper()->render_view_host()->ToggleSpeechInput();
5197 } 5211 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698