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

Side by Side Diff: chrome/browser/printing/print_preview_dialog_controller.cc

Issue 1153813003: Add user_gesture param to WebContentsDelegate::ActivateContents Base URL: https://chromium.googlesource.com/chromium/src.git@ug1_WebContentsImpl_Activate
Patch Set: Update callers Created 5 years, 7 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
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/printing/print_preview_dialog_controller.h" 5 #include "chrome/browser/printing/print_preview_dialog_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 WebContents* PrintPreviewDialogController::GetOrCreatePreviewDialog( 171 WebContents* PrintPreviewDialogController::GetOrCreatePreviewDialog(
172 WebContents* initiator) { 172 WebContents* initiator) {
173 DCHECK(initiator); 173 DCHECK(initiator);
174 174
175 // Get the print preview dialog for |initiator|. 175 // Get the print preview dialog for |initiator|.
176 WebContents* preview_dialog = GetPrintPreviewForContents(initiator); 176 WebContents* preview_dialog = GetPrintPreviewForContents(initiator);
177 if (!preview_dialog) 177 if (!preview_dialog)
178 return CreatePrintPreviewDialog(initiator); 178 return CreatePrintPreviewDialog(initiator);
179 179
180 // Show the initiator holding the existing preview dialog. 180 // Show the initiator holding the existing preview dialog.
181 initiator->GetDelegate()->ActivateContents(initiator); 181 // TODO(johnme): Can we sometimes be certain this was for a user gesture?
182 initiator->GetDelegate()->ActivateContents(initiator,
183 false /* user_gesture */);
182 return preview_dialog; 184 return preview_dialog;
183 } 185 }
184 186
185 WebContents* PrintPreviewDialogController::GetPrintPreviewForContents( 187 WebContents* PrintPreviewDialogController::GetPrintPreviewForContents(
186 WebContents* contents) const { 188 WebContents* contents) const {
187 // |preview_dialog_map_| is keyed by the preview dialog, so if find() 189 // |preview_dialog_map_| is keyed by the preview dialog, so if find()
188 // succeeds, then |contents| is the preview dialog. 190 // succeeds, then |contents| is the preview dialog.
189 PrintPreviewDialogMap::const_iterator it = preview_dialog_map_.find(contents); 191 PrintPreviewDialogMap::const_iterator it = preview_dialog_map_.find(contents);
190 if (it != preview_dialog_map_.end()) 192 if (it != preview_dialog_map_.end())
191 return contents; 193 return contents;
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 static_cast<PrintPreviewUI*>(web_ui->GetController()); 460 static_cast<PrintPreviewUI*>(web_ui->GetController());
459 if (print_preview_ui) 461 if (print_preview_ui)
460 print_preview_ui->OnPrintPreviewDialogDestroyed(); 462 print_preview_ui->OnPrintPreviewDialogDestroyed();
461 } 463 }
462 464
463 preview_dialog_map_.erase(preview_dialog); 465 preview_dialog_map_.erase(preview_dialog);
464 RemoveObservers(preview_dialog); 466 RemoveObservers(preview_dialog);
465 } 467 }
466 468
467 } // namespace printing 469 } // namespace printing
OLDNEW
« no previous file with comments | « chrome/browser/printing/background_printing_manager.cc ('k') | chrome/browser/task_manager/task_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698