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

Side by Side Diff: chrome/browser/geolocation/geolocation_permission_context.cc

Issue 1158813002: Use RenderFrameHost for ::RequestPermission() and ::CancelPermission(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: build fixes Created 5 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/geolocation/geolocation_permission_context.h" 5 #include "chrome/browser/geolocation/geolocation_permission_context.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 8 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "components/content_settings/core/common/permission_request_id.h" 10 #include "components/content_settings/core/common/permission_request_id.h"
11 #include "content/public/browser/browser_thread.h" 11 #include "content/public/browser/browser_thread.h"
12 #include "content/public/browser/geolocation_provider.h" 12 #include "content/public/browser/geolocation_provider.h"
13 #include "content/public/browser/render_frame_host.h"
13 #include "content/public/browser/web_contents.h" 14 #include "content/public/browser/web_contents.h"
14 15
15 16
16 GeolocationPermissionContext::GeolocationPermissionContext( 17 GeolocationPermissionContext::GeolocationPermissionContext(
17 Profile* profile) 18 Profile* profile)
18 : PermissionContextBase(profile, CONTENT_SETTINGS_TYPE_GEOLOCATION), 19 : PermissionContextBase(profile, CONTENT_SETTINGS_TYPE_GEOLOCATION),
19 extensions_context_(profile) { 20 extensions_context_(profile) {
20 } 21 }
21 22
22 GeolocationPermissionContext::~GeolocationPermissionContext() { 23 GeolocationPermissionContext::~GeolocationPermissionContext() {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 if (extensions_context_.CancelPermissionRequest( 62 if (extensions_context_.CancelPermissionRequest(
62 web_contents, id.bridge_id())) 63 web_contents, id.bridge_id()))
63 return; 64 return;
64 PermissionContextBase::CancelPermissionRequest(web_contents, id); 65 PermissionContextBase::CancelPermissionRequest(web_contents, id);
65 } 66 }
66 67
67 void GeolocationPermissionContext::UpdateTabContext( 68 void GeolocationPermissionContext::UpdateTabContext(
68 const PermissionRequestID& id, 69 const PermissionRequestID& id,
69 const GURL& requesting_frame, 70 const GURL& requesting_frame,
70 bool allowed) { 71 bool allowed) {
71 // WebContents may have gone away (or not exists for extension).
72 TabSpecificContentSettings* content_settings = 72 TabSpecificContentSettings* content_settings =
73 TabSpecificContentSettings::Get(id.render_process_id(), 73 TabSpecificContentSettings::GetForFrame(id.render_process_id(),
74 id.render_view_id()); 74 id.render_frame_id());
75
76 // WebContents might not exist (extensions) or no longer exist. In which case,
77 // TabSpecificContentSettings will be null.
75 if (content_settings) 78 if (content_settings)
76 content_settings->OnGeolocationPermissionSet( 79 content_settings->OnGeolocationPermissionSet(
77 requesting_frame.GetOrigin(), allowed); 80 requesting_frame.GetOrigin(), allowed);
78 81
79 if (allowed) { 82 if (allowed) {
80 content::GeolocationProvider::GetInstance() 83 content::GeolocationProvider::GetInstance()
81 ->UserDidOptIntoLocationServices(); 84 ->UserDidOptIntoLocationServices();
82 } 85 }
83 } 86 }
84 87
85 bool GeolocationPermissionContext::IsRestrictedToSecureOrigins() const { 88 bool GeolocationPermissionContext::IsRestrictedToSecureOrigins() const {
86 return false; 89 return false;
87 } 90 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698