| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Implementation of the Chrome Extensions Proxy Settings API. | 5 // Implementation of the Chrome Extensions Proxy Settings API. |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/api/proxy/proxy_api.h" | 7 #include "chrome/browser/extensions/api/proxy/proxy_api.h" |
| 8 | 8 |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 } | 34 } |
| 35 | 35 |
| 36 void ProxyEventRouter::OnProxyError( | 36 void ProxyEventRouter::OnProxyError( |
| 37 EventRouterForwarder* event_router, | 37 EventRouterForwarder* event_router, |
| 38 void* profile, | 38 void* profile, |
| 39 int error_code) { | 39 int error_code) { |
| 40 scoped_ptr<ListValue> args(new ListValue()); | 40 scoped_ptr<ListValue> args(new ListValue()); |
| 41 DictionaryValue* dict = new DictionaryValue(); | 41 DictionaryValue* dict = new DictionaryValue(); |
| 42 dict->SetBoolean(keys::kProxyEventFatal, true); | 42 dict->SetBoolean(keys::kProxyEventFatal, true); |
| 43 dict->SetString(keys::kProxyEventError, net::ErrorToString(error_code)); | 43 dict->SetString(keys::kProxyEventError, net::ErrorToString(error_code)); |
| 44 dict->SetString(keys::kProxyEventDetails, ""); | 44 dict->SetString(keys::kProxyEventDetails, std::string()); |
| 45 args->Append(dict); | 45 args->Append(dict); |
| 46 | 46 |
| 47 if (profile) { | 47 if (profile) { |
| 48 event_router->DispatchEventToRenderers( | 48 event_router->DispatchEventToRenderers( |
| 49 keys::kProxyEventOnProxyError, args.Pass(), profile, true, GURL()); | 49 keys::kProxyEventOnProxyError, args.Pass(), profile, true, GURL()); |
| 50 } else { | 50 } else { |
| 51 event_router->BroadcastEventToRenderers( | 51 event_router->BroadcastEventToRenderers( |
| 52 keys::kProxyEventOnProxyError, args.Pass(), GURL()); | 52 keys::kProxyEventOnProxyError, args.Pass(), GURL()); |
| 53 } | 53 } |
| 54 } | 54 } |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 extension_pref->Set(keys::kProxyConfigRules, proxy_rules_dict); | 173 extension_pref->Set(keys::kProxyConfigRules, proxy_rules_dict); |
| 174 break; | 174 break; |
| 175 } | 175 } |
| 176 case ProxyPrefs::kModeCount: | 176 case ProxyPrefs::kModeCount: |
| 177 NOTREACHED(); | 177 NOTREACHED(); |
| 178 } | 178 } |
| 179 return extension_pref.release(); | 179 return extension_pref.release(); |
| 180 } | 180 } |
| 181 | 181 |
| 182 } // namespace extensions | 182 } // namespace extensions |
| OLD | NEW |