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

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

Issue 23440030: GeolocationPermissionContext: only use origin from embedder url. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use GURL::GetOrigin. Created 7 years, 3 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/chrome_geolocation_permission_context.h" 5 #include "chrome/browser/geolocation/chrome_geolocation_permission_context.h"
6 6
7 #include <functional> 7 #include <functional>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // TODO(mpcomplete): the request could be from a background page or 87 // TODO(mpcomplete): the request could be from a background page or
88 // extension popup (web_contents will have a different ViewType). But why do 88 // extension popup (web_contents will have a different ViewType). But why do
89 // we care? Shouldn't we still put an infobar up in the current tab? 89 // we care? Shouldn't we still put an infobar up in the current tab?
90 LOG(WARNING) << "Attempt to use geolocation tabless renderer: " 90 LOG(WARNING) << "Attempt to use geolocation tabless renderer: "
91 << id.ToString() 91 << id.ToString()
92 << " (can't prompt user without a visible tab)"; 92 << " (can't prompt user without a visible tab)";
93 NotifyPermissionSet(id, requesting_frame, callback, false); 93 NotifyPermissionSet(id, requesting_frame, callback, false);
94 return; 94 return;
95 } 95 }
96 96
97 GURL embedder = web_contents->GetURL(); 97 GURL embedder = web_contents->GetLastCommittedURL().GetOrigin();
98 if (!requesting_frame.is_valid() || !embedder.is_valid()) { 98 if (!requesting_frame.is_valid() || !embedder.is_valid()) {
99 LOG(WARNING) << "Attempt to use geolocation from an invalid URL: " 99 LOG(WARNING) << "Attempt to use geolocation from an invalid URL: "
100 << requesting_frame << "," << embedder 100 << requesting_frame << "," << embedder
101 << " (geolocation is not supported in popups)"; 101 << " (geolocation is not supported in popups)";
102 NotifyPermissionSet(id, requesting_frame, callback, false); 102 NotifyPermissionSet(id, requesting_frame, callback, false);
103 return; 103 return;
104 } 104 }
105 105
106 DecidePermission(id, requesting_frame, embedder, callback); 106 DecidePermission(id, requesting_frame, embedder, callback);
107 } 107 }
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 base::Bind( 200 base::Bind(
201 &ChromeGeolocationPermissionContext::CancelPendingInfoBarRequest, 201 &ChromeGeolocationPermissionContext::CancelPendingInfoBarRequest,
202 this, id)); 202 this, id));
203 return; 203 return;
204 } 204 }
205 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 205 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
206 if (shutting_down_) 206 if (shutting_down_)
207 return; 207 return;
208 QueueController()->CancelInfoBarRequest(id); 208 QueueController()->CancelInfoBarRequest(id);
209 } 209 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698