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

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

Issue 628773003: Partially convert geolocation IPC to Mojo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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 services_.push_back(service);
21 mojo::WeakBindToRequest(service, &request);
22 if (geoposition_override_)
23 service->SetOverride(*geoposition_override_.get());
24 else
25 service->StartListeningForUpdates();
26 }
27
28 void GeolocationServiceContext::ServiceHadConnectionError(
29 GeolocationServiceImpl* service) {
30 auto it = std::find(services_.begin(), services_.end(), service);
31 DCHECK(it != services_.end());
32 services_.erase(it);
33 }
34
35 void GeolocationServiceContext::PauseUpdates() {
36 paused_ = true;
37 for (auto* service : services_) {
38 service->PauseUpdates();
39 }
40 }
41
42 void GeolocationServiceContext::ResumeUpdates() {
43 paused_ = false;
44 for (auto* service : services_) {
45 service->ResumeUpdates();
46 }
47 }
48
49 void GeolocationServiceContext::SetOverride(
50 scoped_ptr<Geoposition> geoposition) {
51 geoposition_override_.swap(geoposition);
52 for (auto* service : services_) {
53 service->SetOverride(*geoposition_override_.get());
54 }
55 }
56
57 void GeolocationServiceContext::ClearOverride() {
58 for (auto* service : services_) {
59 service->ClearOverride();
60 }
61 }
62
63 } // 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