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

Side by Side Diff: components/proxy_config/proxy_config_dictionary.h

Issue 2785883003: Use unique_ptr<DictionaryValue> in ProxyConfigDictionary (Closed)
Patch Set: one constructor Created 3 years, 8 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
OLDNEW
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
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 // Creates a deep copy of |dict| and leaves ownership to caller. 34 explicit ProxyConfigDictionary(std::unique_ptr<base::DictionaryValue> dict);
35 explicit ProxyConfigDictionary(const base::DictionaryValue* dict);
36 ~ProxyConfigDictionary(); 35 ~ProxyConfigDictionary();
37 36
38 bool GetMode(ProxyPrefs::ProxyMode* out) const; 37 bool GetMode(ProxyPrefs::ProxyMode* out) const;
39 bool GetPacUrl(std::string* out) const; 38 bool GetPacUrl(std::string* out) const;
40 bool GetPacMandatory(bool* out) const; 39 bool GetPacMandatory(bool* out) const;
41 bool GetProxyServer(std::string* out) const; 40 bool GetProxyServer(std::string* out) const;
42 bool GetBypassList(std::string* out) const; 41 bool GetBypassList(std::string* out) const;
43 bool HasBypassList() const; 42 bool HasBypassList() const;
44 43
45 const base::DictionaryValue& GetDictionary() const; 44 const base::DictionaryValue& GetDictionary() const;
46 45
47 static base::DictionaryValue* CreateDirect(); 46 static std::unique_ptr<base::DictionaryValue> CreateDirect();
48 static base::DictionaryValue* CreateAutoDetect(); 47 static std::unique_ptr<base::DictionaryValue> CreateAutoDetect();
49 static base::DictionaryValue* CreatePacScript(const std::string& pac_url, 48 static std::unique_ptr<base::DictionaryValue> CreatePacScript(
50 bool pac_mandatory); 49 const std::string& pac_url,
51 static base::DictionaryValue* CreateFixedServers( 50 bool pac_mandatory);
51 static std::unique_ptr<base::DictionaryValue> CreateFixedServers(
52 const std::string& proxy_server, 52 const std::string& proxy_server,
53 const std::string& bypass_list); 53 const std::string& bypass_list);
54 static base::DictionaryValue* CreateSystem(); 54 static std::unique_ptr<base::DictionaryValue> CreateSystem();
55 55
56 // Encodes the proxy server as "<url-scheme>=<proxy-scheme>://<proxy>". 56 // Encodes the proxy server as "<url-scheme>=<proxy-scheme>://<proxy>".
57 // Used to generate the |proxy_server| arg for CreateFixedServers(). 57 // Used to generate the |proxy_server| arg for CreateFixedServers().
58 static void EncodeAndAppendProxyServer(const std::string& url_scheme, 58 static void EncodeAndAppendProxyServer(const std::string& url_scheme,
59 const net::ProxyServer& server, 59 const net::ProxyServer& server,
60 std::string* spec); 60 std::string* spec);
61 61
62 private: 62 private:
63 static base::DictionaryValue* CreateDictionary( 63 static std::unique_ptr<base::DictionaryValue> CreateDictionary(
64 ProxyPrefs::ProxyMode mode, 64 ProxyPrefs::ProxyMode mode,
65 const std::string& pac_url, 65 const std::string& pac_url,
66 bool pac_mandatory, 66 bool pac_mandatory,
67 const std::string& proxy_server, 67 const std::string& proxy_server,
68 const std::string& bypass_list); 68 const std::string& bypass_list);
69 69
70 std::unique_ptr<base::DictionaryValue> dict_; 70 std::unique_ptr<base::DictionaryValue> dict_;
71 71
72 DISALLOW_COPY_AND_ASSIGN(ProxyConfigDictionary); 72 DISALLOW_COPY_AND_ASSIGN(ProxyConfigDictionary);
73 }; 73 };
74 74
75 #endif // COMPONENTS_PROXY_CONFIG_PROXY_CONFIG_DICTIONARY_H_ 75 #endif // COMPONENTS_PROXY_CONFIG_PROXY_CONFIG_DICTIONARY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698