| 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_dispatcher_host.h" | 5 #include "content/browser/geolocation/geolocation_dispatcher_host.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "chrome/common/geoposition.h" | 11 #include "chrome/common/geoposition.h" |
| 12 #include "chrome/browser/geolocation/geolocation_permission_context.h" | |
| 13 #include "chrome/browser/geolocation/geolocation_provider.h" | |
| 14 #include "chrome/browser/renderer_host/render_message_filter.h" | |
| 15 #include "chrome/browser/renderer_host/render_process_host.h" | |
| 16 #include "chrome/browser/renderer_host/render_view_host.h" | |
| 17 #include "chrome/browser/renderer_host/render_view_host_notification_task.h" | |
| 18 #include "chrome/common/render_messages.h" | 12 #include "chrome/common/render_messages.h" |
| 19 #include "ipc/ipc_message.h" | 13 #include "content/browser/geolocation/geolocation_permission_context.h" |
| 14 #include "content/browser/geolocation/geolocation_provider.h" |
| 15 #include "content/browser/renderer_host/render_message_filter.h" |
| 16 #include "content/browser/renderer_host/render_process_host.h" |
| 17 #include "content/browser/renderer_host/render_view_host.h" |
| 20 | 18 |
| 21 namespace { | 19 namespace { |
| 22 class GeolocationDispatcherHostImpl : public GeolocationDispatcherHost, | 20 class GeolocationDispatcherHostImpl : public GeolocationDispatcherHost, |
| 23 public GeolocationObserver { | 21 public GeolocationObserver { |
| 24 public: | 22 public: |
| 25 GeolocationDispatcherHostImpl( | 23 GeolocationDispatcherHostImpl( |
| 26 int render_process_id, | 24 int render_process_id, |
| 27 GeolocationPermissionContext* geolocation_permission_context); | 25 GeolocationPermissionContext* geolocation_permission_context); |
| 28 | 26 |
| 29 // GeolocationDispatcherHost | 27 // GeolocationDispatcherHost |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 IPC_MESSAGE_UNHANDLED(handled = false) | 96 IPC_MESSAGE_UNHANDLED(handled = false) |
| 99 IPC_END_MESSAGE_MAP() | 97 IPC_END_MESSAGE_MAP() |
| 100 return handled; | 98 return handled; |
| 101 } | 99 } |
| 102 | 100 |
| 103 void GeolocationDispatcherHostImpl::OnLocationUpdate( | 101 void GeolocationDispatcherHostImpl::OnLocationUpdate( |
| 104 const Geoposition& geoposition) { | 102 const Geoposition& geoposition) { |
| 105 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 103 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 106 for (std::set<int>::iterator it = geolocation_renderer_ids_.begin(); | 104 for (std::set<int>::iterator it = geolocation_renderer_ids_.begin(); |
| 107 it != geolocation_renderer_ids_.end(); ++it) { | 105 it != geolocation_renderer_ids_.end(); ++it) { |
| 108 IPC::Message* message = | 106 Send(new ViewMsg_Geolocation_PositionUpdated(*it, geoposition)); |
| 109 new ViewMsg_Geolocation_PositionUpdated(*it, geoposition); | |
| 110 CallRenderViewHost(render_process_id_, *it, | |
| 111 &RenderViewHost::Send, message); | |
| 112 } | 107 } |
| 113 } | 108 } |
| 114 | 109 |
| 115 void GeolocationDispatcherHostImpl::OnRequestPermission( | 110 void GeolocationDispatcherHostImpl::OnRequestPermission( |
| 116 int render_view_id, | 111 int render_view_id, |
| 117 int bridge_id, | 112 int bridge_id, |
| 118 const GURL& requesting_frame) { | 113 const GURL& requesting_frame) { |
| 119 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 114 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 120 DVLOG(1) << __FUNCTION__ << " " << render_process_id_ << ":" | 115 DVLOG(1) << __FUNCTION__ << " " << render_process_id_ << ":" |
| 121 << render_view_id << ":" << bridge_id; | 116 << render_view_id << ":" << bridge_id; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 } | 177 } |
| 183 } // namespace | 178 } // namespace |
| 184 | 179 |
| 185 GeolocationDispatcherHost* GeolocationDispatcherHost::New( | 180 GeolocationDispatcherHost* GeolocationDispatcherHost::New( |
| 186 int render_process_id, | 181 int render_process_id, |
| 187 GeolocationPermissionContext* geolocation_permission_context) { | 182 GeolocationPermissionContext* geolocation_permission_context) { |
| 188 return new GeolocationDispatcherHostImpl( | 183 return new GeolocationDispatcherHostImpl( |
| 189 render_process_id, | 184 render_process_id, |
| 190 geolocation_permission_context); | 185 geolocation_permission_context); |
| 191 } | 186 } |
| OLD | NEW |