Enable Enterprise enrollment on desktop builds.
[chromium-blink-merge.git] / chrome / browser / extensions / api / proxy / proxy_api.h
blob6d350478e37afe27c3c82b91c19e5e28d1375ac5
1 // Copyright (c) 2012 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.
5 // Defines the Chrome Extensions Proxy Settings API relevant classes to realize
6 // the API as specified in the extension API JSON.
8 #ifndef CHROME_BROWSER_EXTENSIONS_API_PROXY_PROXY_API_H_
9 #define CHROME_BROWSER_EXTENSIONS_API_PROXY_PROXY_API_H_
11 #include <string>
13 #include "base/memory/singleton.h"
14 #include "base/strings/string16.h"
15 #include "chrome/browser/extensions/api/preference/preference_api.h"
16 #include "chrome/browser/prefs/proxy_prefs.h"
18 namespace base {
19 class Value;
22 namespace extensions {
23 class EventRouterForwarder;
25 // Class to convert between the representation of proxy settings used
26 // in the Proxy Settings API and the representation used in the PrefStores.
27 // This plugs into the ExtensionPreferenceAPI to get and set proxy settings.
28 class ProxyPrefTransformer : public PrefTransformerInterface {
29 public:
30 ProxyPrefTransformer();
31 virtual ~ProxyPrefTransformer();
33 // Implementation of PrefTransformerInterface.
34 virtual base::Value* ExtensionToBrowserPref(const base::Value* extension_pref,
35 std::string* error,
36 bool* bad_message) OVERRIDE;
37 virtual base::Value* BrowserToExtensionPref(
38 const base::Value* browser_pref) OVERRIDE;
40 private:
41 DISALLOW_COPY_AND_ASSIGN(ProxyPrefTransformer);
44 // This class observes proxy error events and routes them to the appropriate
45 // extensions listening to those events. All methods must be called on the IO
46 // thread unless otherwise specified.
47 class ProxyEventRouter {
48 public:
49 static ProxyEventRouter* GetInstance();
51 void OnProxyError(EventRouterForwarder* event_router,
52 void* profile,
53 int error_code);
55 void OnPACScriptError(EventRouterForwarder* event_router,
56 void* profile,
57 int line_number,
58 const base::string16& error);
60 private:
61 friend struct DefaultSingletonTraits<ProxyEventRouter>;
63 ProxyEventRouter();
64 ~ProxyEventRouter();
66 DISALLOW_COPY_AND_ASSIGN(ProxyEventRouter);
69 } // namespace extensions
71 #endif // CHROME_BROWSER_EXTENSIONS_API_PROXY_PROXY_API_H_