| 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 "content/browser/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 2365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2376 | 2376 |
| 2377 bool WebContentsImpl::IsVirtualKeyboardRequested() { | 2377 bool WebContentsImpl::IsVirtualKeyboardRequested() { |
| 2378 return virtual_keyboard_requested_; | 2378 return virtual_keyboard_requested_; |
| 2379 } | 2379 } |
| 2380 | 2380 |
| 2381 bool WebContentsImpl::IsOverridingUserAgent() { | 2381 bool WebContentsImpl::IsOverridingUserAgent() { |
| 2382 return GetController().GetVisibleEntry() && | 2382 return GetController().GetVisibleEntry() && |
| 2383 GetController().GetVisibleEntry()->GetIsOverridingUserAgent(); | 2383 GetController().GetVisibleEntry()->GetIsOverridingUserAgent(); |
| 2384 } | 2384 } |
| 2385 | 2385 |
| 2386 bool WebContentsImpl::IsJavaScriptDialogShowing() const { |
| 2387 return is_showing_javascript_dialog_; |
| 2388 } |
| 2389 |
| 2386 AccessibilityMode WebContentsImpl::GetAccessibilityMode() const { | 2390 AccessibilityMode WebContentsImpl::GetAccessibilityMode() const { |
| 2387 return accessibility_mode_; | 2391 return accessibility_mode_; |
| 2388 } | 2392 } |
| 2389 | 2393 |
| 2390 void WebContentsImpl::AccessibilityEventReceived( | 2394 void WebContentsImpl::AccessibilityEventReceived( |
| 2391 const std::vector<AXEventNotificationDetails>& details) { | 2395 const std::vector<AXEventNotificationDetails>& details) { |
| 2392 FOR_EACH_OBSERVER( | 2396 FOR_EACH_OBSERVER( |
| 2393 WebContentsObserver, observers_, AccessibilityEventReceived(details)); | 2397 WebContentsObserver, observers_, AccessibilityEventReceived(details)); |
| 2394 } | 2398 } |
| 2395 | 2399 |
| (...skipping 1727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4123 IPC::Message* reply_msg) { | 4127 IPC::Message* reply_msg) { |
| 4124 // Suppress JavaScript dialogs when requested. Also suppress messages when | 4128 // Suppress JavaScript dialogs when requested. Also suppress messages when |
| 4125 // showing an interstitial as it's shown over the previous page and we don't | 4129 // showing an interstitial as it's shown over the previous page and we don't |
| 4126 // want the hidden page's dialogs to interfere with the interstitial. | 4130 // want the hidden page's dialogs to interfere with the interstitial. |
| 4127 bool suppress_this_message = | 4131 bool suppress_this_message = |
| 4128 ShowingInterstitialPage() || !delegate_ || | 4132 ShowingInterstitialPage() || !delegate_ || |
| 4129 delegate_->ShouldSuppressDialogs(this) || | 4133 delegate_->ShouldSuppressDialogs(this) || |
| 4130 !delegate_->GetJavaScriptDialogManager(this); | 4134 !delegate_->GetJavaScriptDialogManager(this); |
| 4131 | 4135 |
| 4132 if (!suppress_this_message) { | 4136 if (!suppress_this_message) { |
| 4137 is_showing_javascript_dialog_ = true; |
| 4133 dialog_manager_ = delegate_->GetJavaScriptDialogManager(this); | 4138 dialog_manager_ = delegate_->GetJavaScriptDialogManager(this); |
| 4134 dialog_manager_->RunJavaScriptDialog( | 4139 dialog_manager_->RunJavaScriptDialog( |
| 4135 this, frame_url, javascript_message_type, message, default_prompt, | 4140 this, frame_url, javascript_message_type, message, default_prompt, |
| 4136 base::Bind(&WebContentsImpl::OnDialogClosed, base::Unretained(this), | 4141 base::Bind(&WebContentsImpl::OnDialogClosed, base::Unretained(this), |
| 4137 render_frame_host->GetProcess()->GetID(), | 4142 render_frame_host->GetProcess()->GetID(), |
| 4138 render_frame_host->GetRoutingID(), reply_msg, false), | 4143 render_frame_host->GetRoutingID(), reply_msg, false), |
| 4139 &suppress_this_message); | 4144 &suppress_this_message); |
| 4140 } | 4145 } |
| 4141 | 4146 |
| 4142 if (suppress_this_message) { | 4147 if (suppress_this_message) { |
| (...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5038 // meantime. Do not reset the navigation state in that case. | 5043 // meantime. Do not reset the navigation state in that case. |
| 5039 if (rfh && rfh == rfh->frame_tree_node()->current_frame_host()) { | 5044 if (rfh && rfh == rfh->frame_tree_node()->current_frame_host()) { |
| 5040 rfh->frame_tree_node()->BeforeUnloadCanceled(); | 5045 rfh->frame_tree_node()->BeforeUnloadCanceled(); |
| 5041 controller_.DiscardNonCommittedEntries(); | 5046 controller_.DiscardNonCommittedEntries(); |
| 5042 } | 5047 } |
| 5043 | 5048 |
| 5044 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 5049 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 5045 BeforeUnloadDialogCancelled()); | 5050 BeforeUnloadDialogCancelled()); |
| 5046 } | 5051 } |
| 5047 | 5052 |
| 5053 is_showing_javascript_dialog_ = false; |
| 5048 is_showing_before_unload_dialog_ = false; | 5054 is_showing_before_unload_dialog_ = false; |
| 5049 if (rfh) { | 5055 if (rfh) { |
| 5050 rfh->JavaScriptDialogClosed(reply_msg, success, user_input, | 5056 rfh->JavaScriptDialogClosed(reply_msg, success, user_input, |
| 5051 dialog_was_suppressed); | 5057 dialog_was_suppressed); |
| 5052 } else { | 5058 } else { |
| 5053 // Don't leak the sync IPC reply if the RFH or process is gone. | 5059 // Don't leak the sync IPC reply if the RFH or process is gone. |
| 5054 delete reply_msg; | 5060 delete reply_msg; |
| 5055 } | 5061 } |
| 5056 } | 5062 } |
| 5057 | 5063 |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5254 dialog_manager_ = dialog_manager; | 5260 dialog_manager_ = dialog_manager; |
| 5255 } | 5261 } |
| 5256 | 5262 |
| 5257 void WebContentsImpl::RemoveBindingSet(const std::string& interface_name) { | 5263 void WebContentsImpl::RemoveBindingSet(const std::string& interface_name) { |
| 5258 auto it = binding_sets_.find(interface_name); | 5264 auto it = binding_sets_.find(interface_name); |
| 5259 if (it != binding_sets_.end()) | 5265 if (it != binding_sets_.end()) |
| 5260 binding_sets_.erase(it); | 5266 binding_sets_.erase(it); |
| 5261 } | 5267 } |
| 5262 | 5268 |
| 5263 } // namespace content | 5269 } // namespace content |
| OLD | NEW |