OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
petkov
2010/11/18 23:26:46
Chromium OS Authors
adlr
2010/11/19 00:41:06
Done.
| |
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 CHROMEOS_PLATFORM_UPDATE_ENGINE_CHROME_PROXY_RESOLVER_H__ | |
6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_CHROME_PROXY_RESOLVER_H__ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include <curl/curl.h> | |
12 | |
petkov
2010/11/18 23:26:46
remove blank line
adlr
2010/11/19 00:41:06
Done.
| |
13 #include "gtest/gtest_prod.h" // for FRIEND_TEST | |
petkov
2010/11/18 23:26:46
<gtest/gtest_prod.h>
adlr
2010/11/19 00:41:06
Done.
| |
14 | |
15 #include "update_engine/dbus_interface.h" | |
16 #include "update_engine/proxy_resolver.h" | |
17 | |
18 namespace chromeos_update_engine { | |
19 | |
20 extern const char kSessionManagerService[]; | |
21 extern const char kSessionManagerPath[]; | |
22 extern const char kSessionManagerInterface[]; | |
23 extern const char kSessionManagerRetreivePropertyMethod[]; | |
petkov
2010/11/18 23:26:46
typo: Retrieve
adlr
2010/11/19 00:41:06
Done.
| |
24 extern const char kSessionManagerProxySettingsKey[]; | |
25 | |
26 // Class to resolve proxy for a url based on Chrome's proxy settings. | |
27 | |
28 // Currently only supports manual settings, not PAC files or autodetected | |
29 // settings. | |
30 | |
31 class ChromeProxyResolver : public ProxyResolver { | |
32 public: | |
33 explicit ChromeProxyResolver(DbusGlibInterface* dbus) : dbus_(dbus) {} | |
34 virtual ~ChromeProxyResolver() {} | |
35 | |
36 virtual bool ProxyForUrl(const std::string& url, | |
37 std::vector<std::string>* out_proxies); | |
38 | |
39 // Get the curl proxy type for a given proxy url. Returns true on success. | |
40 // Note: if proxy is kNoProxy, this will return false. | |
41 static bool ProxyTypeForProxy(const std::string& proxy, | |
petkov
2010/11/18 23:26:46
GetProxyTypeForProxy
adlr
2010/11/19 00:41:06
Done.
| |
42 curl_proxytype* out_type); | |
43 | |
44 private: | |
45 FRIEND_TEST(ChromeProxyResolverTest, ProxyForUrlWithSettingsTest); | |
petkov
2010/11/18 23:26:46
add an empty line after
adlr
2010/11/19 00:41:06
Done.
| |
46 // Fetches a dbus proxy to session manager. Returns true on success. | |
47 bool DbusProxy(DBusGProxy** out_proxy); | |
petkov
2010/11/18 23:26:46
Maybe simplify the prototype to:
DBusGProxy* GetD
adlr
2010/11/19 00:41:06
Done.
| |
48 | |
49 // Fetches the json-encoded proxy settings string from the session manager. | |
50 bool JsonProxySettings(DBusGProxy* proxy, std::string* out_json); | |
petkov
2010/11/18 23:26:46
GetJsonProxySettings
adlr
2010/11/19 00:41:06
Done.
| |
51 | |
52 // Given a |url| and the json encoded settings |json_settings|, | |
53 // returns the proper proxy server. | |
petkov
2010/11/18 23:26:46
It returns a list of servers, right?
adlr
2010/11/19 00:41:06
yes, fixed.
| |
54 bool ProxyForUrlWithSettings(const std::string& url, | |
petkov
2010/11/18 23:26:46
GetProxyForURLWithSettings?
adlr
2010/11/19 00:41:06
GetProxiesForUrlWithSettings
| |
55 const std::string& json_settings, | |
56 std::vector<std::string>* out_proxies); | |
57 | |
58 DbusGlibInterface* dbus_; | |
59 }; | |
petkov
2010/11/18 23:26:46
DISALLOW_COPY_AND_ASSIGN?
adlr
2010/11/19 00:41:06
Done.
| |
60 | |
61 } // namespace chromeos_update_engine | |
62 | |
63 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_CHROME_PROXY_RESOLVER_H__ | |
OLD | NEW |