| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 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 // Defines the Chrome Extensions Proxy Settings API relevant classes to realize | |
| 6 // the API as specified in the extension API JSON. | |
| 7 | |
| 8 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_PROXY_API_H_ | |
| 9 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_PROXY_API_H_ | |
| 10 | |
| 11 #include <string> | |
| 12 | |
| 13 #include "base/memory/singleton.h" | |
| 14 #include "base/string16.h" | |
| 15 #include "chrome/browser/extensions/extension_preference_api.h" | |
| 16 #include "chrome/browser/prefs/proxy_prefs.h" | |
| 17 | |
| 18 class ExtensionEventRouterForwarder; | |
| 19 | |
| 20 namespace base { | |
| 21 class Value; | |
| 22 } | |
| 23 | |
| 24 // Class to convert between the representation of proxy settings used | |
| 25 // in the Proxy Settings API and the representation used in the PrefStores. | |
| 26 // This plugs into the ExtensionPreferenceAPI to get and set proxy settings. | |
| 27 class ProxyPrefTransformer : public PrefTransformerInterface { | |
| 28 public: | |
| 29 ProxyPrefTransformer(); | |
| 30 virtual ~ProxyPrefTransformer(); | |
| 31 | |
| 32 // Implementation of PrefTransformerInterface. | |
| 33 virtual base::Value* ExtensionToBrowserPref(const base::Value* extension_pref, | |
| 34 std::string* error, | |
| 35 bool* bad_message) OVERRIDE; | |
| 36 virtual base::Value* BrowserToExtensionPref( | |
| 37 const base::Value* browser_pref) OVERRIDE; | |
| 38 | |
| 39 private: | |
| 40 DISALLOW_COPY_AND_ASSIGN(ProxyPrefTransformer); | |
| 41 }; | |
| 42 | |
| 43 // This class observes proxy error events and routes them to the appropriate | |
| 44 // extensions listening to those events. All methods must be called on the IO | |
| 45 // thread unless otherwise specified. | |
| 46 class ExtensionProxyEventRouter { | |
| 47 public: | |
| 48 static ExtensionProxyEventRouter* GetInstance(); | |
| 49 | |
| 50 void OnProxyError(ExtensionEventRouterForwarder* event_router, | |
| 51 void* profile, | |
| 52 int error_code); | |
| 53 | |
| 54 void OnPACScriptError(ExtensionEventRouterForwarder* event_router, | |
| 55 void* profile, | |
| 56 int line_number, | |
| 57 const string16& error); | |
| 58 | |
| 59 private: | |
| 60 friend struct DefaultSingletonTraits<ExtensionProxyEventRouter>; | |
| 61 | |
| 62 ExtensionProxyEventRouter(); | |
| 63 ~ExtensionProxyEventRouter(); | |
| 64 | |
| 65 DISALLOW_COPY_AND_ASSIGN(ExtensionProxyEventRouter); | |
| 66 }; | |
| 67 | |
| 68 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_PROXY_API_H_ | |
| OLD | NEW |