Chromium Code Reviews| Index: chrome/browser/geolocation/geolocation_permission_context_android.cc |
| diff --git a/chrome/browser/geolocation/geolocation_permission_context_android.cc b/chrome/browser/geolocation/geolocation_permission_context_android.cc |
| index 64e49f69665988aa3c540524e798a2b2f55d2377..83327847ab54881d1b2e23024224803978d93729 100644 |
| --- a/chrome/browser/geolocation/geolocation_permission_context_android.cc |
| +++ b/chrome/browser/geolocation/geolocation_permission_context_android.cc |
| @@ -18,6 +18,8 @@ |
| #include "chrome/browser/permissions/permission_update_infobar_delegate_android.h" |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/browser/search_engines/template_url_service_factory.h" |
| +#include "chrome/browser/ui/android/tab_model/tab_model.h" |
| +#include "chrome/browser/ui/android/tab_model/tab_model_list.h" |
| #include "chrome/common/chrome_features.h" |
| #include "chrome/common/pref_names.h" |
| #include "components/infobars/core/infobar.h" |
| @@ -237,6 +239,22 @@ void GeolocationPermissionContextAndroid::NotifyPermissionSet( |
| content::WebContents::FromRenderFrameHost( |
| content::RenderFrameHost::FromID(id.render_process_id(), |
| id.render_frame_id())); |
| + |
| + // Only show the location settings dialog if the current tab is for |
| + // |web_contents|. Note, the TabModel will be null in unit tests. |
| + TabModel* tab_model = TabModelList::GetTabModelForWebContents(web_contents); |
| + if (tab_model && tab_model->GetActiveWebContents() != web_contents) { |
|
Ted C
2017/04/13 15:47:08
I wonder if this should be !tab_model ||
Though t
benwells
2017/04/14 00:13:53
It was like this originally, but it broke some tes
|
| + FinishNotifyPermissionSet(id, requesting_origin, embedding_origin, |
| + callback, false /* persist */, |
| + CONTENT_SETTING_BLOCK); |
| + // This case should be very rare, so just pretend it was a denied prompt |
| + // for metrics purposes. |
| + LogLocationSettingsMetric( |
| + kLocationSettingsDenyMetricBase, is_default_search, |
| + LocationSettingsBackOffLevel(is_default_search)); |
| + return; |
| + } |
| + |
| location_settings_->PromptToEnableSystemLocationSetting( |
| is_default_search ? SEARCH : DEFAULT, web_contents, |
| base::BindOnce( |