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

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

Issue 65273002: Add a mechanism to pause and resume geolocation requests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Wire up onPause/onResume Created 7 years, 1 month 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 #ifndef CONTENT_BROWSER_GEOLOCATION_LOCATION_API_ADAPTER_ANDROID_H_ 5 #ifndef CONTENT_BROWSER_GEOLOCATION_LOCATION_API_ADAPTER_ANDROID_H_
6 #define CONTENT_BROWSER_GEOLOCATION_LOCATION_API_ADAPTER_ANDROID_H_ 6 #define CONTENT_BROWSER_GEOLOCATION_LOCATION_API_ADAPTER_ANDROID_H_
7 7
8 #include "base/android/jni_helper.h" 8 #include "base/android/jni_helper.h"
9 #include "base/android/scoped_java_ref.h" 9 #include "base/android/scoped_java_ref.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 19 matching lines...) Expand all
30 // one AndroidLocationProvider that has called Start(). 30 // one AndroidLocationProvider that has called Start().
31 class AndroidLocationApiAdapter { 31 class AndroidLocationApiAdapter {
32 public: 32 public:
33 // Starts the underlying location provider, returns true if successful. 33 // Starts the underlying location provider, returns true if successful.
34 // Called on the Geolocation thread. 34 // Called on the Geolocation thread.
35 bool Start(LocationProviderAndroid* location_provider, bool high_accuracy); 35 bool Start(LocationProviderAndroid* location_provider, bool high_accuracy);
36 // Stops the underlying location provider. 36 // Stops the underlying location provider.
37 // Called on the Geolocation thread. 37 // Called on the Geolocation thread.
38 void Stop(); 38 void Stop();
39 39
40 // Pauses the underlying location provider, preventing it from firing new
41 // updates. This is intended as a lighter weight alternative to Stop() that
42 // can be easily resumed without needing to call Start() again.
43 void Pause();
44
45 // Resumes the underlying location provider. Should not be invoked unless
46 // the location provider has already been paused.
47 void Resume();
48
40 // Returns our singleton. 49 // Returns our singleton.
41 static AndroidLocationApiAdapter* GetInstance(); 50 static AndroidLocationApiAdapter* GetInstance();
42 51
43 // Called when initializing chrome_view to obtain a pointer to the java class. 52 // Called when initializing chrome_view to obtain a pointer to the java class.
44 static bool RegisterGeolocationService(JNIEnv* env); 53 static bool RegisterGeolocationService(JNIEnv* env);
45 54
46 // Called by JNI on main thread looper. 55 // Called by JNI on main thread looper.
47 static void OnNewLocationAvailable(double latitude, 56 static void OnNewLocationAvailable(double latitude,
48 double longitude, 57 double longitude,
49 double time_stamp, 58 double time_stamp,
(...skipping 22 matching lines...) Expand all
72 81
73 // Guards against the following member which is accessed on Geolocation 82 // Guards against the following member which is accessed on Geolocation
74 // thread and the JNI main thread looper. 83 // thread and the JNI main thread looper.
75 base::Lock lock_; 84 base::Lock lock_;
76 scoped_refptr<base::MessageLoopProxy> message_loop_; 85 scoped_refptr<base::MessageLoopProxy> message_loop_;
77 }; 86 };
78 87
79 } // namespace content 88 } // namespace content
80 89
81 #endif // CONTENT_BROWSER_GEOLOCATION_LOCATION_API_ADAPTER_ANDROID_H_ 90 #endif // CONTENT_BROWSER_GEOLOCATION_LOCATION_API_ADAPTER_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698