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

Side by Side Diff: content/browser/geolocation/geolocation_service_context.cc

Issue 680323002: Revert of Partially convert geolocation IPC to Mojo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/browser/geolocation/geolocation_service_context.h"
6
7 namespace content {
8
9 GeolocationServiceContext::GeolocationServiceContext() : paused_(false) {
10 }
11
12 GeolocationServiceContext::~GeolocationServiceContext() {
13 }
14
15 void GeolocationServiceContext::CreateService(
16 const base::Closure& update_callback,
17 mojo::InterfaceRequest<GeolocationService> request) {
18 GeolocationServiceImpl* service =
19 new GeolocationServiceImpl(this, update_callback);
20 if (geoposition_override_)
21 service->SetOverride(*geoposition_override_.get());
22 services_.push_back(service);
23 mojo::WeakBindToRequest(service, &request);
24 service->StartListeningForUpdates();
25 }
26
27 void GeolocationServiceContext::ServiceHadConnectionError(
28 GeolocationServiceImpl* service) {
29 auto it = std::find(services_.begin(), services_.end(), service);
30 DCHECK(it != services_.end());
31 services_.erase(it);
32 }
33
34 void GeolocationServiceContext::PauseUpdates() {
35 paused_ = true;
36 for (auto* service : services_) {
37 service->PauseUpdates();
38 }
39 }
40
41 void GeolocationServiceContext::ResumeUpdates() {
42 paused_ = false;
43 for (auto* service : services_) {
44 service->ResumeUpdates();
45 }
46 }
47
48 void GeolocationServiceContext::SetOverride(
49 scoped_ptr<Geoposition> geoposition) {
50 geoposition_override_.swap(geoposition);
51 for (auto* service : services_) {
52 service->SetOverride(*geoposition_override_.get());
53 }
54 }
55
56 void GeolocationServiceContext::ClearOverride() {
57 for (auto* service : services_) {
58 service->ClearOverride();
59 }
60 }
61
62 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/geolocation/geolocation_service_context.h ('k') | content/browser/geolocation/geolocation_service_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698