summaryrefslogtreecommitdiffstats
path: root/chrome/browser/geolocation
diff options
context:
space:
mode:
authorerikkay@chromium.org <erikkay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-26 16:47:11 +0000
committererikkay@chromium.org <erikkay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-26 16:47:11 +0000
commit5ab79b06269c322e0446ebb8e9782e00ec1ccb96 (patch)
tree13f0dad86c052e0bdeed548ab69ad78dc837d676 /chrome/browser/geolocation
parent425f5ab811e965b212603d1500849072eb1f76f8 (diff)
downloadchromium_src-5ab79b06269c322e0446ebb8e9782e00ec1ccb96.zip
chromium_src-5ab79b06269c322e0446ebb8e9782e00ec1ccb96.tar.gz
chromium_src-5ab79b06269c322e0446ebb8e9782e00ec1ccb96.tar.bz2
Add geolocation permission to extensions/apps.
BUG=41278 TEST=None Review URL: http://codereview.chromium.org/1695013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45590 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/geolocation')
-rw-r--r--chrome/browser/geolocation/geolocation_permission_context.cc21
1 files changed, 20 insertions, 1 deletions
diff --git a/chrome/browser/geolocation/geolocation_permission_context.cc b/chrome/browser/geolocation/geolocation_permission_context.cc
index bf87271..5812c1a 100644
--- a/chrome/browser/geolocation/geolocation_permission_context.cc
+++ b/chrome/browser/geolocation/geolocation_permission_context.cc
@@ -8,15 +8,18 @@
#include "app/resource_bundle.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/chrome_thread.h"
+#include "chrome/browser/extensions/extensions_service.h"
#include "chrome/browser/geolocation/geolocation_content_settings_map.h"
#include "chrome/browser/geolocation/geolocation_dispatcher_host.h"
#include "chrome/browser/pref_service.h"
#include "chrome/browser/profile.h"
+#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/renderer_host/render_view_host_notification_task.h"
#include "chrome/browser/tab_contents/infobar_delegate.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/tab_contents/tab_util.h"
+#include "chrome/common/extensions/extension.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/render_messages.h"
#include "grit/generated_resources.h"
@@ -150,13 +153,29 @@ void GeolocationPermissionContext::RequestGeolocationPermission(
}
DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
+ ExtensionsService* extensions = profile_->GetExtensionsService();
+ if (extensions) {
+ Extension* ext = extensions->GetExtensionByURL(requesting_frame);
+ if (!ext)
+ ext = extensions->GetExtensionByWebExtent(requesting_frame);
+ if (ext && ext->HasApiPermission(Extension::kGeolocationPermission)) {
+ ExtensionProcessManager* epm = profile_->GetExtensionProcessManager();
+ RenderProcessHost* process = epm->GetExtensionProcess(requesting_frame);
+ if (process && process->id() == render_process_id) {
+ NotifyPermissionSet(render_process_id, render_view_id, bridge_id,
+ requesting_frame, true);
+ return;
+ }
+ }
+ }
+
TabContents* tab_contents =
tab_util::GetTabContentsByID(render_process_id, render_view_id);
if (!tab_contents) {
// The tab may have gone away, or the request may not be from a tab at all.
LOG(WARNING) << "Attempt to use geolocation tabless renderer: "
<< render_process_id << "," << render_view_id << "," << bridge_id
- << " (geolocation is not supported in extensions)";
+ << " (can't prompt user without a visible tab)";
NotifyPermissionSet(render_process_id, render_view_id, bridge_id,
requesting_frame, false);
return;