Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(280)

Side by Side Diff: chrome/browser/prefs/proxy_prefs.cc

Issue 6004003: Introduce a separate preference for 'proxy server mode' (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Extraction undone - as per Mattias' request Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2010 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 #include "chrome/browser/prefs/proxy_prefs.h"
6
7 #include "base/basictypes.h"
8 #include "base/logging.h"
9
10 namespace {
11 // These names are exposed to the proxy extension API. They must be in sync
eroman 2010/12/21 22:55:21 nit: don't indent within the namespace.
battre 2010/12/22 10:01:27 Done.
12 // with the constants of ProxyPrefs.
13 const char* kProxyModeNames[] = { "disabled",
14 "auto_detect",
15 "pac_script",
16 "fixed_servers",
17 "system" };
18 } // namespace
19
20 namespace ProxyPrefs {
21
22 COMPILE_ASSERT(arraysize(kProxyModeNames) == NUM_MODES,
23 kProxyModeNames_must_have_size_of_NUM_MODES);
24
25 bool IntToProxyMode(int in_value, ProxyMode* out_value) {
26 DCHECK(out_value);
27 if (in_value < 0 || in_value >= NUM_MODES)
28 return false;
29 *out_value = static_cast<ProxyMode>(in_value);
30 return true;
31 }
32
33 // static
34 bool StringToProxyMode(const std::string& in_value, ProxyMode* out_value) {
35 DCHECK(out_value);
36 for (int i = 0; i < NUM_MODES; i++) {
37 if (in_value == kProxyModeNames[i])
38 return IntToProxyMode(i, out_value);
39 }
40 return false;
41 }
42
43 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698