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

Side by Side Diff: chrome/browser/ui/webui/print_preview/print_preview_handler.cc

Issue 10764009: Merge 145424 - Fix crash due to incorrectly parented window (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1180/src/
Patch Set: Created 8 years, 5 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 | « no previous file | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/webui/print_preview/print_preview_handler.h" 5 #include "chrome/browser/ui/webui/print_preview/print_preview_handler.h"
6 6
7 #include <ctype.h> 7 #include <ctype.h>
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 if (handler.get()) { 539 if (handler.get()) {
540 PrintPreviewUI* print_preview_ui = 540 PrintPreviewUI* print_preview_ui =
541 static_cast<PrintPreviewUI*>(handler->web_ui()->GetController()); 541 static_cast<PrintPreviewUI*>(handler->web_ui()->GetController());
542 if (print_preview_ui) 542 if (print_preview_ui)
543 print_preview_ui->OnReloadPrintersList(); 543 print_preview_ui->OnReloadPrintersList();
544 } 544 }
545 } 545 }
546 546
547 void PrintPreviewHandler::HandleSignin(const ListValue* /*args*/) { 547 void PrintPreviewHandler::HandleSignin(const ListValue* /*args*/) {
548 gfx::NativeWindow modal_parent = 548 gfx::NativeWindow modal_parent =
549 preview_web_contents()->GetView()->GetTopLevelNativeWindow(); 549 platform_util::GetTopLevel(preview_web_contents()->GetNativeView());
550 print_dialog_cloud::CreateCloudPrintSigninDialog( 550 print_dialog_cloud::CreateCloudPrintSigninDialog(
551 preview_web_contents()->GetBrowserContext(), 551 preview_web_contents()->GetBrowserContext(),
552 modal_parent, 552 modal_parent,
553 base::Bind(&PrintPreviewHandler::OnSigninComplete, AsWeakPtr())); 553 base::Bind(&PrintPreviewHandler::OnSigninComplete, AsWeakPtr()));
554 } 554 }
555 555
556 void PrintPreviewHandler::HandlePrintWithCloudPrint(const ListValue* /*args*/) { 556 void PrintPreviewHandler::HandlePrintWithCloudPrint(const ListValue* /*args*/) {
557 // Record the number of times the user asks to print via cloud print 557 // Record the number of times the user asks to print via cloud print
558 // instead of the print preview dialog. 558 // instead of the print preview dialog.
559 ReportStats(); 559 ReportStats();
560 560
561 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>( 561 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(
562 web_ui()->GetController()); 562 web_ui()->GetController());
563 scoped_refptr<base::RefCountedBytes> data; 563 scoped_refptr<base::RefCountedBytes> data;
564 print_preview_ui->GetPrintPreviewDataForIndex( 564 print_preview_ui->GetPrintPreviewDataForIndex(
565 printing::COMPLETE_PREVIEW_DOCUMENT_INDEX, &data); 565 printing::COMPLETE_PREVIEW_DOCUMENT_INDEX, &data);
566 if (!data.get()) { 566 if (!data.get()) {
567 NOTREACHED(); 567 NOTREACHED();
568 return; 568 return;
569 } 569 }
570 DCHECK_GT(data->size(), 0U); 570 DCHECK_GT(data->size(), 0U);
571 571
572 gfx::NativeWindow modal_parent = 572 gfx::NativeWindow modal_parent =
573 preview_web_contents()->GetView()->GetTopLevelNativeWindow(); 573 platform_util::GetTopLevel(preview_web_contents()->GetNativeView());
574 print_dialog_cloud::CreatePrintDialogForBytes( 574 print_dialog_cloud::CreatePrintDialogForBytes(
575 preview_web_contents()->GetBrowserContext(), 575 preview_web_contents()->GetBrowserContext(),
576 modal_parent, 576 modal_parent,
577 data, 577 data,
578 string16(print_preview_ui->initiator_tab_title()), 578 string16(print_preview_ui->initiator_tab_title()),
579 string16(), 579 string16(),
580 std::string("application/pdf")); 580 std::string("application/pdf"));
581 581
582 // Once the cloud print dialog comes up we're no longer in a background 582 // Once the cloud print dialog comes up we're no longer in a background
583 // printing situation. Close the print preview. 583 // printing situation. Close the print preview.
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 return; 911 return;
912 912
913 // We no longer require the initiator tab details. Remove those details 913 // We no longer require the initiator tab details. Remove those details
914 // associated with the preview tab to allow the initiator tab to create 914 // associated with the preview tab to allow the initiator tab to create
915 // another preview tab. 915 // another preview tab.
916 printing::PrintPreviewTabController* tab_controller = 916 printing::PrintPreviewTabController* tab_controller =
917 printing::PrintPreviewTabController::GetInstance(); 917 printing::PrintPreviewTabController::GetInstance();
918 if (tab_controller) 918 if (tab_controller)
919 tab_controller->EraseInitiatorTabInfo(preview_tab_contents()); 919 tab_controller->EraseInitiatorTabInfo(preview_tab_contents());
920 } 920 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698