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

Side by Side Diff: net/proxy/proxy_config_service_android.h

Issue 10206014: Upstream Android proxy config service. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix comment Created 8 years, 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef NET_PROXY_PROXY_CONFIG_SERVICE_ANDROID_H_
6 #define NET_PROXY_PROXY_CONFIG_SERVICE_ANDROID_H_
7 #pragma once
8
9 #include <string>
10
11 #include "base/android/jni_android.h"
12 #include "base/basictypes.h"
13 #include "base/callback_forward.h"
14 #include "base/compiler_specific.h"
15 #include "base/memory/ref_counted.h"
16 #include "net/base/net_export.h"
17 #include "net/proxy/proxy_config_service.h"
18
19 namespace base {
20 class SingleThreadTaskRunner;
21 }
22
23 namespace net {
24
25 class ProxyConfig;
26
27 class NET_EXPORT ProxyConfigServiceAndroid : public ProxyConfigService {
28 public:
29 // Callback that returns the value of the property identified by the provided
30 // key. If it was not found, an empty string is returned. Note that this
31 // interface does not let you distinguish an empty property from a
32 // non-existing property. This callback is invoked on the JNI thread.
33 typedef base::Callback<std::string (const std::string& property)>
34 GetPropertyCallback;
35
36 ProxyConfigServiceAndroid(base::SingleThreadTaskRunner* network_task_runner,
37 base::SingleThreadTaskRunner* jni_task_runner);
38
39 virtual ~ProxyConfigServiceAndroid();
40
41 // Register JNI bindings.
42 static bool Register(JNIEnv* env);
43
44 // ProxyConfigService:
45 // Called only on the network thread.
46 virtual void AddObserver(Observer* observer) OVERRIDE;
47 virtual void RemoveObserver(Observer* observer) OVERRIDE;
48 virtual ConfigAvailability GetLatestProxyConfig(ProxyConfig* config) OVERRIDE;
49
50 // Called from Java (on JNI thread) to signal that the proxy settings have
51 // changed.
52 void ProxySettingsChanged(JNIEnv*, jobject);
53
54 private:
55 friend class ProxyConfigServiceAndroidTest;
56
57 // For tests.
58 ProxyConfigServiceAndroid(base::SingleThreadTaskRunner* network_task_runner,
59 base::SingleThreadTaskRunner* jni_task_runner,
60 GetPropertyCallback get_property_callback);
61
62 class Delegate;
63 scoped_refptr<Delegate> delegate_;
64
65 DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceAndroid);
66 };
67
68 } // namespace net
69
70 #endif // NET_PROXY_PROXY_CONFIG_SERVICE_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698