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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_PREFS_PROXY_CONFIG_DICTIONARY_H_
6 #define CHROME_BROWSER_PREFS_PROXY_CONFIG_DICTIONARY_H_
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "chrome/browser/prefs/proxy_prefs.h"
15 class DictionaryValue
;
18 // Factory and wrapper for proxy config dictionaries that are stored
19 // in the user preferences. The dictionary has the following structure:
24 // bypass_list: string
26 // See proxy_config_dictionary.cc for the structure of the respective strings.
27 class ProxyConfigDictionary
{
29 // Creates a deep copy of |dict| and leaves ownership to caller.
30 explicit ProxyConfigDictionary(const base::DictionaryValue
* dict
);
31 ~ProxyConfigDictionary();
33 bool GetMode(ProxyPrefs::ProxyMode
* out
) const;
34 bool GetPacUrl(std::string
* out
) const;
35 bool GetPacMandatory(bool* out
) const;
36 bool GetProxyServer(std::string
* out
) const;
37 bool GetBypassList(std::string
* out
) const;
38 bool HasBypassList() const;
40 const base::DictionaryValue
& GetDictionary() const;
42 static base::DictionaryValue
* CreateDirect();
43 static base::DictionaryValue
* CreateAutoDetect();
44 static base::DictionaryValue
* CreatePacScript(const std::string
& pac_url
,
46 static base::DictionaryValue
* CreateFixedServers(
47 const std::string
& proxy_server
,
48 const std::string
& bypass_list
);
49 static base::DictionaryValue
* CreateSystem();
51 static base::DictionaryValue
* CreateDictionary(
52 ProxyPrefs::ProxyMode mode
,
53 const std::string
& pac_url
,
55 const std::string
& proxy_server
,
56 const std::string
& bypass_list
);
58 scoped_ptr
<base::DictionaryValue
> dict_
;
60 DISALLOW_COPY_AND_ASSIGN(ProxyConfigDictionary
);
63 #endif // CHROME_BROWSER_PREFS_PROXY_CONFIG_DICTIONARY_H_