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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/geolocation/geolocation_service_impl_context.cc
diff --git a/content/browser/geolocation/geolocation_service_impl_context.cc b/content/browser/geolocation/geolocation_service_impl_context.cc
new file mode 100644
index 0000000000000000000000000000000000000000..5bb26ea2f03deb7ecf3178abaf75f9b6895e9735
--- /dev/null
+++ b/content/browser/geolocation/geolocation_service_impl_context.cc
@@ -0,0 +1,54 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/geolocation/geolocation_service_impl_context.h"
+
+#include "content/browser/geolocation/geolocation_service_impl.h"
+
+namespace content {
+
+GeolocationServiceImplContext::GeolocationServiceImplContext()
+ : paused_(false) {
+}
+
+GeolocationServiceImplContext::~GeolocationServiceImplContext() {
+ // The context can die before its attached services if the WebContents
+ // shuts down while geolocation updates are active.
+ for (auto* service : attached_services_) {
+ service->ContextDestroyed();
+ }
+ attached_services_.clear();
+}
+
+void GeolocationServiceImplContext::AddService(
+ GeolocationServiceImpl* service) {
+ attached_services_.push_back(service);
+}
+
+void GeolocationServiceImplContext::RemoveService(
+ GeolocationServiceImpl* service) {
+ attached_services_.remove(service);
+ /*
Michael van Ouwerkerk 2014/10/08 14:13:08 ?
blundell 2014/10/09 08:32:52 Done.
+ auto it = std::find(attached_services_.begin(), attached_services_.end(),
+ service);
+ DCHECK(it != attached_services_.end());
+ attached_services_.erase(it);
+ */
+}
+
+void GeolocationServiceImplContext::PauseUpdates() {
+ paused_ = true;
+ for (auto* service : attached_services_) {
+ service->PauseUpdates();
+ }
+}
+
+void GeolocationServiceImplContext::ResumeUpdates() {
+ paused_ = false;
+ for (auto* service : attached_services_) {
+ service->ResumeUpdates();
+ }
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698