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

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
« no previous file with comments | « chrome/browser/printing/background_printing_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
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/prerender/prerender_tab_helper.h" 64 #include "chrome/browser/prerender/prerender_tab_helper.h"
65 #include "chrome/browser/printing/background_printing_manager.h"
65 #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h" 66 #include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h"
66 #include "chrome/browser/printing/print_preview_tab_controller.h" 67 #include "chrome/browser/printing/print_preview_tab_controller.h"
67 #include "chrome/browser/printing/print_view_manager.h" 68 #include "chrome/browser/printing/print_view_manager.h"
68 #include "chrome/browser/profiles/profile.h" 69 #include "chrome/browser/profiles/profile.h"
69 #include "chrome/browser/sessions/restore_tab_helper.h" 70 #include "chrome/browser/sessions/restore_tab_helper.h"
70 #include "chrome/browser/sessions/session_service.h" 71 #include "chrome/browser/sessions/session_service.h"
71 #include "chrome/browser/sessions/session_service_factory.h" 72 #include "chrome/browser/sessions/session_service_factory.h"
72 #include "chrome/browser/sessions/session_types.h" 73 #include "chrome/browser/sessions/session_types.h"
73 #include "chrome/browser/sessions/tab_restore_service.h" 74 #include "chrome/browser/sessions/tab_restore_service.h"
74 #include "chrome/browser/sessions/tab_restore_service_factory.h" 75 #include "chrome/browser/sessions/tab_restore_service_factory.h"
(...skipping 3408 matching lines...) Expand 10 before | Expand all | Expand 10 after
3483 void Browser::CloseContents(TabContents* source) { 3484 void Browser::CloseContents(TabContents* source) {
3484 if (is_attempting_to_close_browser_) { 3485 if (is_attempting_to_close_browser_) {
3485 // If we're trying to close the browser, just clear the state related to 3486 // If we're trying to close the browser, just clear the state related to
3486 // waiting for unload to fire. Don't actually try to close the tab as it 3487 // waiting for unload to fire. Don't actually try to close the tab as it
3487 // will go down the slow shutdown path instead of the fast path of killing 3488 // will go down the slow shutdown path instead of the fast path of killing
3488 // all the renderer processes. 3489 // all the renderer processes.
3489 ClearUnloadState(source, true); 3490 ClearUnloadState(source, true);
3490 return; 3491 return;
3491 } 3492 }
3492 3493
3494 // Various sites have a pattern which open a new window with output formatted
3495 // for printing, then include a print button, which does window.print();
3496 // window.close(); An example is printing Virgin America boarding
3497 // pass. Instead of closing, when a print tab is associated with this tab,
3498 // tell the BackgroundPrintingManager to own it, which causes it to be
3499 // hidden and eventually closed when the print window is closed.
3500 TabContentsWrapper* source_wrapper =
3501 TabContentsWrapper::GetCurrentWrapperForContents(source);
3502 if (g_browser_process->background_printing_manager()->
3503 OwnInitiatorTab(source_wrapper)) {
3504 return;
3505 }
3506
3493 int index = tab_handler_->GetTabStripModel()->GetWrapperIndex(source); 3507 int index = tab_handler_->GetTabStripModel()->GetWrapperIndex(source);
3494 if (index == TabStripModel::kNoTab) { 3508 if (index == TabStripModel::kNoTab) {
3495 NOTREACHED() << "CloseContents called for tab not in our strip"; 3509 NOTREACHED() << "CloseContents called for tab not in our strip";
3496 return; 3510 return;
3497 } 3511 }
3498 tab_handler_->GetTabStripModel()->CloseTabContentsAt( 3512 tab_handler_->GetTabStripModel()->CloseTabContentsAt(
3499 index, 3513 index,
3500 TabStripModel::CLOSE_CREATE_HISTORICAL_TAB); 3514 TabStripModel::CLOSE_CREATE_HISTORICAL_TAB);
3501 } 3515 }
3502 3516
(...skipping 1740 matching lines...) Expand 10 before | Expand all | Expand 10 after
5243 profile()->GetOriginalProfile()->GetProfileSyncService(); 5257 profile()->GetOriginalProfile()->GetProfileSyncService();
5244 if (service->HasSyncSetupCompleted()) 5258 if (service->HasSyncSetupCompleted())
5245 ShowOptionsTab(chrome::kSyncSetupSubPage); 5259 ShowOptionsTab(chrome::kSyncSetupSubPage);
5246 else 5260 else
5247 service->ShowLoginDialog(); 5261 service->ShowLoginDialog();
5248 } 5262 }
5249 5263
5250 void Browser::ToggleSpeechInput() { 5264 void Browser::ToggleSpeechInput() {
5251 GetSelectedTabContentsWrapper()->render_view_host()->ToggleSpeechInput(); 5265 GetSelectedTabContentsWrapper()->render_view_host()->ToggleSpeechInput();
5252 } 5266 }
OLDNEW
« no previous file with comments | « chrome/browser/printing/background_printing_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698