| OLD | NEW |
| 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/feature_list.h" | 8 #include "base/feature_list.h" |
| 9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "chrome/browser/engagement/site_engagement_service.h" | 10 #include "chrome/browser/engagement/site_engagement_service.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 if (IsEnabled()) { | 76 if (IsEnabled()) { |
| 77 content::WebContents* parent_web_contents = | 77 content::WebContents* parent_web_contents = |
| 78 WebContentsObserver::web_contents(); | 78 WebContentsObserver::web_contents(); |
| 79 | 79 |
| 80 if (!IsWebContentsForemost(parent_web_contents) && | 80 if (!IsWebContentsForemost(parent_web_contents) && |
| 81 message_type == content::JAVASCRIPT_MESSAGE_TYPE_PROMPT) { | 81 message_type == content::JAVASCRIPT_MESSAGE_TYPE_PROMPT) { |
| 82 // Don't allow "prompt" dialogs to steal the user's focus. TODO(avi): | 82 // Don't allow "prompt" dialogs to steal the user's focus. TODO(avi): |
| 83 // Eventually, for subsequent phases of http://bit.ly/project-oldspice, | 83 // Eventually, for subsequent phases of http://bit.ly/project-oldspice, |
| 84 // turn off focus stealing for other dialog types. | 84 // turn off focus stealing for other dialog types. |
| 85 *did_suppress_message = true; | 85 *did_suppress_message = true; |
| 86 callback.Run(false, base::string16()); | |
| 87 return; | 86 return; |
| 88 } | 87 } |
| 89 | 88 |
| 90 if (dialog_) { | 89 if (dialog_) { |
| 91 // There's already a dialog up; clear it out. | 90 // There's already a dialog up; clear it out. |
| 92 CloseDialog(false, false, base::string16()); | 91 CloseDialog(false, false, base::string16()); |
| 93 } | 92 } |
| 94 | 93 |
| 95 parent_web_contents->GetDelegate()->ActivateContents(parent_web_contents); | 94 parent_web_contents->GetDelegate()->ActivateContents(parent_web_contents); |
| 96 | 95 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 DCHECK(dialog_); | 201 DCHECK(dialog_); |
| 203 | 202 |
| 204 dialog_->CloseDialogWithoutCallback(); | 203 dialog_->CloseDialogWithoutCallback(); |
| 205 if (!suppress_callback) | 204 if (!suppress_callback) |
| 206 dialog_callback_.Run(success, user_input); | 205 dialog_callback_.Run(success, user_input); |
| 207 | 206 |
| 208 dialog_.reset(); | 207 dialog_.reset(); |
| 209 dialog_callback_.Reset(); | 208 dialog_callback_.Reset(); |
| 210 BrowserList::RemoveObserver(this); | 209 BrowserList::RemoveObserver(this); |
| 211 } | 210 } |
| OLD | NEW |