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

Unified Diff: chrome/browser/printing/print_preview_dialog_controller.cc

Issue 1294663003: Fix various issues from r343263. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
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 3ec3df13e803bf8fa2fb4025faf98b15b7371cff..1303dc8ba7574346a2951f2083d33d22b4274035 100644
--- a/chrome/browser/printing/print_preview_dialog_controller.cc
+++ b/chrome/browser/printing/print_preview_dialog_controller.cc
@@ -183,9 +183,9 @@ 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 =
+ // If this WebContents relies on another for its preview dialog, look for the
+ // original initiator.
+ DistilledContentsMap::const_iterator proxied =
proxied_dialog_map_.find(contents);
if (proxied != proxied_dialog_map_.end()) {
contents = proxied->second;
@@ -387,14 +387,16 @@ WebContents* PrintPreviewDialogController::CreatePrintPreviewDialog(
}
void PrintPreviewDialogController::AddProxyDialogForWebContents(
- WebContents* source,
- WebContents* target) {
- proxied_dialog_map_[source] = target;
+ WebContents* distilled_contents,
+ WebContents* initiator) {
+ DCHECK(!ContainsKey(proxied_dialog_map_, distilled_contents));
+ proxied_dialog_map_[distilled_contents] = initiator;
}
void PrintPreviewDialogController::RemoveProxyDialogForWebContents(
- WebContents* source) {
- proxied_dialog_map_.erase(source);
+ WebContents* distilled_contents) {
+ size_t erased = proxied_dialog_map_.erase(distilled_contents);
+ DCHECK_EQ(1U, erased);
}
void PrintPreviewDialogController::SaveInitiatorTitle(

Powered by Google App Engine
This is Rietveld 408576698