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

Unified Diff: chrome/browser/geolocation/core_location_provider_mac.mm

Issue 3092015: Add CoreLocation support to Chrome (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Final rearrangements and merge with trunk Created 10 years, 3 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: chrome/browser/geolocation/core_location_provider_mac.mm
diff --git a/chrome/browser/geolocation/core_location_provider_mac.mm b/chrome/browser/geolocation/core_location_provider_mac.mm
new file mode 100644
index 0000000000000000000000000000000000000000..e410426a22e894aa747fdaff6a92ca939616114f
--- /dev/null
+++ b/chrome/browser/geolocation/core_location_provider_mac.mm
@@ -0,0 +1,51 @@
+// Copyright (c) 2010 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 "chrome/browser/geolocation/core_location_provider_mac.h"
+#include "chrome/browser/geolocation/core_location_data_provider_mac.h"
+
+#include "base/logging.h"
+#include "base/command_line.h"
+#include "chrome/common/chrome_switches.h"
+
+CoreLocationProviderMac::CoreLocationProviderMac() {
+ data_provider_ = new CoreLocationDataProviderMac();
+ data_provider_->AddRef();
+}
+
+CoreLocationProviderMac::~CoreLocationProviderMac() {
+ data_provider_->StopUpdating();
+ data_provider_->Release();
+}
+
+bool CoreLocationProviderMac::StartProvider(bool high_accuracy) {
+ data_provider_->StartUpdating(this);
+ return true;
+}
+
+void CoreLocationProviderMac::StopProvider() {
+ data_provider_->StopUpdating();
+}
+
+void CoreLocationProviderMac::GetPosition(Geoposition* position) {
+ DCHECK(position);
+ *position = position_;
+ DCHECK(position->IsInitialized());
+}
+
+void CoreLocationProviderMac::SetPosition(Geoposition* position) {
+ DCHECK(position);
+ position_ = *position;
+ DCHECK(position->IsInitialized());
+
+ UpdateListeners();
+}
+
+LocationProviderBase* NewSystemLocationProvider() {
+ if(CommandLine::ForCurrentProcess()
+ ->HasSwitch(switches::kEnableCoreLocation)) {
+ return new CoreLocationProviderMac;
+ }
+ return NULL;
+}
« no previous file with comments | « chrome/browser/geolocation/core_location_provider_mac.h ('k') | chrome/browser/geolocation/gps_location_provider_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698