OLD | NEW |
---|---|
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/ui/app_modal_dialogs/javascript_app_modal_dialog.h" | 5 #include "chrome/browser/ui/app_modal_dialogs/javascript_app_modal_dialog.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/browser/browser_shutdown.h" | 8 #include "chrome/browser/browser_shutdown.h" |
9 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" | 9 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" |
10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
96 #endif // defined(USE_AURA) | 96 #endif // defined(USE_AURA) |
97 | 97 |
98 return NativeAppModalDialog::CreateNativeJavaScriptPrompt(this, | 98 return NativeAppModalDialog::CreateNativeJavaScriptPrompt(this, |
99 parent_window); | 99 parent_window); |
100 } | 100 } |
101 | 101 |
102 bool JavaScriptAppModalDialog::IsJavaScriptModalDialog() { | 102 bool JavaScriptAppModalDialog::IsJavaScriptModalDialog() { |
103 return true; | 103 return true; |
104 } | 104 } |
105 | 105 |
106 void JavaScriptAppModalDialog::Invalidate() { | 106 void JavaScriptAppModalDialog::Invalidate() { |
Avi (use Gerrit)
2013/09/25 04:28:40
It seems like at the end of JavaScriptAppModalDial
Charlie Reis
2013/09/25 16:48:34
Not quite. NotifyDelegate calls AppModalDialog::I
| |
107 if (!IsValid()) | 107 if (!IsValid()) |
108 return; | 108 return; |
109 | 109 |
110 AppModalDialog::Invalidate(); | 110 AppModalDialog::Invalidate(); |
111 callback_.Reset(); | 111 callback_.Run(false, string16()); |
112 if (native_dialog()) | 112 if (native_dialog()) |
113 CloseModalDialog(); | 113 CloseModalDialog(); |
114 } | 114 } |
115 | 115 |
116 void JavaScriptAppModalDialog::OnCancel(bool suppress_js_messages) { | 116 void JavaScriptAppModalDialog::OnCancel(bool suppress_js_messages) { |
117 // If we are shutting down and this is an onbeforeunload dialog, cancel the | 117 // If we are shutting down and this is an onbeforeunload dialog, cancel the |
118 // shutdown. | 118 // shutdown. |
119 // TODO(sammc): Remove this when kEnableBatchedShutdown becomes mandatory. | 119 // TODO(sammc): Remove this when kEnableBatchedShutdown becomes mandatory. |
120 if (is_before_unload_dialog_ && | 120 if (is_before_unload_dialog_ && |
121 !CommandLine::ForCurrentProcess()->HasSwitch( | 121 !CommandLine::ForCurrentProcess()->HasSwitch( |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
170 if (extra_data != extra_data_map_->end()) { | 170 if (extra_data != extra_data_map_->end()) { |
171 extra_data->second.last_javascript_message_dismissal_ = | 171 extra_data->second.last_javascript_message_dismissal_ = |
172 base::TimeTicks::Now(); | 172 base::TimeTicks::Now(); |
173 extra_data->second.suppress_javascript_messages_ = suppress_js_messages; | 173 extra_data->second.suppress_javascript_messages_ = suppress_js_messages; |
174 } | 174 } |
175 | 175 |
176 // On Views, we can end up coming through this code path twice :(. | 176 // On Views, we can end up coming through this code path twice :(. |
177 // See crbug.com/63732. | 177 // See crbug.com/63732. |
178 AppModalDialog::Invalidate(); | 178 AppModalDialog::Invalidate(); |
179 } | 179 } |
OLD | NEW |