15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2011 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef CHROME_BROWSER_CHROMEOS_PROXY_CROS_SETTINGS_PROVIDER_H_
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define CHROME_BROWSER_CHROMEOS_PROXY_CROS_SETTINGS_PROVIDER_H_
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#pragma once
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/memory/singleton.h"
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/values.h"
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/chromeos/cros_settings_provider.h"
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "chrome/browser/chromeos/proxy_config_service_impl.h"
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace chromeos {
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ProxyCrosSettingsProvider : public CrosSettingsProvider {
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public:
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  ProxyCrosSettingsProvider();
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // CrosSettingsProvider implementation.
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool Get(const std::string& path, Value** out_value) const;
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual bool HandlesSetting(const std::string& path);
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) private:
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  // CrosSettingsProvider implementation.
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  virtual void DoSet(const std::string& path, Value* value);
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  chromeos::ProxyConfigServiceImpl* GetConfigService() const;
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
29eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  net::ProxyServer CreateProxyServerFromHost(
302a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      const std::string& host,
312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)      const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy,
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      net::ProxyServer::Scheme scheme) const;
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  net::ProxyServer CreateProxyServerFromPort(
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      uint16 port,
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy,
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      net::ProxyServer::Scheme scheme) const;
385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  Value* CreateServerHostValue(
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy) const;
415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  Value* CreateServerPortValue(
435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)      const ProxyConfigServiceImpl::ProxyConfig::ManualProxy& proxy) const;
445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)  DISALLOW_COPY_AND_ASSIGN(ProxyCrosSettingsProvider);
465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)};
475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}  // namespace chromeos
495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
502a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#endif  // CHROME_BROWSER_CHROMEOS_PROXY_CROS_SETTINGS_PROVIDER_H_
512a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)