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.
4
5#ifndef CHROME_BROWSER_CHROMEOS_PROXY_CROS_SETTINGS_PROVIDER_H_
6#define CHROME_BROWSER_CHROMEOS_PROXY_CROS_SETTINGS_PROVIDER_H_
7#pragma once
8
9#include "base/memory/singleton.h"
10#include "base/values.h"
11#include "chrome/browser/chromeos/cros_settings_provider.h"
12#include "chrome/browser/chromeos/proxy_config_service_impl.h"
13
14namespace chromeos {
15
16class ProxyCrosSettingsProvider : public CrosSettingsProvider {
17 public:
18  ProxyCrosSettingsProvider();
19  // CrosSettingsProvider implementation.
20  virtual bool Get(const std::string& path, Value** out_value) const;
21  virtual bool HandlesSetting(const std::string& path);
22
23 private:
24  // CrosSettingsProvider implementation.
25  virtual void DoSet(const std::string& path, Value* value);
26
27  chromeos::ProxyConfigServiceImpl* GetConfigService() const;
28
29  net::ProxyServer CreateProxyServerFromHost(
30      const std::string& host,
31      const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy,
32      net::ProxyServer::Scheme scheme) const;
33
34  net::ProxyServer CreateProxyServerFromPort(
35      uint16 port,
36      const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy,
37      net::ProxyServer::Scheme scheme) const;
38
39  Value* CreateServerHostValue(
40      const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy) const;
41
42  Value* CreateServerPortValue(
43      const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy) const;
44
45  DISALLOW_COPY_AND_ASSIGN(ProxyCrosSettingsProvider);
46};
47
48}  // namespace chromeos
49
50#endif  // CHROME_BROWSER_CHROMEOS_PROXY_CROS_SETTINGS_PROVIDER_H_
51