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

Unified Diff: content/browser/geolocation/mock_location_provider.cc

Issue 2028823002: Refactor to make BlimpLocationProvider accessible to content layer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addresses kmarshall's and mvanouwerkerk's comments + code clean up Created 4 years, 6 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/mock_location_provider.cc
diff --git a/content/browser/geolocation/mock_location_provider.cc b/content/browser/geolocation/mock_location_provider.cc
index f289a1e68717d7d8c46a2fa1be4b1327dbe79424..73621b510c3997a1c3617cd2fb79c53ce02ba1e3 100644
--- a/content/browser/geolocation/mock_location_provider.cc
+++ b/content/browser/geolocation/mock_location_provider.cc
@@ -16,22 +16,13 @@
#include "base/threading/thread_task_runner_handle.h"
namespace content {
-MockLocationProvider* MockLocationProvider::instance_ = NULL;
-MockLocationProvider::MockLocationProvider(MockLocationProvider** self_ref)
+MockLocationProvider::MockLocationProvider()
: state_(STOPPED),
is_permission_granted_(false),
- self_ref_(self_ref),
- provider_task_runner_(base::ThreadTaskRunnerHandle::Get()) {
- CHECK(self_ref_);
- CHECK(*self_ref_ == NULL);
- *self_ref_ = this;
-}
+ provider_task_runner_(base::ThreadTaskRunnerHandle::Get()) {}
-MockLocationProvider::~MockLocationProvider() {
- CHECK(*self_ref_ == this);
- *self_ref_ = NULL;
-}
+MockLocationProvider::~MockLocationProvider() {}
void MockLocationProvider::HandlePositionChanged(const Geoposition& position) {
if (provider_task_runner_->BelongsToCurrentThread()) {
@@ -70,8 +61,7 @@ class AutoMockLocationProvider : public MockLocationProvider {
public:
AutoMockLocationProvider(bool has_valid_location,
bool requires_permission_to_start)
- : MockLocationProvider(&instance_),
- weak_factory_(this),
+ : weak_factory_(this),
requires_permission_to_start_(requires_permission_to_start),
listeners_updated_(false) {
if (has_valid_location) {
@@ -115,7 +105,7 @@ class AutoMockLocationProvider : public MockLocationProvider {
};
LocationProvider* NewMockLocationProvider() {
- return new MockLocationProvider(&MockLocationProvider::instance_);
+ return new MockLocationProvider;
}
LocationProvider* NewAutoSuccessMockLocationProvider() {

Powered by Google App Engine
This is Rietveld 408576698