forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathaw_javascript_dialog_manager.cc
55 lines (44 loc) · 1.74 KB
/
aw_javascript_dialog_manager.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "android_webview/browser/aw_javascript_dialog_manager.h"
#include "android_webview/browser/aw_contents_client_bridge.h"
#include "content/public/browser/javascript_dialog_manager.h"
#include "content/public/browser/web_contents.h"
namespace android_webview {
AwJavaScriptDialogManager::AwJavaScriptDialogManager() {}
AwJavaScriptDialogManager::~AwJavaScriptDialogManager() {}
void AwJavaScriptDialogManager::RunJavaScriptDialog(
content::WebContents* web_contents,
const GURL& origin_url,
content::JavaScriptDialogType dialog_type,
const base::string16& message_text,
const base::string16& default_prompt_text,
const DialogClosedCallback& callback,
bool* did_suppress_message) {
AwContentsClientBridge* bridge =
AwContentsClientBridge::FromWebContents(web_contents);
if (!bridge) {
callback.Run(false, base::string16());
return;
}
bridge->RunJavaScriptDialog(dialog_type, origin_url, message_text,
default_prompt_text, callback);
}
void AwJavaScriptDialogManager::RunBeforeUnloadDialog(
content::WebContents* web_contents,
bool is_reload,
const DialogClosedCallback& callback) {
AwContentsClientBridge* bridge =
AwContentsClientBridge::FromWebContents(web_contents);
if (!bridge) {
callback.Run(false, base::string16());
return;
}
bridge->RunBeforeUnloadDialog(web_contents->GetURL(),
callback);
}
void AwJavaScriptDialogManager::CancelDialogs(
content::WebContents* web_contents,
bool reset_state) {}
} // namespace android_webview