| Index: chrome/browser/prefs/proxy_prefs.cc
|
| diff --git a/chrome/browser/prefs/proxy_prefs.cc b/chrome/browser/prefs/proxy_prefs.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..8d01f1e2791092eb1ab367e9d52d9e7a044cfde0
|
| --- /dev/null
|
| +++ b/chrome/browser/prefs/proxy_prefs.cc
|
| @@ -0,0 +1,51 @@
|
| +// Copyright (c) 2010 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "chrome/browser/prefs/proxy_prefs.h"
|
| +
|
| +#include "base/logging.h"
|
| +
|
| +// static
|
| +bool ProxyPrefs::IntToMode(
|
| + int in_value,
|
| + ProxyPrefs::ProxyServerMode* out_value) {
|
| + DCHECK(out_value);
|
| + if (in_value == ProxyPrefs::DISABLED) {
|
| + *out_value = ProxyPrefs::DISABLED;
|
| + return true;
|
| + } else if (in_value == ProxyPrefs::SYSTEM) {
|
| + *out_value = ProxyPrefs::SYSTEM;
|
| + return true;
|
| + } else if (in_value == ProxyPrefs::AUTO_DETECT) {
|
| + *out_value = ProxyPrefs::AUTO_DETECT;
|
| + return true;
|
| + } else if (in_value == ProxyPrefs::MANUAL) {
|
| + *out_value = ProxyPrefs::MANUAL;
|
| + return true;
|
| + } else {
|
| + return false;
|
| + }
|
| +}
|
| +
|
| +// static
|
| +bool ProxyPrefs::StringToMode(
|
| + const std::string& in_value,
|
| + ProxyPrefs::ProxyServerMode* out_value) {
|
| + DCHECK(out_value);
|
| + if (in_value == "disable") {
|
| + *out_value = ProxyPrefs::DISABLED;
|
| + return true;
|
| + } else if (in_value == "system") {
|
| + *out_value = ProxyPrefs::SYSTEM;
|
| + return true;
|
| + } else if (in_value == "auto_detect") {
|
| + *out_value = ProxyPrefs::AUTO_DETECT;
|
| + return true;
|
| + } else if (in_value == "manual") {
|
| + *out_value = ProxyPrefs::MANUAL;
|
| + return true;
|
| + } else {
|
| + return false;
|
| + }
|
| +}
|
|
|