Chromium Code Reviews| Index: chrome/browser/printing/print_preview_dialog_controller.cc |
| diff --git a/chrome/browser/printing/print_preview_dialog_controller.cc b/chrome/browser/printing/print_preview_dialog_controller.cc |
| index 67e4faa47b7eef80a684213c9264f64f1ee37980..bd32d450c68a021c93b748018e719deb2a223f17 100644 |
| --- a/chrome/browser/printing/print_preview_dialog_controller.cc |
| +++ b/chrome/browser/printing/print_preview_dialog_controller.cc |
| @@ -182,6 +182,14 @@ WebContents* PrintPreviewDialogController::GetOrCreatePreviewDialog( |
| WebContents* PrintPreviewDialogController::GetPrintPreviewForContents( |
| WebContents* contents) const { |
| + // If this WebContents relies on another for its preview dialog, we |
| + // need to act as if we are looking for the proxied content's dialog. |
| + PrintPreviewDialogMap::const_iterator proxied = |
| + proxied_dialog_map_.find(contents); |
| + if (proxied != proxied_dialog_map_.end()) { |
| + contents = const_cast<WebContents*>(proxied->second); |
|
Avi (use Gerrit)
2015/07/23 18:25:52
From what I see, |proxied->second| is already a We
|
| + } |
| + |
| // |preview_dialog_map_| is keyed by the preview dialog, so if find() |
| // succeeds, then |contents| is the preview dialog. |
| PrintPreviewDialogMap::const_iterator it = preview_dialog_map_.find(contents); |
| @@ -374,6 +382,17 @@ WebContents* PrintPreviewDialogController::CreatePrintPreviewDialog( |
| return preview_dialog; |
| } |
| +void PrintPreviewDialogController::AddProxyDialogForWebContents( |
| + WebContents* source, |
| + WebContents* target) { |
| + proxied_dialog_map_[source] = target; |
| +} |
| + |
| +void PrintPreviewDialogController::RemoveProxyDialogForWebContents( |
| + WebContents* source) { |
| + proxied_dialog_map_.erase(source); |
| +} |
| + |
| void PrintPreviewDialogController::SaveInitiatorTitle( |
| WebContents* preview_dialog) { |
| WebContents* initiator = GetInitiator(preview_dialog); |