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

Unified Diff: chrome/browser/extensions/api/webview/webview_api.cc

Issue 21297005: <webview>: Refactor Permission API to chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cleanup_permissions
Patch Set: Fixed some bugs Created 7 years, 4 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: 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;
}

Powered by Google App Engine
This is Rietveld 408576698