Chromium Code Reviews| Index: chrome/browser/printing/print_preview_message_handler.cc |
| =================================================================== |
| --- chrome/browser/printing/print_preview_message_handler.cc (revision 108195) |
| +++ chrome/browser/printing/print_preview_message_handler.cc (working copy) |
| @@ -171,8 +171,6 @@ |
| return; |
| } |
| - print_preview_tab->print_view_manager()->OverrideTitle(tab_contents()); |
| - |
| // TODO(joth): This seems like a good match for using RefCountedStaticMemory |
| // to avoid the memory copy, but the SetPrintPreviewData call chain below |
| // needs updating to accept the RefCountedMemory* base class. |
| @@ -243,10 +241,38 @@ |
| } |
| void PrintPreviewMessageHandler::DidStartLoading() { |
| - if (tab_contents()->delegate() && |
| - PrintPreviewTabController::IsPrintPreviewTab(tab_contents_wrapper())) { |
| - tab_contents()->SetContentRestrictions(content::CONTENT_RESTRICTION_PRINT); |
| + TabContentsWrapper* tab_wrapper = tab_contents_wrapper(); |
| + TabContents* tab = tab_contents(); |
| + if (tab->delegate() && |
| + PrintPreviewTabController::IsPrintPreviewTab(tab_wrapper)) { |
| + tab->SetContentRestrictions(content::CONTENT_RESTRICTION_PRINT); |
| + |
| + // Need to get the initiator tab to enabled advanced printing. |
| + PrintPreviewTabController* tab_controller = |
| + PrintPreviewTabController::GetInstance(); |
| + if (tab_controller) { |
| + TabContentsWrapper* initiator_tab_wrapper = |
| + tab_controller->GetInitiatorTab(tab_wrapper); |
| + if (initiator_tab_wrapper) { |
| + TabContents* initiator_tab = initiator_tab_wrapper->tab_contents(); |
| + initiator_tab->SetContentRestrictions( |
| + initiator_tab->content_restrictions()); |
| + } |
| + } |
|
vandebo (ex-Chrome)
2011/11/02 20:50:30
What should happen if either of these fail?
Lei Zhang
2011/11/02 22:50:03
Kausalya was wondering where we unset this, and it
|
| } |
| } |
| +void PrintPreviewMessageHandler::NavigateToPendingEntry( |
| + const GURL& url, |
| + NavigationController::ReloadType reload_type) { |
| + TabContentsWrapper* tab = tab_contents_wrapper(); |
| + TabContentsWrapper* preview_tab = GetPrintPreviewTab(); |
| + if (tab == preview_tab) { |
| + // Cloud print sign-in reloads the page. |
| + DCHECK(PrintPreviewTabController::IsPrintPreviewURL(url)); |
| + DCHECK_EQ(NavigationController::RELOAD, reload_type); |
| + return; |
| + } |
| +} |
| + |
| } // namespace printing |