Index: chrome/browser/extensions/api/webview/webview_api.cc |
diff --git a/chrome/browser/extensions/api/webview/webview_api.cc b/chrome/browser/extensions/api/webview/webview_api.cc |
index bfc7c6fbd5bef35af26355e20c8dd06cd117fd89..b26b746ac9c75f4127cf090290e7e964a5320e2a 100644 |
--- a/chrome/browser/extensions/api/webview/webview_api.cc |
+++ b/chrome/browser/extensions/api/webview/webview_api.cc |
@@ -108,13 +108,13 @@ bool WebviewGoFunction::RunImpl() { |
return true; |
} |
-WebviewStopFunction::WebviewStopFunction() { |
+WebviewReloadFunction::WebviewReloadFunction() { |
} |
-WebviewStopFunction::~WebviewStopFunction() { |
+WebviewReloadFunction::~WebviewReloadFunction() { |
} |
-bool WebviewStopFunction::RunImpl() { |
+bool WebviewReloadFunction::RunImpl() { |
int instance_id = 0; |
EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &instance_id)); |
@@ -123,26 +123,55 @@ bool WebviewStopFunction::RunImpl() { |
if (!guest) |
return false; |
- guest->Stop(); |
+ guest->Reload(); |
return true; |
} |
-WebviewReloadFunction::WebviewReloadFunction() { |
+WebviewSetPermissionFunction::WebviewSetPermissionFunction() { |
} |
-WebviewReloadFunction::~WebviewReloadFunction() { |
+WebviewSetPermissionFunction::~WebviewSetPermissionFunction() { |
} |
-bool WebviewReloadFunction::RunImpl() { |
+bool WebviewSetPermissionFunction::RunImpl() { |
int instance_id = 0; |
EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &instance_id)); |
+ int request_id = 0; |
+ EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(1, &request_id)); |
+ |
+ bool should_allow = false; |
+ EXTENSION_FUNCTION_VALIDATE(args_->GetBoolean(2, &should_allow)); |
+ |
+ std::string user_input; |
+ EXTENSION_FUNCTION_VALIDATE(args_->GetString(3, &user_input)); |
+ |
WebViewGuest* guest = WebViewGuest::From( |
render_view_host()->GetProcess()->GetID(), instance_id); |
if (!guest) |
return false; |
- guest->Reload(); |
+ EXTENSION_FUNCTION_VALIDATE( |
+ guest->SetPermission(request_id, should_allow, user_input)); |
+ return true; |
+} |
+ |
+WebviewStopFunction::WebviewStopFunction() { |
+} |
+ |
+WebviewStopFunction::~WebviewStopFunction() { |
+} |
+ |
+bool WebviewStopFunction::RunImpl() { |
+ int instance_id = 0; |
+ EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &instance_id)); |
+ |
+ WebViewGuest* guest = WebViewGuest::From( |
+ render_view_host()->GetProcess()->GetID(), instance_id); |
+ if (!guest) |
+ return false; |
+ |
+ guest->Stop(); |
return true; |
} |