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

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: nit - alphabetize 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
« no previous file with comments | « chrome/browser/prefs/proxy_prefs.h ('k') | chrome/browser/prefs/proxy_prefs_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
12 // These names are exposed to the proxy extension API. They must be in sync
13 // with the constants of ProxyPrefs.
14 const char* kProxyModeNames[] = { "direct",
15 "auto_detect",
16 "pac_script",
17 "fixed_servers",
18 "system" };
19
20 } // namespace
21
22 namespace ProxyPrefs {
23
24 COMPILE_ASSERT(arraysize(kProxyModeNames) == kModeCount,
25 kProxyModeNames_must_have_size_of_NUM_MODES);
26
27 bool IntToProxyMode(int in_value, ProxyMode* out_value) {
28 DCHECK(out_value);
29 if (in_value < 0 || in_value >= kModeCount)
30 return false;
31 *out_value = static_cast<ProxyMode>(in_value);
32 return true;
33 }
34
35 // static
36 bool StringToProxyMode(const std::string& in_value, ProxyMode* out_value) {
37 DCHECK(out_value);
38 for (int i = 0; i < kModeCount; i++) {
39 if (in_value == kProxyModeNames[i])
40 return IntToProxyMode(i, out_value);
41 }
42 return false;
43 }
44
45 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/prefs/proxy_prefs.h ('k') | chrome/browser/prefs/proxy_prefs_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698