| 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 4141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4152 const ContextMenuParams& params) { | 4152 const ContextMenuParams& params) { |
| 4153 ContextMenuParams context_menu_params(params); | 4153 ContextMenuParams context_menu_params(params); |
| 4154 // Allow WebContentsDelegates to handle the context menu operation first. | 4154 // Allow WebContentsDelegates to handle the context menu operation first. |
| 4155 if (delegate_ && delegate_->HandleContextMenu(context_menu_params)) | 4155 if (delegate_ && delegate_->HandleContextMenu(context_menu_params)) |
| 4156 return; | 4156 return; |
| 4157 | 4157 |
| 4158 render_view_host_delegate_view_->ShowContextMenu(render_frame_host, | 4158 render_view_host_delegate_view_->ShowContextMenu(render_frame_host, |
| 4159 context_menu_params); | 4159 context_menu_params); |
| 4160 } | 4160 } |
| 4161 | 4161 |
| 4162 void WebContentsImpl::RunJavaScriptMessage( | 4162 void WebContentsImpl::RunJavaScriptDialog(RenderFrameHost* render_frame_host, |
| 4163 RenderFrameHost* render_frame_host, | 4163 const base::string16& message, |
| 4164 const base::string16& message, | 4164 const base::string16& default_prompt, |
| 4165 const base::string16& default_prompt, | 4165 const GURL& frame_url, |
| 4166 const GURL& frame_url, | 4166 JavaScriptDialogType dialog_type, |
| 4167 JavaScriptMessageType javascript_message_type, | 4167 IPC::Message* reply_msg) { |
| 4168 IPC::Message* reply_msg) { | |
| 4169 // Suppress JavaScript dialogs when requested. Also suppress messages when | 4168 // Suppress JavaScript dialogs when requested. Also suppress messages when |
| 4170 // showing an interstitial as it's shown over the previous page and we don't | 4169 // showing an interstitial as it's shown over the previous page and we don't |
| 4171 // want the hidden page's dialogs to interfere with the interstitial. | 4170 // want the hidden page's dialogs to interfere with the interstitial. |
| 4172 bool suppress_this_message = | 4171 bool suppress_this_message = |
| 4173 ShowingInterstitialPage() || !delegate_ || | 4172 ShowingInterstitialPage() || !delegate_ || |
| 4174 delegate_->ShouldSuppressDialogs(this) || | 4173 delegate_->ShouldSuppressDialogs(this) || |
| 4175 !delegate_->GetJavaScriptDialogManager(this); | 4174 !delegate_->GetJavaScriptDialogManager(this); |
| 4176 | 4175 |
| 4177 if (!suppress_this_message) { | 4176 if (!suppress_this_message) { |
| 4178 is_showing_javascript_dialog_ = true; | 4177 is_showing_javascript_dialog_ = true; |
| 4179 dialog_manager_ = delegate_->GetJavaScriptDialogManager(this); | 4178 dialog_manager_ = delegate_->GetJavaScriptDialogManager(this); |
| 4180 dialog_manager_->RunJavaScriptDialog( | 4179 dialog_manager_->RunJavaScriptDialog( |
| 4181 this, frame_url, javascript_message_type, message, default_prompt, | 4180 this, frame_url, dialog_type, message, default_prompt, |
| 4182 base::Bind(&WebContentsImpl::OnDialogClosed, base::Unretained(this), | 4181 base::Bind(&WebContentsImpl::OnDialogClosed, base::Unretained(this), |
| 4183 render_frame_host->GetProcess()->GetID(), | 4182 render_frame_host->GetProcess()->GetID(), |
| 4184 render_frame_host->GetRoutingID(), reply_msg, false), | 4183 render_frame_host->GetRoutingID(), reply_msg, false), |
| 4185 &suppress_this_message); | 4184 &suppress_this_message); |
| 4186 } | 4185 } |
| 4187 | 4186 |
| 4188 if (suppress_this_message) { | 4187 if (suppress_this_message) { |
| 4189 // If we are suppressing messages, just reply as if the user immediately | 4188 // If we are suppressing messages, just reply as if the user immediately |
| 4190 // pressed "Cancel", passing true to |dialog_was_suppressed|. | 4189 // pressed "Cancel", passing true to |dialog_was_suppressed|. |
| 4191 OnDialogClosed(render_frame_host->GetProcess()->GetID(), | 4190 OnDialogClosed(render_frame_host->GetProcess()->GetID(), |
| (...skipping 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5407 GetMainFrame()->AddMessageToConsole( | 5406 GetMainFrame()->AddMessageToConsole( |
| 5408 content::CONSOLE_MESSAGE_LEVEL_WARNING, | 5407 content::CONSOLE_MESSAGE_LEVEL_WARNING, |
| 5409 base::StringPrintf("This site does not have a valid SSL " | 5408 base::StringPrintf("This site does not have a valid SSL " |
| 5410 "certificate! Without SSL, your site's and " | 5409 "certificate! Without SSL, your site's and " |
| 5411 "visitors' data is vulnerable to theft and " | 5410 "visitors' data is vulnerable to theft and " |
| 5412 "tampering. Get a valid SSL certificate before" | 5411 "tampering. Get a valid SSL certificate before" |
| 5413 " releasing your website to the public.")); | 5412 " releasing your website to the public.")); |
| 5414 } | 5413 } |
| 5415 | 5414 |
| 5416 } // namespace content | 5415 } // namespace content |
| OLD | NEW |