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

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

Issue 1308823002: Move Singleton and related structs to namespace base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ToT Created 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/geolocation/location_api_adapter_android.h" 5 #include "content/browser/geolocation/location_api_adapter_android.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 jstring message) { 134 jstring message) {
135 Geoposition position_error; 135 Geoposition position_error;
136 position_error.error_code = Geoposition::ERROR_CODE_POSITION_UNAVAILABLE; 136 position_error.error_code = Geoposition::ERROR_CODE_POSITION_UNAVAILABLE;
137 position_error.error_message = 137 position_error.error_message =
138 base::android::ConvertJavaStringToUTF8(env, message); 138 base::android::ConvertJavaStringToUTF8(env, message);
139 GetInstance()->OnNewGeopositionInternal(position_error); 139 GetInstance()->OnNewGeopositionInternal(position_error);
140 } 140 }
141 141
142 // static 142 // static
143 AndroidLocationApiAdapter* AndroidLocationApiAdapter::GetInstance() { 143 AndroidLocationApiAdapter* AndroidLocationApiAdapter::GetInstance() {
144 return Singleton<AndroidLocationApiAdapter>::get(); 144 return base::Singleton<AndroidLocationApiAdapter>::get();
145 } 145 }
146 146
147 // static 147 // static
148 bool AndroidLocationApiAdapter::RegisterGeolocationService(JNIEnv* env) { 148 bool AndroidLocationApiAdapter::RegisterGeolocationService(JNIEnv* env) {
149 return RegisterNativesImpl(env); 149 return RegisterNativesImpl(env);
150 } 150 }
151 151
152 void AndroidLocationApiAdapter::CreateJavaObject(JNIEnv* env) { 152 void AndroidLocationApiAdapter::CreateJavaObject(JNIEnv* env) {
153 // Create the Java AndroidLocationProvider object. 153 // Create the Java AndroidLocationProvider object.
154 java_location_provider_android_object_.Reset( 154 java_location_provider_android_object_.Reset(
155 Java_LocationProviderAdapter_create(env, 155 Java_LocationProviderAdapter_create(env,
156 base::android::GetApplicationContext())); 156 base::android::GetApplicationContext()));
157 CHECK(!java_location_provider_android_object_.is_null()); 157 CHECK(!java_location_provider_android_object_.is_null());
158 } 158 }
159 159
160 void AndroidLocationApiAdapter::OnNewGeopositionInternal( 160 void AndroidLocationApiAdapter::OnNewGeopositionInternal(
161 const Geoposition& geoposition) { 161 const Geoposition& geoposition) {
162 base::AutoLock lock(lock_); 162 base::AutoLock lock(lock_);
163 if (!task_runner_.get()) 163 if (!task_runner_.get())
164 return; 164 return;
165 task_runner_->PostTask( 165 task_runner_->PostTask(
166 FROM_HERE, 166 FROM_HERE,
167 base::Bind(&AndroidLocationApiAdapter::NotifyProviderNewGeoposition, 167 base::Bind(&AndroidLocationApiAdapter::NotifyProviderNewGeoposition,
168 geoposition)); 168 geoposition));
169 } 169 }
170 170
171 } // namespace content 171 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/geolocation/location_api_adapter_android.h ('k') | content/browser/gpu/gpu_data_manager_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698