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

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

Issue 628773003: Partially convert geolocation IPC to Mojo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Handle WebContents going away Created 6 years, 2 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
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_impl_context.h"
6
7 #include "content/browser/geolocation/geolocation_service_impl.h"
8
9 namespace content {
10
11 GeolocationServiceImplContext::GeolocationServiceImplContext()
12 : paused_(false) {
13 }
14
15 GeolocationServiceImplContext::~GeolocationServiceImplContext() {
16 // The context can die before its attached services if the WebContents
17 // shuts down while geolocation updates are active.
18 for (auto* service : attached_services_) {
19 service->ContextDestroyed();
20 }
21 attached_services_.clear();
22 }
23
24 void GeolocationServiceImplContext::AddService(
25 GeolocationServiceImpl* service) {
26 attached_services_.push_back(service);
27 }
28
29 void GeolocationServiceImplContext::RemoveService(
30 GeolocationServiceImpl* service) {
31 attached_services_.remove(service);
32 /*
Michael van Ouwerkerk 2014/10/08 14:13:08 ?
blundell 2014/10/09 08:32:52 Done.
33 auto it = std::find(attached_services_.begin(), attached_services_.end(),
34 service);
35 DCHECK(it != attached_services_.end());
36 attached_services_.erase(it);
37 */
38 }
39
40 void GeolocationServiceImplContext::PauseUpdates() {
41 paused_ = true;
42 for (auto* service : attached_services_) {
43 service->PauseUpdates();
44 }
45 }
46
47 void GeolocationServiceImplContext::ResumeUpdates() {
48 paused_ = false;
49 for (auto* service : attached_services_) {
50 service->ResumeUpdates();
51 }
52 }
53
54 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698