| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/shell/browser/shell_javascript_dialog_manager.h" | 5 #include "content/shell/browser/shell_javascript_dialog_manager.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 base::string16(), // default | 98 base::string16(), // default |
| 99 callback)); | 99 callback)); |
| 100 #else | 100 #else |
| 101 // TODO: implement ShellJavaScriptDialog for other platforms, drop this #if | 101 // TODO: implement ShellJavaScriptDialog for other platforms, drop this #if |
| 102 callback.Run(true, base::string16()); | 102 callback.Run(true, base::string16()); |
| 103 return; | 103 return; |
| 104 #endif | 104 #endif |
| 105 } | 105 } |
| 106 | 106 |
| 107 void ShellJavaScriptDialogManager::CancelDialogs(WebContents* web_contents, | 107 void ShellJavaScriptDialogManager::CancelDialogs(WebContents* web_contents, |
| 108 bool suppress_callbacks, | |
| 109 bool reset_state) { | 108 bool reset_state) { |
| 110 #if defined(OS_MACOSX) || defined(OS_WIN) | 109 #if defined(OS_MACOSX) || defined(OS_WIN) |
| 111 if (dialog_) { | 110 if (dialog_) { |
| 112 dialog_->Cancel(); | 111 dialog_->Cancel(); |
| 113 dialog_.reset(); | 112 dialog_.reset(); |
| 114 } | 113 } |
| 115 #else | 114 #else |
| 116 // TODO: implement ShellJavaScriptDialog for other platforms, drop this #if | 115 // TODO: implement ShellJavaScriptDialog for other platforms, drop this #if |
| 117 #endif | 116 #endif |
| 118 | 117 |
| 119 if (before_unload_callback_.is_null()) | 118 if (before_unload_callback_.is_null()) |
| 120 return; | 119 return; |
| 121 | 120 |
| 122 if (reset_state) { | 121 if (reset_state) { |
| 123 before_unload_callback_.Run(false, base::string16()); | 122 before_unload_callback_.Run(false, base::string16()); |
| 124 before_unload_callback_.Reset(); | 123 before_unload_callback_.Reset(); |
| 125 } | 124 } |
| 126 } | 125 } |
| 127 | 126 |
| 128 void ShellJavaScriptDialogManager::DialogClosed(ShellJavaScriptDialog* dialog) { | 127 void ShellJavaScriptDialogManager::DialogClosed(ShellJavaScriptDialog* dialog) { |
| 129 #if defined(OS_MACOSX) || defined(OS_WIN) | 128 #if defined(OS_MACOSX) || defined(OS_WIN) |
| 130 DCHECK_EQ(dialog, dialog_.get()); | 129 DCHECK_EQ(dialog, dialog_.get()); |
| 131 dialog_.reset(); | 130 dialog_.reset(); |
| 132 #else | 131 #else |
| 133 // TODO: implement ShellJavaScriptDialog for other platforms, drop this #if | 132 // TODO: implement ShellJavaScriptDialog for other platforms, drop this #if |
| 134 #endif | 133 #endif |
| 135 } | 134 } |
| 136 | 135 |
| 137 } // namespace content | 136 } // namespace content |
| OLD | NEW |