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

Side by Side Diff: chrome_browser_proxy_resolver.cc

Issue 6681042: AU: Handle inability to get proxy servers from Chrome better. (Closed) Base URL: http://git.chromium.org/git/update_engine.git@master
Patch Set: fix warning Created 9 years, 9 months 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 | « no previous file | chrome_browser_proxy_resolver_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
1 // Copyright (c) 2011 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium OS 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 #include "update_engine/chrome_browser_proxy_resolver.h" 5 #include "update_engine/chrome_browser_proxy_resolver.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include <base/string_tokenizer.h> 10 #include <base/string_tokenizer.h>
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 ++it) { 121 ++it) {
122 g_source_destroy(it->second); 122 g_source_destroy(it->second);
123 it->second = NULL; 123 it->second = NULL;
124 } 124 }
125 } 125 }
126 126
127 bool ChromeBrowserProxyResolver::GetProxiesForUrl(const string& url, 127 bool ChromeBrowserProxyResolver::GetProxiesForUrl(const string& url,
128 ProxiesResolvedFn callback, 128 ProxiesResolvedFn callback,
129 void* data) { 129 void* data) {
130 GError* error = NULL; 130 GError* error = NULL;
131 TEST_AND_RETURN_FALSE(proxy_); 131 guint timeout = timeout_;
132 if (!dbus_->ProxyCall( 132 if (!proxy_ || !dbus_->ProxyCall(
133 proxy_, 133 proxy_,
134 kLibCrosServiceResolveNetworkProxyMethodName, 134 kLibCrosServiceResolveNetworkProxyMethodName,
135 &error, 135 &error,
136 G_TYPE_STRING, url.c_str(), 136 G_TYPE_STRING, url.c_str(),
137 G_TYPE_STRING, kLibCrosProxyResolveSignalInterface, 137 G_TYPE_STRING, kLibCrosProxyResolveSignalInterface,
138 G_TYPE_STRING, kLibCrosProxyResolveName, 138 G_TYPE_STRING, kLibCrosProxyResolveName,
139 G_TYPE_INVALID, G_TYPE_INVALID)) { 139 G_TYPE_INVALID, G_TYPE_INVALID)) {
140 LOG(ERROR) << "dbus_g_proxy_call failed: " 140 LOG(WARNING) << "dbus_g_proxy_call failed: "
141 << utils::GetGErrorMessage(error); 141 << utils::GetGErrorMessage(error)
142 return false; 142 << " Continuing with no proxy.";
143 timeout = 0;
143 } 144 }
144 callbacks_.insert(make_pair(url, make_pair(callback, data))); 145 callbacks_.insert(make_pair(url, make_pair(callback, data)));
145 Closure* closure = NewCallback(this, 146 Closure* closure = NewCallback(this,
146 &ChromeBrowserProxyResolver::HandleTimeout, 147 &ChromeBrowserProxyResolver::HandleTimeout,
147 url); 148 url);
148 GSource* timer = g_timeout_source_new_seconds(timeout_); 149 GSource* timer = g_timeout_source_new_seconds(timeout);
149 g_source_set_callback(timer, &utils::GlibRunClosure, closure, NULL); 150 g_source_set_callback(timer, &utils::GlibRunClosure, closure, NULL);
150 g_source_attach(timer, NULL); 151 g_source_attach(timer, NULL);
151 timers_.insert(make_pair(url, timer)); 152 timers_.insert(make_pair(url, timer));
152 return true; 153 return true;
153 } 154 }
154 155
155 DBusHandlerResult ChromeBrowserProxyResolver::FilterMessage( 156 DBusHandlerResult ChromeBrowserProxyResolver::FilterMessage(
156 DBusConnection* connection, 157 DBusConnection* connection,
157 DBusMessage* message) { 158 DBusMessage* message) {
158 // Code lifted from libcros. 159 // Code lifted from libcros.
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 if (scheme != "direct" && host_and_port.empty()) 260 if (scheme != "direct" && host_and_port.empty())
260 continue; // Must supply host/port when non-direct proxy used. 261 continue; // Must supply host/port when non-direct proxy used.
261 ret.push_back(scheme + "://" + host_and_port); 262 ret.push_back(scheme + "://" + host_and_port);
262 } 263 }
263 if (ret.empty() || *ret.rbegin() != kNoProxy) 264 if (ret.empty() || *ret.rbegin() != kNoProxy)
264 ret.push_back(kNoProxy); 265 ret.push_back(kNoProxy);
265 return ret; 266 return ret;
266 } 267 }
267 268
268 } // namespace chromeos_update_engine 269 } // namespace chromeos_update_engine
OLDNEW
« no previous file with comments | « no previous file | chrome_browser_proxy_resolver_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698