OLD | NEW |
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 NET_PROXY_PROXY_CONFIG_SERVICE_ANDROID_H_ | 5 #ifndef NET_PROXY_PROXY_CONFIG_SERVICE_ANDROID_H_ |
6 #define NET_PROXY_PROXY_CONFIG_SERVICE_ANDROID_H_ | 6 #define NET_PROXY_PROXY_CONFIG_SERVICE_ANDROID_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 // Called from Java (on JNI thread) to signal that the proxy settings have | 41 // Called from Java (on JNI thread) to signal that the proxy settings have |
42 // changed. The string and int arguments (the host/port pair for the proxy) | 42 // changed. The string and int arguments (the host/port pair for the proxy) |
43 // are either a host/port pair or ("", 0) to indicate "no proxy". | 43 // are either a host/port pair or ("", 0) to indicate "no proxy". |
44 virtual void ProxySettingsChangedTo(JNIEnv*, jobject, jstring, jint) = 0; | 44 virtual void ProxySettingsChangedTo(JNIEnv*, jobject, jstring, jint) = 0; |
45 | 45 |
46 // Called from Java (on JNI thread) to signal that the proxy settings have | 46 // Called from Java (on JNI thread) to signal that the proxy settings have |
47 // changed. New proxy settings are fetched from the system property store. | 47 // changed. New proxy settings are fetched from the system property store. |
48 virtual void ProxySettingsChanged(JNIEnv*, jobject) = 0; | 48 virtual void ProxySettingsChanged(JNIEnv*, jobject) = 0; |
49 }; | 49 }; |
50 | 50 |
51 ProxyConfigServiceAndroid(base::SequencedTaskRunner* network_task_runner, | 51 ProxyConfigServiceAndroid( |
52 base::SequencedTaskRunner* jni_task_runner); | 52 const scoped_refptr<base::SequencedTaskRunner>& network_task_runner, |
| 53 const scoped_refptr<base::SequencedTaskRunner>& jni_task_runner); |
53 | 54 |
54 virtual ~ProxyConfigServiceAndroid(); | 55 virtual ~ProxyConfigServiceAndroid(); |
55 | 56 |
56 // Register JNI bindings. | 57 // Register JNI bindings. |
57 static bool Register(JNIEnv* env); | 58 static bool Register(JNIEnv* env); |
58 | 59 |
59 // ProxyConfigService: | 60 // ProxyConfigService: |
60 // Called only on the network thread. | 61 // Called only on the network thread. |
61 virtual void AddObserver(Observer* observer) OVERRIDE; | 62 virtual void AddObserver(Observer* observer) OVERRIDE; |
62 virtual void RemoveObserver(Observer* observer) OVERRIDE; | 63 virtual void RemoveObserver(Observer* observer) OVERRIDE; |
63 virtual ConfigAvailability GetLatestProxyConfig(ProxyConfig* config) OVERRIDE; | 64 virtual ConfigAvailability GetLatestProxyConfig(ProxyConfig* config) OVERRIDE; |
64 | 65 |
65 private: | 66 private: |
66 friend class ProxyConfigServiceAndroidTestBase; | 67 friend class ProxyConfigServiceAndroidTestBase; |
67 class Delegate; | 68 class Delegate; |
68 | 69 |
69 // For tests. | 70 // For tests. |
70 ProxyConfigServiceAndroid(base::SequencedTaskRunner* network_task_runner, | 71 ProxyConfigServiceAndroid( |
71 base::SequencedTaskRunner* jni_task_runner, | 72 const scoped_refptr<base::SequencedTaskRunner>& network_task_runner, |
72 GetPropertyCallback get_property_callback); | 73 const scoped_refptr<base::SequencedTaskRunner>& jni_task_runner, |
| 74 GetPropertyCallback get_property_callback); |
73 | 75 |
74 // For tests. | 76 // For tests. |
75 void ProxySettingsChanged(); | 77 void ProxySettingsChanged(); |
76 | 78 |
77 scoped_refptr<Delegate> delegate_; | 79 scoped_refptr<Delegate> delegate_; |
78 | 80 |
79 DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceAndroid); | 81 DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceAndroid); |
80 }; | 82 }; |
81 | 83 |
82 } // namespace net | 84 } // namespace net |
83 | 85 |
84 #endif // NET_PROXY_PROXY_CONFIG_SERVICE_ANDROID_H_ | 86 #endif // NET_PROXY_PROXY_CONFIG_SERVICE_ANDROID_H_ |
OLD | NEW |