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

Unified Diff: chrome/browser/guest_view/web_view/web_view_guest.cc

Issue 378873002: Move permission check from GuestViewInternal to derived GuestView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@app_view_meat
Patch Set: Diff against tip of tree Created 6 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
« no previous file with comments | « chrome/browser/guest_view/web_view/web_view_guest.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/guest_view/web_view/web_view_guest.cc
diff --git a/chrome/browser/guest_view/web_view/web_view_guest.cc b/chrome/browser/guest_view/web_view/web_view_guest.cc
index 251ea12c7ef876b1f0b337a69dc804dfd9d90868..e6852d29fce3b0aa4b24fd72942b20ca89263643 100644
--- a/chrome/browser/guest_view/web_view/web_view_guest.cc
+++ b/chrome/browser/guest_view/web_view/web_view_guest.cc
@@ -11,6 +11,7 @@
#include "chrome/browser/extensions/api/web_request/web_request_api.h"
#include "chrome/browser/extensions/api/web_view/web_view_internal_api.h"
#include "chrome/browser/extensions/chrome_extension_web_contents_observer.h"
+#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/menu_manager.h"
#include "chrome/browser/extensions/script_executor.h"
#include "chrome/browser/favicon/favicon_tab_helper.h"
@@ -48,7 +49,9 @@
#include "content/public/common/result_codes.h"
#include "content/public/common/stop_find_action.h"
#include "content/public/common/url_constants.h"
+#include "extensions/browser/extension_system.h"
#include "extensions/common/constants.h"
+#include "extensions/common/permissions/permissions_data.h"
#include "ipc/ipc_message_macros.h"
#include "net/base/escape.h"
#include "net/base/net_errors.h"
@@ -228,6 +231,19 @@ scoped_ptr<base::ListValue> WebViewGuest::MenuModelToValue(
return items.Pass();
}
+bool WebViewGuest::CanEmbedderUseGuestView(
+ const std::string& embedder_extension_id) {
+ Profile* profile = Profile::FromBrowserContext(browser_context());
+ ExtensionService* service =
+ extensions::ExtensionSystem::Get(profile)->extension_service();
+ const extensions::Extension* embedder_extension =
+ service->GetExtensionById(embedder_extension_id, false);
+ const extensions::PermissionsData* permissions_data =
+ embedder_extension->permissions_data();
+ return permissions_data->HasAPIPermission(
+ extensions::APIPermission::kWebView);
+}
+
void WebViewGuest::CreateWebContents(
const std::string& embedder_extension_id,
int embedder_render_process_id,
@@ -249,6 +265,7 @@ void WebViewGuest::CreateWebContents(
base::KillProcess(
embedder_render_process_host->GetHandle(),
content::RESULT_CODE_KILLED_BAD_MESSAGE, false);
+ callback.Run(NULL);
return;
}
std::string url_encoded_partition = net::EscapeQueryParamValue(
« no previous file with comments | « chrome/browser/guest_view/web_view/web_view_guest.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698