| 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 "android_webview/browser/aw_javascript_dialog_manager.h" | 5 #include "android_webview/browser/aw_javascript_dialog_manager.h" |
| 6 | 6 |
| 7 #include "android_webview/browser/aw_contents_client_bridge_base.h" | 7 #include "android_webview/browser/aw_contents_client_bridge_base.h" |
| 8 #include "content/public/browser/javascript_dialog_manager.h" | 8 #include "content/public/browser/javascript_dialog_manager.h" |
| 9 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
| 10 | 10 |
| 11 namespace android_webview { | 11 namespace android_webview { |
| 12 | 12 |
| 13 AwJavaScriptDialogManager::AwJavaScriptDialogManager() {} | 13 AwJavaScriptDialogManager::AwJavaScriptDialogManager() {} |
| 14 | 14 |
| 15 AwJavaScriptDialogManager::~AwJavaScriptDialogManager() {} | 15 AwJavaScriptDialogManager::~AwJavaScriptDialogManager() {} |
| 16 | 16 |
| 17 void AwJavaScriptDialogManager::RunJavaScriptDialog( | 17 void AwJavaScriptDialogManager::RunJavaScriptDialog( |
| 18 content::WebContents* web_contents, | 18 content::WebContents* web_contents, |
| 19 const GURL& origin_url, | 19 const GURL& origin_url, |
| 20 content::JavaScriptMessageType message_type, | 20 content::JavaScriptDialogType dialog_type, |
| 21 const base::string16& message_text, | 21 const base::string16& message_text, |
| 22 const base::string16& default_prompt_text, | 22 const base::string16& default_prompt_text, |
| 23 const DialogClosedCallback& callback, | 23 const DialogClosedCallback& callback, |
| 24 bool* did_suppress_message) { | 24 bool* did_suppress_message) { |
| 25 AwContentsClientBridgeBase* bridge = | 25 AwContentsClientBridgeBase* bridge = |
| 26 AwContentsClientBridgeBase::FromWebContents(web_contents); | 26 AwContentsClientBridgeBase::FromWebContents(web_contents); |
| 27 if (!bridge) { | 27 if (!bridge) { |
| 28 callback.Run(false, base::string16()); | 28 callback.Run(false, base::string16()); |
| 29 return; | 29 return; |
| 30 } | 30 } |
| 31 | 31 |
| 32 bridge->RunJavaScriptDialog(message_type, | 32 bridge->RunJavaScriptDialog(dialog_type, origin_url, message_text, |
| 33 origin_url, | 33 default_prompt_text, callback); |
| 34 message_text, | |
| 35 default_prompt_text, | |
| 36 callback); | |
| 37 } | 34 } |
| 38 | 35 |
| 39 void AwJavaScriptDialogManager::RunBeforeUnloadDialog( | 36 void AwJavaScriptDialogManager::RunBeforeUnloadDialog( |
| 40 content::WebContents* web_contents, | 37 content::WebContents* web_contents, |
| 41 bool is_reload, | 38 bool is_reload, |
| 42 const DialogClosedCallback& callback) { | 39 const DialogClosedCallback& callback) { |
| 43 AwContentsClientBridgeBase* bridge = | 40 AwContentsClientBridgeBase* bridge = |
| 44 AwContentsClientBridgeBase::FromWebContents(web_contents); | 41 AwContentsClientBridgeBase::FromWebContents(web_contents); |
| 45 if (!bridge) { | 42 if (!bridge) { |
| 46 callback.Run(false, base::string16()); | 43 callback.Run(false, base::string16()); |
| 47 return; | 44 return; |
| 48 } | 45 } |
| 49 | 46 |
| 50 bridge->RunBeforeUnloadDialog(web_contents->GetURL(), | 47 bridge->RunBeforeUnloadDialog(web_contents->GetURL(), |
| 51 callback); | 48 callback); |
| 52 } | 49 } |
| 53 | 50 |
| 54 void AwJavaScriptDialogManager::CancelDialogs( | 51 void AwJavaScriptDialogManager::CancelDialogs( |
| 55 content::WebContents* web_contents, | 52 content::WebContents* web_contents, |
| 56 bool reset_state) {} | 53 bool reset_state) {} |
| 57 | 54 |
| 58 } // namespace android_webview | 55 } // namespace android_webview |
| OLD | NEW |