OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 583 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
584 | 584 |
585 // TabContents may have gone away (or not exists for extension). | 585 // TabContents may have gone away (or not exists for extension). |
586 TabSpecificContentSettings* content_settings = | 586 TabSpecificContentSettings* content_settings = |
587 TabSpecificContentSettings::Get(render_process_id, render_view_id); | 587 TabSpecificContentSettings::Get(render_process_id, render_view_id); |
588 if (content_settings) { | 588 if (content_settings) { |
589 content_settings->OnGeolocationPermissionSet(requesting_frame.GetOrigin(), | 589 content_settings->OnGeolocationPermissionSet(requesting_frame.GetOrigin(), |
590 allowed); | 590 allowed); |
591 } | 591 } |
592 | 592 |
593 GeolocationPermissionContext::SetGeolocationPermissionResponse( | 593 SetGeolocationPermissionResponse(render_process_id, render_view_id, bridge_id, |
594 render_process_id, render_view_id, bridge_id, allowed); | 594 allowed); |
595 | 595 |
596 if (allowed) { | 596 if (allowed) { |
597 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, NewRunnableMethod( | 597 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, NewRunnableMethod( |
598 this, | 598 this, |
599 &ChromeGeolocationPermissionContext::NotifyArbitratorPermissionGranted, | 599 &ChromeGeolocationPermissionContext::NotifyArbitratorPermissionGranted, |
600 requesting_frame)); | 600 requesting_frame)); |
601 } | 601 } |
602 } | 602 } |
603 | 603 |
604 void ChromeGeolocationPermissionContext::NotifyArbitratorPermissionGranted( | 604 void ChromeGeolocationPermissionContext::NotifyArbitratorPermissionGranted( |
605 const GURL& requesting_frame) { | 605 const GURL& requesting_frame) { |
606 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 606 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
607 GeolocationProvider::GetInstance()->OnPermissionGranted(requesting_frame); | 607 GeolocationProvider::GetInstance()->OnPermissionGranted(requesting_frame); |
608 } | 608 } |
609 | 609 |
610 void ChromeGeolocationPermissionContext::CancelPendingInfoBarRequest( | 610 void ChromeGeolocationPermissionContext::CancelPendingInfoBarRequest( |
611 int render_process_id, | 611 int render_process_id, |
612 int render_view_id, | 612 int render_view_id, |
613 int bridge_id) { | 613 int bridge_id) { |
614 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { | 614 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
615 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, NewRunnableMethod( | 615 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, NewRunnableMethod( |
616 this, &ChromeGeolocationPermissionContext::CancelPendingInfoBarRequest, | 616 this, &ChromeGeolocationPermissionContext::CancelPendingInfoBarRequest, |
617 render_process_id, render_view_id, bridge_id)); | 617 render_process_id, render_view_id, bridge_id)); |
618 return; | 618 return; |
619 } | 619 } |
620 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 620 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
621 geolocation_infobar_queue_controller_->CancelInfoBarRequest(render_process_id, | 621 geolocation_infobar_queue_controller_->CancelInfoBarRequest(render_process_id, |
622 render_view_id, bridge_id); | 622 render_view_id, bridge_id); |
623 } | 623 } |
OLD | NEW |