Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(643)

Unified Diff: content/renderer/browser_plugin/browser_plugin.cc

Issue 19679002: <webview>: Implement dialog API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added more tests and fixed a bug Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/browser_plugin/browser_plugin.cc
diff --git a/content/renderer/browser_plugin/browser_plugin.cc b/content/renderer/browser_plugin/browser_plugin.cc
index 5a961ba2c5cea3f7f1c6b10021f32b52634e3ee7..7bf0d58540090d9f231fdcfd902c4b0107ff3648 100644
--- a/content/renderer/browser_plugin/browser_plugin.cc
+++ b/content/renderer/browser_plugin/browser_plugin.cc
@@ -509,11 +509,14 @@ void BrowserPlugin::OnRequestPermission(
// The New Window API is very similiar to the permission API in structure,
// but exposes a slightly different interface to the developer and so we put
// it in a separate event.
- const char* event_name =
- (permission_type == BrowserPluginPermissionTypeNewWindow) ?
- browser_plugin::kEventNewWindow :
- browser_plugin::kEventRequestPermission;
-
+ const char* event_name = NULL;
+ if (permission_type == BrowserPluginPermissionTypeNewWindow) {
+ event_name = browser_plugin::kEventNewWindow;
+ } else if (permission_type == BrowserPluginPermissionTypeJavaScriptDialog) {
+ event_name = browser_plugin::kEventDialog;
+ } else {
+ event_name = browser_plugin::kEventRequestPermission;
+ }
AddPermissionRequestToMap(request_id, permission_type);
std::map<std::string, base::Value*> props;
@@ -971,14 +974,17 @@ WebKit::WebPluginContainer* BrowserPlugin::container() const {
}
void BrowserPlugin::RespondPermission(
- BrowserPluginPermissionType permission_type, int request_id, bool allow) {
+ BrowserPluginPermissionType permission_type,
+ int request_id,
+ bool allow,
+ const std::string& user_input) {
if (permission_type == BrowserPluginPermissionTypePointerLock)
RespondPermissionPointerLock(allow);
else
browser_plugin_manager()->Send(
new BrowserPluginHostMsg_RespondPermission(
- render_view_routing_id_, guest_instance_id_, permission_type,
- request_id, allow));
+ render_view_routing_id_, guest_instance_id_,
+ request_id, allow, user_input));
}
void BrowserPlugin::RespondPermissionPointerLock(bool allow) {
@@ -989,7 +995,7 @@ void BrowserPlugin::RespondPermissionPointerLock(bool allow) {
}
void BrowserPlugin::RespondPermissionIfRequestIsPending(
- int request_id, bool allow) {
+ int request_id, bool allow, const std::string& user_input) {
PendingPermissionRequests::iterator iter =
pending_permission_requests_.find(request_id);
if (iter == pending_permission_requests_.end())
@@ -997,11 +1003,13 @@ void BrowserPlugin::RespondPermissionIfRequestIsPending(
BrowserPluginPermissionType permission_type = iter->second;
pending_permission_requests_.erase(iter);
- RespondPermission(permission_type, request_id, allow);
+ RespondPermission(permission_type, request_id, allow, user_input);
}
-void BrowserPlugin::OnEmbedderDecidedPermission(int request_id, bool allow) {
- RespondPermissionIfRequestIsPending(request_id, allow);
+void BrowserPlugin::OnEmbedderDecidedPermission(int request_id,
+ bool allow,
+ const std::string& user_input) {
+ RespondPermissionIfRequestIsPending(request_id, allow, user_input);
}
bool BrowserPlugin::initialize(WebPluginContainer* container) {

Powered by Google App Engine
This is Rietveld 408576698