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

Side by Side Diff: chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.cc

Issue 2867613002: Fix HandleJavaScriptDialog. (Closed)
Patch Set: Created 3 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/javascript_dialogs/javascript_dialog_tab_helper.h" 5 #include "chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/feature_list.h" 9 #include "base/feature_list.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 return AppModalDialogManager()->RunBeforeUnloadDialog( 243 return AppModalDialogManager()->RunBeforeUnloadDialog(
244 web_contents, is_reload, 244 web_contents, is_reload,
245 base::Bind(&SaveUnloadUmaStats, engagement_score, callback)); 245 base::Bind(&SaveUnloadUmaStats, engagement_score, callback));
246 } 246 }
247 247
248 bool JavaScriptDialogTabHelper::HandleJavaScriptDialog( 248 bool JavaScriptDialogTabHelper::HandleJavaScriptDialog(
249 content::WebContents* web_contents, 249 content::WebContents* web_contents,
250 bool accept, 250 bool accept,
251 const base::string16* prompt_override) { 251 const base::string16* prompt_override) {
252 if (dialog_) { 252 if (dialog_) {
253 CloseDialog(accept, prompt_override ? *prompt_override : base::string16(), 253 CloseDialog(accept,
254 prompt_override ? *prompt_override : dialog_->GetUserInput(),
254 DismissalCause::HANDLE_DIALOG_CALLED); 255 DismissalCause::HANDLE_DIALOG_CALLED);
255 return true; 256 return true;
256 } 257 }
257 258
258 // Handle any app-modal dialogs being run by the app-modal dialog system. 259 // Handle any app-modal dialogs being run by the app-modal dialog system.
259 return AppModalDialogManager()->HandleJavaScriptDialog(web_contents, accept, 260 return AppModalDialogManager()->HandleJavaScriptDialog(web_contents, accept,
260 prompt_override); 261 prompt_override);
261 } 262 }
262 263
263 void JavaScriptDialogTabHelper::CancelDialogs( 264 void JavaScriptDialogTabHelper::CancelDialogs(
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 dialog_callback_.Run(success, user_input); 349 dialog_callback_.Run(success, user_input);
349 350
350 ClearDialogInfo(); 351 ClearDialogInfo();
351 } 352 }
352 353
353 void JavaScriptDialogTabHelper::ClearDialogInfo() { 354 void JavaScriptDialogTabHelper::ClearDialogInfo() {
354 dialog_.reset(); 355 dialog_.reset();
355 dialog_callback_.Reset(); 356 dialog_callback_.Reset();
356 BrowserList::RemoveObserver(this); 357 BrowserList::RemoveObserver(this);
357 } 358 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698