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

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

Issue 6597044: Revert 76228 - Move core pieces of geolocation from chrome to content.This is... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 9 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 | Annotate | Revision Log
OLDNEW
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 "content/browser/geolocation/geolocation_permission_context.h" 5 #include "chrome/browser/geolocation/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
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "chrome/browser/browser_thread.h" 12 #include "chrome/browser/browser_thread.h"
13 #include "chrome/browser/extensions/extension_service.h" 13 #include "chrome/browser/extensions/extension_service.h"
14 #include "chrome/browser/geolocation/geolocation_content_settings_map.h" 14 #include "chrome/browser/geolocation/geolocation_content_settings_map.h"
15 #include "chrome/browser/geolocation/geolocation_provider.h"
15 #include "chrome/browser/google/google_util.h" 16 #include "chrome/browser/google/google_util.h"
16 #include "chrome/browser/prefs/pref_service.h" 17 #include "chrome/browser/prefs/pref_service.h"
17 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/browser/renderer_host/render_process_host.h"
20 #include "chrome/browser/renderer_host/render_view_host.h"
21 #include "chrome/browser/renderer_host/render_view_host_notification_task.h"
18 #include "chrome/browser/tab_contents/infobar_delegate.h" 22 #include "chrome/browser/tab_contents/infobar_delegate.h"
23 #include "chrome/browser/tab_contents/tab_contents.h"
19 #include "chrome/browser/tab_contents/tab_util.h" 24 #include "chrome/browser/tab_contents/tab_util.h"
20 #include "chrome/common/extensions/extension.h" 25 #include "chrome/common/extensions/extension.h"
21 #include "chrome/common/notification_registrar.h" 26 #include "chrome/common/notification_registrar.h"
22 #include "chrome/common/notification_source.h" 27 #include "chrome/common/notification_source.h"
23 #include "chrome/common/notification_type.h" 28 #include "chrome/common/notification_type.h"
24 #include "chrome/common/pref_names.h" 29 #include "chrome/common/pref_names.h"
25 #include "chrome/common/render_messages.h" 30 #include "chrome/common/render_messages.h"
26 #include "content/browser/geolocation/geolocation_provider.h"
27 #include "content/browser/renderer_host/render_process_host.h"
28 #include "content/browser/renderer_host/render_view_host.h"
29 #include "content/browser/tab_contents/tab_contents.h"
30 #include "grit/generated_resources.h" 31 #include "grit/generated_resources.h"
31 #include "grit/locale_settings.h" 32 #include "grit/locale_settings.h"
32 #include "grit/theme_resources.h" 33 #include "grit/theme_resources.h"
33 #include "net/base/net_util.h" 34 #include "net/base/net_util.h"
34 #include "ui/base/l10n/l10n_util.h" 35 #include "ui/base/l10n/l10n_util.h"
35 #include "ui/base/resource/resource_bundle.h" 36 #include "ui/base/resource/resource_bundle.h"
36 37
37 // GeolocationInfoBarQueueController ------------------------------------------ 38 // GeolocationInfoBarQueueController ------------------------------------------
38 39
39 // This class controls the geolocation infobar queue per profile, and it's an 40 // This class controls the geolocation infobar queue per profile, and it's an
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 tab_util::GetTabContentsByID(render_process_id, render_view_id); 588 tab_util::GetTabContentsByID(render_process_id, render_view_id);
588 589
589 // TabContents may have gone away (or not exists for extension). 590 // TabContents may have gone away (or not exists for extension).
590 if (tab_contents) { 591 if (tab_contents) {
591 TabSpecificContentSettings* content_settings = 592 TabSpecificContentSettings* content_settings =
592 tab_contents->GetTabSpecificContentSettings(); 593 tab_contents->GetTabSpecificContentSettings();
593 content_settings->OnGeolocationPermissionSet(requesting_frame.GetOrigin(), 594 content_settings->OnGeolocationPermissionSet(requesting_frame.GetOrigin(),
594 allowed); 595 allowed);
595 } 596 }
596 597
597 RenderViewHost* r = RenderViewHost::FromID(render_process_id, render_view_id); 598 CallRenderViewHost(render_process_id, render_view_id, &RenderViewHost::Send,
598 if (r) { 599 new ViewMsg_Geolocation_PermissionSet(render_view_id, bridge_id,
599 r->Send(new ViewMsg_Geolocation_PermissionSet( 600 allowed));
600 render_view_id, bridge_id, allowed));
601 }
602
603 if (allowed) { 601 if (allowed) {
604 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, NewRunnableMethod( 602 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, NewRunnableMethod(
605 this, &GeolocationPermissionContext::NotifyArbitratorPermissionGranted, 603 this, &GeolocationPermissionContext::NotifyArbitratorPermissionGranted,
606 requesting_frame)); 604 requesting_frame));
607 } 605 }
608 } 606 }
609 607
610 void GeolocationPermissionContext::NotifyArbitratorPermissionGranted( 608 void GeolocationPermissionContext::NotifyArbitratorPermissionGranted(
611 const GURL& requesting_frame) { 609 const GURL& requesting_frame) {
612 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 610 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
613 GeolocationProvider::GetInstance()->OnPermissionGranted(requesting_frame); 611 GeolocationProvider::GetInstance()->OnPermissionGranted(requesting_frame);
614 } 612 }
615 613
616 void GeolocationPermissionContext::CancelPendingInfoBarRequest( 614 void GeolocationPermissionContext::CancelPendingInfoBarRequest(
617 int render_process_id, 615 int render_process_id,
618 int render_view_id, 616 int render_view_id,
619 int bridge_id) { 617 int bridge_id) {
620 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { 618 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
621 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, NewRunnableMethod( 619 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, NewRunnableMethod(
622 this, &GeolocationPermissionContext::CancelPendingInfoBarRequest, 620 this, &GeolocationPermissionContext::CancelPendingInfoBarRequest,
623 render_process_id, render_view_id, bridge_id)); 621 render_process_id, render_view_id, bridge_id));
624 return; 622 return;
625 } 623 }
626 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 624 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
627 geolocation_infobar_queue_controller_->CancelInfoBarRequest(render_process_id, 625 geolocation_infobar_queue_controller_->CancelInfoBarRequest(render_process_id,
628 render_view_id, bridge_id); 626 render_view_id, bridge_id);
629 } 627 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698