Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 COMPONENTS_PROXY_CONFIG_PROXY_CONFIG_DICTIONARY_H_ | 5 #ifndef COMPONENTS_PROXY_CONFIG_PROXY_CONFIG_DICTIONARY_H_ |
| 6 #define COMPONENTS_PROXY_CONFIG_PROXY_CONFIG_DICTIONARY_H_ | 6 #define COMPONENTS_PROXY_CONFIG_PROXY_CONFIG_DICTIONARY_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 // in the user preferences. The dictionary has the following structure: | 24 // in the user preferences. The dictionary has the following structure: |
| 25 // { | 25 // { |
| 26 // mode: string, | 26 // mode: string, |
| 27 // server: string, | 27 // server: string, |
| 28 // pac_url: string, | 28 // pac_url: string, |
| 29 // bypass_list: string | 29 // bypass_list: string |
| 30 // } | 30 // } |
| 31 // See proxy_config_dictionary.cc for the structure of the respective strings. | 31 // See proxy_config_dictionary.cc for the structure of the respective strings. |
| 32 class PROXY_CONFIG_EXPORT ProxyConfigDictionary { | 32 class PROXY_CONFIG_EXPORT ProxyConfigDictionary { |
| 33 public: | 33 public: |
| 34 explicit ProxyConfigDictionary(std::unique_ptr<base::DictionaryValue> dict); | |
|
vabr (Chromium)
2017/03/30 12:07:41
stevenjb@ -- if you are wondering why I added this
stevenjb
2017/03/30 17:00:58
I'm a little uncomfortable with having two such si
vabr (Chromium)
2017/03/30 17:04:21
That's no problem. I like that idea better than th
| |
| 34 // Creates a deep copy of |dict| and leaves ownership to caller. | 35 // Creates a deep copy of |dict| and leaves ownership to caller. |
| 35 explicit ProxyConfigDictionary(const base::DictionaryValue* dict); | 36 explicit ProxyConfigDictionary(const base::DictionaryValue* dict); |
| 36 ~ProxyConfigDictionary(); | 37 ~ProxyConfigDictionary(); |
| 37 | 38 |
| 38 bool GetMode(ProxyPrefs::ProxyMode* out) const; | 39 bool GetMode(ProxyPrefs::ProxyMode* out) const; |
| 39 bool GetPacUrl(std::string* out) const; | 40 bool GetPacUrl(std::string* out) const; |
| 40 bool GetPacMandatory(bool* out) const; | 41 bool GetPacMandatory(bool* out) const; |
| 41 bool GetProxyServer(std::string* out) const; | 42 bool GetProxyServer(std::string* out) const; |
| 42 bool GetBypassList(std::string* out) const; | 43 bool GetBypassList(std::string* out) const; |
| 43 bool HasBypassList() const; | 44 bool HasBypassList() const; |
| 44 | 45 |
| 45 const base::DictionaryValue& GetDictionary() const; | 46 const base::DictionaryValue& GetDictionary() const; |
| 46 | 47 |
| 47 static base::DictionaryValue* CreateDirect(); | 48 static std::unique_ptr<base::DictionaryValue> CreateDirect(); |
| 48 static base::DictionaryValue* CreateAutoDetect(); | 49 static std::unique_ptr<base::DictionaryValue> CreateAutoDetect(); |
| 49 static base::DictionaryValue* CreatePacScript(const std::string& pac_url, | 50 static std::unique_ptr<base::DictionaryValue> CreatePacScript( |
| 50 bool pac_mandatory); | 51 const std::string& pac_url, |
| 51 static base::DictionaryValue* CreateFixedServers( | 52 bool pac_mandatory); |
| 53 static std::unique_ptr<base::DictionaryValue> CreateFixedServers( | |
| 52 const std::string& proxy_server, | 54 const std::string& proxy_server, |
| 53 const std::string& bypass_list); | 55 const std::string& bypass_list); |
| 54 static base::DictionaryValue* CreateSystem(); | 56 static std::unique_ptr<base::DictionaryValue> CreateSystem(); |
| 55 | 57 |
| 56 // Encodes the proxy server as "<url-scheme>=<proxy-scheme>://<proxy>". | 58 // Encodes the proxy server as "<url-scheme>=<proxy-scheme>://<proxy>". |
| 57 // Used to generate the |proxy_server| arg for CreateFixedServers(). | 59 // Used to generate the |proxy_server| arg for CreateFixedServers(). |
| 58 static void EncodeAndAppendProxyServer(const std::string& url_scheme, | 60 static void EncodeAndAppendProxyServer(const std::string& url_scheme, |
| 59 const net::ProxyServer& server, | 61 const net::ProxyServer& server, |
| 60 std::string* spec); | 62 std::string* spec); |
| 61 | 63 |
| 62 private: | 64 private: |
| 63 static base::DictionaryValue* CreateDictionary( | 65 static std::unique_ptr<base::DictionaryValue> CreateDictionary( |
| 64 ProxyPrefs::ProxyMode mode, | 66 ProxyPrefs::ProxyMode mode, |
| 65 const std::string& pac_url, | 67 const std::string& pac_url, |
| 66 bool pac_mandatory, | 68 bool pac_mandatory, |
| 67 const std::string& proxy_server, | 69 const std::string& proxy_server, |
| 68 const std::string& bypass_list); | 70 const std::string& bypass_list); |
| 69 | 71 |
| 70 std::unique_ptr<base::DictionaryValue> dict_; | 72 std::unique_ptr<base::DictionaryValue> dict_; |
| 71 | 73 |
| 72 DISALLOW_COPY_AND_ASSIGN(ProxyConfigDictionary); | 74 DISALLOW_COPY_AND_ASSIGN(ProxyConfigDictionary); |
| 73 }; | 75 }; |
| 74 | 76 |
| 75 #endif // COMPONENTS_PROXY_CONFIG_PROXY_CONFIG_DICTIONARY_H_ | 77 #endif // COMPONENTS_PROXY_CONFIG_PROXY_CONFIG_DICTIONARY_H_ |
| OLD | NEW |