Componentize HistoryURLProvider/ScoredHistoryMatch.
[chromium-blink-merge.git] / chrome / browser / prefs / proxy_config_dictionary.h
blob1593768fbd6b713c976dc21ab7310615b94398e2
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_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "chrome/browser/prefs/proxy_prefs.h"
14 namespace base {
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:
20 // {
21 // mode: string,
22 // server: string,
23 // pac_url: string,
24 // bypass_list: string
25 // }
26 // See proxy_config_dictionary.cc for the structure of the respective strings.
27 class ProxyConfigDictionary {
28 public:
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,
45 bool pac_mandatory);
46 static base::DictionaryValue* CreateFixedServers(
47 const std::string& proxy_server,
48 const std::string& bypass_list);
49 static base::DictionaryValue* CreateSystem();
50 private:
51 static base::DictionaryValue* CreateDictionary(
52 ProxyPrefs::ProxyMode mode,
53 const std::string& pac_url,
54 bool pac_mandatory,
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_