| Index: chrome/browser/geolocation/chrome_geolocation_permission_context.cc
|
| ===================================================================
|
| --- chrome/browser/geolocation/chrome_geolocation_permission_context.cc (revision 163741)
|
| +++ chrome/browser/geolocation/chrome_geolocation_permission_context.cc (working copy)
|
| @@ -39,31 +39,30 @@
|
| }
|
|
|
| void ChromeGeolocationPermissionContext::RequestGeolocationPermission(
|
| - int render_process_id, int render_view_id, int bridge_id,
|
| - const GURL& requesting_frame, base::Callback<void(bool)> callback) {
|
| + const content::GeolocationPermissionRequestID& id,
|
| + const GURL& requesting_frame,
|
| + base::Callback<void(bool)> callback) {
|
| if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
|
| BrowserThread::PostTask(
|
| BrowserThread::UI, FROM_HERE,
|
| base::Bind(
|
| &ChromeGeolocationPermissionContext::RequestGeolocationPermission,
|
| - this, render_process_id, render_view_id, bridge_id,
|
| - requesting_frame, callback));
|
| + this, id, requesting_frame, callback));
|
| return;
|
| }
|
|
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| WebContents* web_contents =
|
| - tab_util::GetWebContentsByID(render_process_id, render_view_id);
|
| + tab_util::GetWebContentsByID(id.render_process_id, id.render_view_id);
|
| if (chrome::GetViewType(web_contents) != chrome::VIEW_TYPE_TAB_CONTENTS) {
|
| // The tab may have gone away, or the request may not be from a tab at all.
|
| // TODO(mpcomplete): the request could be from a background page or
|
| // extension popup (tab_contents will have a different ViewType). But why do
|
| // we care? Shouldn't we still put an infobar up in the current tab?
|
| LOG(WARNING) << "Attempt to use geolocation tabless renderer: "
|
| - << render_process_id << "," << render_view_id << ","
|
| - << bridge_id << " (can't prompt user without a visible tab)";
|
| - NotifyPermissionSet(render_process_id, render_view_id, bridge_id,
|
| - requesting_frame, callback, false);
|
| + << id.ToString()
|
| + << " (can't prompt user without a visible tab)";
|
| + NotifyPermissionSet(id, requesting_frame, callback, false);
|
| return;
|
| }
|
|
|
| @@ -72,26 +71,23 @@
|
| LOG(WARNING) << "Attempt to use geolocation from an invalid URL: "
|
| << requesting_frame << "," << embedder
|
| << " (geolocation is not supported in popups)";
|
| - NotifyPermissionSet(render_process_id, render_view_id, bridge_id,
|
| - requesting_frame, callback, false);
|
| + NotifyPermissionSet(id, requesting_frame, callback, false);
|
| return;
|
| }
|
|
|
| - DecidePermission(render_process_id, render_view_id, bridge_id,
|
| - requesting_frame, embedder, callback);
|
| + DecidePermission(id, requesting_frame, embedder, callback);
|
| }
|
|
|
| void ChromeGeolocationPermissionContext::CancelGeolocationPermissionRequest(
|
| - int render_process_id,
|
| - int render_view_id,
|
| - int bridge_id,
|
| + const content::GeolocationPermissionRequestID& id,
|
| const GURL& requesting_frame) {
|
| - CancelPendingInfoBarRequest(render_process_id, render_view_id, bridge_id);
|
| + CancelPendingInfoBarRequest(id);
|
| }
|
|
|
| void ChromeGeolocationPermissionContext::DecidePermission(
|
| - int render_process_id, int render_view_id, int bridge_id,
|
| - const GURL& requesting_frame, const GURL& embedder,
|
| + const content::GeolocationPermissionRequestID& id,
|
| + const GURL& requesting_frame,
|
| + const GURL& embedder,
|
| base::Callback<void(bool)> callback) {
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
|
|
| @@ -106,10 +102,9 @@
|
| if (extension &&
|
| extension->HasAPIPermission(extensions::APIPermission::kGeolocation)) {
|
| // Make sure the extension is in the calling process.
|
| - if (extension_service->process_map()->Contains(
|
| - extension->id(), render_process_id)) {
|
| - PermissionDecided(render_process_id, render_view_id, bridge_id,
|
| - requesting_frame, embedder, callback, true);
|
| + if (extension_service->process_map()->Contains(extension->id(),
|
| + id.render_process_id)) {
|
| + PermissionDecided(id, requesting_frame, embedder, callback, true);
|
| return;
|
| }
|
| }
|
| @@ -117,47 +112,35 @@
|
|
|
| ContentSetting content_setting =
|
| profile_->GetHostContentSettingsMap()->GetContentSetting(
|
| - requesting_frame,
|
| - embedder,
|
| - CONTENT_SETTINGS_TYPE_GEOLOCATION,
|
| + requesting_frame, embedder, CONTENT_SETTINGS_TYPE_GEOLOCATION,
|
| std::string());
|
| switch (content_setting) {
|
| case CONTENT_SETTING_BLOCK:
|
| - PermissionDecided(render_process_id, render_view_id, bridge_id,
|
| - requesting_frame, embedder, callback, false);
|
| + PermissionDecided(id, requesting_frame, embedder, callback, false);
|
| break;
|
| case CONTENT_SETTING_ALLOW:
|
| - PermissionDecided(render_process_id, render_view_id, bridge_id,
|
| - requesting_frame, embedder, callback, true);
|
| + PermissionDecided(id, requesting_frame, embedder, callback, true);
|
| break;
|
| default:
|
| // setting == ask. Prompt the user.
|
| QueueController()->CreateInfoBarRequest(
|
| - render_process_id, render_view_id, bridge_id, requesting_frame,
|
| - embedder, base::Bind(
|
| + id, requesting_frame, embedder, base::Bind(
|
| &ChromeGeolocationPermissionContext::NotifyPermissionSet,
|
| - base::Unretained(this),
|
| - render_process_id, render_view_id, bridge_id, requesting_frame,
|
| - callback));
|
| + base::Unretained(this), id, requesting_frame, callback));
|
| }
|
| }
|
|
|
| void ChromeGeolocationPermissionContext::PermissionDecided(
|
| - int render_process_id,
|
| - int render_view_id,
|
| - int bridge_id,
|
| + const content::GeolocationPermissionRequestID& id,
|
| const GURL& requesting_frame,
|
| const GURL& embedder,
|
| base::Callback<void(bool)> callback,
|
| bool allowed) {
|
| - NotifyPermissionSet(render_process_id, render_view_id, bridge_id,
|
| - requesting_frame, callback, allowed);
|
| + NotifyPermissionSet(id, requesting_frame, callback, allowed);
|
| }
|
|
|
| void ChromeGeolocationPermissionContext::NotifyPermissionSet(
|
| - int render_process_id,
|
| - int render_view_id,
|
| - int bridge_id,
|
| + const content::GeolocationPermissionRequestID& id,
|
| const GURL& requesting_frame,
|
| base::Callback<void(bool)> callback,
|
| bool allowed) {
|
| @@ -165,7 +148,7 @@
|
|
|
| // WebContents may have gone away (or not exists for extension).
|
| TabSpecificContentSettings* content_settings =
|
| - TabSpecificContentSettings::Get(render_process_id, render_view_id);
|
| + TabSpecificContentSettings::Get(id.render_process_id, id.render_view_id);
|
| if (content_settings) {
|
| content_settings->OnGeolocationPermissionSet(requesting_frame.GetOrigin(),
|
| allowed);
|
| @@ -189,20 +172,15 @@
|
| }
|
|
|
| void ChromeGeolocationPermissionContext::CancelPendingInfoBarRequest(
|
| - int render_process_id,
|
| - int render_view_id,
|
| - int bridge_id) {
|
| + const content::GeolocationPermissionRequestID& id) {
|
| if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
|
| BrowserThread::PostTask(
|
| BrowserThread::UI, FROM_HERE,
|
| base::Bind(
|
| &ChromeGeolocationPermissionContext::CancelPendingInfoBarRequest,
|
| - this, render_process_id, render_view_id, bridge_id));
|
| + this, id));
|
| return;
|
| }
|
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| - QueueController()->CancelInfoBarRequest(
|
| - render_process_id,
|
| - render_view_id,
|
| - bridge_id);
|
| + QueueController()->CancelInfoBarRequest(id);
|
| }
|
|
|