Index: content/browser/permissions/permission_service_impl.cc |
diff --git a/content/browser/permissions/permission_service_impl.cc b/content/browser/permissions/permission_service_impl.cc |
index a5f66bf2f54790a6b89d835636d2cffe7a5eb759..1b1b3d4af3cb49aba7a518ef4b4d5d46e5b2fc31 100644 |
--- a/content/browser/permissions/permission_service_impl.cc |
+++ b/content/browser/permissions/permission_service_impl.cc |
@@ -7,6 +7,7 @@ |
#include "content/browser/geolocation/geolocation_provider_impl.h" |
#include "content/public/browser/content_browser_client.h" |
#include "content/public/browser/render_process_host.h" |
+#include "content/public/browser/web_contents.h" |
namespace content { |
@@ -114,7 +115,27 @@ void PermissionServiceImpl::HasPermission( |
PermissionName permission, |
const mojo::String& origin, |
const mojo::Callback<void(PermissionStatus)>& callback) { |
- NOTIMPLEMENTED(); |
+ DCHECK(context_->GetBrowserContext()); |
+ |
+ // If there is no web_contents() we use |origin| as the embedding_origin. |
+ GURL embedding_origin = context_->web_contents() |
+ ? context_->web_contents()->GetLastCommittedURL().GetOrigin() |
+ : GURL(origin); |
mlamouri (slow - plz ping)
2014/11/24 19:06:01
I think it would be better to have a PermissionSer
timvolodine
2014/11/27 17:53:42
done. but we still need the |origin| so cannot mov
|
+ |
+ GetContentClient()->browser()->HasPermission( |
+ PermissionNameToPermissionType(permission), |
+ context_->GetBrowserContext(), |
+ GURL(origin), |
+ embedding_origin, |
+ base::Bind(&PermissionServiceImpl::OnHasPermissionResponse, |
+ weak_factory_.GetWeakPtr(), |
+ callback)); |
+} |
+ |
+void PermissionServiceImpl::OnHasPermissionResponse( |
+ const mojo::Callback<void(PermissionStatus)>& callback, |
+ PermissionStatus content_setting) { |
+ callback.Run(content_setting); |
mlamouri (slow - plz ping)
2014/11/24 19:06:01
nit: s/content_setting/permission_status/
timvolodine
2014/11/27 17:53:42
Done.
|
} |
} // namespace content |