OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
9 #include "chrome/browser/browser.h" | 9 #include "chrome/browser/browser.h" |
10 #include "chrome/browser/chrome_thread.h" | 10 #include "chrome/browser/chrome_thread.h" |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 void GeolocationPermissionContext::StopUpdatingRequested( | 420 void GeolocationPermissionContext::StopUpdatingRequested( |
421 int render_process_id, int render_view_id, int bridge_id) { | 421 int render_process_id, int render_view_id, int bridge_id) { |
422 CancelPendingInfoBarRequest(render_process_id, render_view_id, bridge_id); | 422 CancelPendingInfoBarRequest(render_process_id, render_view_id, bridge_id); |
423 } | 423 } |
424 | 424 |
425 void GeolocationPermissionContext::NotifyPermissionSet( | 425 void GeolocationPermissionContext::NotifyPermissionSet( |
426 int render_process_id, int render_view_id, int bridge_id, | 426 int render_process_id, int render_view_id, int bridge_id, |
427 const GURL& requesting_frame, bool allowed) { | 427 const GURL& requesting_frame, bool allowed) { |
428 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); | 428 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); |
429 | 429 |
430 RenderViewHostDelegate::ContentSettings* content_settings = | 430 TabContents* tab_contents = |
431 tab_util::GetTabContentsByID(render_process_id, render_view_id); | 431 tab_util::GetTabContentsByID(render_process_id, render_view_id); |
| 432 |
432 // TabContents may have gone away (or not exists for extension). | 433 // TabContents may have gone away (or not exists for extension). |
433 if (content_settings) | 434 if (tab_contents) { |
| 435 TabSpecificContentSettings* content_settings = |
| 436 tab_contents->GetTabSpecificContentSettings(); |
434 content_settings->OnGeolocationPermissionSet(requesting_frame.GetOrigin(), | 437 content_settings->OnGeolocationPermissionSet(requesting_frame.GetOrigin(), |
435 allowed); | 438 allowed); |
| 439 } |
436 | 440 |
437 CallRenderViewHost( | 441 CallRenderViewHost( |
438 render_process_id, render_view_id, | 442 render_process_id, render_view_id, |
439 &RenderViewHost::Send, | 443 &RenderViewHost::Send, |
440 new ViewMsg_Geolocation_PermissionSet(render_view_id, bridge_id, | 444 new ViewMsg_Geolocation_PermissionSet(render_view_id, bridge_id, |
441 allowed)); | 445 allowed)); |
442 if (allowed) { | 446 if (allowed) { |
443 ChromeThread::PostTask( | 447 ChromeThread::PostTask( |
444 ChromeThread::IO, FROM_HERE, | 448 ChromeThread::IO, FROM_HERE, |
445 NewRunnableMethod(this, | 449 NewRunnableMethod(this, |
(...skipping 15 matching lines...) Expand all Loading... |
461 ChromeThread::UI, FROM_HERE, | 465 ChromeThread::UI, FROM_HERE, |
462 NewRunnableMethod(this, | 466 NewRunnableMethod(this, |
463 &GeolocationPermissionContext::CancelPendingInfoBarRequest, | 467 &GeolocationPermissionContext::CancelPendingInfoBarRequest, |
464 render_process_id, render_view_id, bridge_id)); | 468 render_process_id, render_view_id, bridge_id)); |
465 return; | 469 return; |
466 } | 470 } |
467 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); | 471 DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); |
468 geolocation_infobar_queue_controller_->CancelInfoBarRequest( | 472 geolocation_infobar_queue_controller_->CancelInfoBarRequest( |
469 render_process_id, render_view_id, bridge_id); | 473 render_process_id, render_view_id, bridge_id); |
470 } | 474 } |
OLD | NEW |