summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authoralexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-17 00:34:10 +0000
committeralexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-17 00:34:10 +0000
commita47c03d61f79089a5d39b22fe8a1477258f21532 (patch)
tree8e56affb1086016fc9d90ccee64340caf957704d /remoting
parentfdebd1bc5cec5a4bf0d307a521d06cea77f62941 (diff)
downloadchromium_src-a47c03d61f79089a5d39b22fe8a1477258f21532.zip
chromium_src-a47c03d61f79089a5d39b22fe8a1477258f21532.tar.gz
chromium_src-a47c03d61f79089a5d39b22fe8a1477258f21532.tar.bz2
Log Gaia response codes and Gaia-related networking activity to ease diagnostics of Gaia issues.
Review URL: http://codereview.chromium.org/10069020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@132493 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r--remoting/host/gaia_oauth_client.cc6
-rw-r--r--remoting/host/url_request_context.cc7
-rw-r--r--remoting/host/url_request_context.h2
-rw-r--r--remoting/host/vlog_net_log.cc59
-rw-r--r--remoting/host/vlog_net_log.h44
-rw-r--r--remoting/host/wts_session_process_launcher_win.cc4
-rw-r--r--remoting/remoting.gyp3
7 files changed, 122 insertions, 3 deletions
diff --git a/remoting/host/gaia_oauth_client.cc b/remoting/host/gaia_oauth_client.cc
index 0412ae0..63c7869 100644
--- a/remoting/host/gaia_oauth_client.cc
+++ b/remoting/host/gaia_oauth_client.cc
@@ -135,6 +135,7 @@ void GaiaOAuthClient::Core::HandleResponse(
// RC_BAD_REQUEST means the arguments are invalid. No point retrying. We are
// done here.
if (source->GetResponseCode() == net::HTTP_BAD_REQUEST) {
+ LOG(ERROR) << "Gaia response: response code=net::HTTP_BAD_REQUEST.";
delegate_->OnOAuthError();
return;
}
@@ -153,6 +154,11 @@ void GaiaOAuthClient::Core::HandleResponse(
response_dict->GetString(kRefreshTokenValue, &refresh_token);
response_dict->GetInteger(kExpiresInValue, &expires_in_seconds);
}
+ VLOG(1) << "Gaia response: acess_token='" << access_token
+ << "', refresh_token='" << refresh_token
+ << "', expires in " << expires_in_seconds << " second(s)";
+ } else {
+ LOG(ERROR) << "Gaia response: response code=" << source->GetResponseCode();
}
if (access_token.empty()) {
// If we don't have an access token yet and the the error was not
diff --git a/remoting/host/url_request_context.cc b/remoting/host/url_request_context.cc
index 39c4974..83451a7 100644
--- a/remoting/host/url_request_context.cc
+++ b/remoting/host/url_request_context.cc
@@ -22,12 +22,14 @@ namespace remoting {
URLRequestContext::URLRequestContext(
net::ProxyConfigService* proxy_config_service)
: ALLOW_THIS_IN_INITIALIZER_LIST(storage_(this)) {
+ net_log_.reset(new VlogNetLog());
+
storage_.set_host_resolver(
net::CreateSystemHostResolver(net::HostResolver::kDefaultParallelism,
net::HostResolver::kDefaultRetryAttempts,
- NULL));
+ net_log_.get()));
storage_.set_proxy_service(net::ProxyService::CreateUsingSystemProxyResolver(
- proxy_config_service, 0u, NULL));
+ proxy_config_service, 0u, net_log_.get()));
storage_.set_cert_verifier(net::CertVerifier::CreateDefault());
storage_.set_ssl_config_service(new net::SSLConfigServiceDefaults);
storage_.set_http_auth_handler_factory(
@@ -41,6 +43,7 @@ URLRequestContext::URLRequestContext(
session_params.ssl_config_service = ssl_config_service();
session_params.http_auth_handler_factory = http_auth_handler_factory();
session_params.http_server_properties = http_server_properties();
+ session_params.net_log = net_log_.get();
scoped_refptr<net::HttpNetworkSession> network_session(
new net::HttpNetworkSession(session_params));
storage_.set_http_transaction_factory(
diff --git a/remoting/host/url_request_context.h b/remoting/host/url_request_context.h
index a43d10d..1a5cecb 100644
--- a/remoting/host/url_request_context.h
+++ b/remoting/host/url_request_context.h
@@ -14,6 +14,7 @@
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_getter.h"
#include "net/url_request/url_request_context_storage.h"
+#include "remoting/host/vlog_net_log.h"
namespace base {
class MessageLoopProxy;
@@ -32,6 +33,7 @@ class URLRequestContext : public net::URLRequestContext {
virtual ~URLRequestContext();
net::URLRequestContextStorage storage_;
+ scoped_ptr<VlogNetLog> net_log_;
DISALLOW_COPY_AND_ASSIGN(URLRequestContext);
};
diff --git a/remoting/host/vlog_net_log.cc b/remoting/host/vlog_net_log.cc
new file mode 100644
index 0000000..f273b09
--- /dev/null
+++ b/remoting/host/vlog_net_log.cc
@@ -0,0 +1,59 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "remoting/host/vlog_net_log.h"
+
+#include "base/json/json_writer.h"
+#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/time.h"
+#include "base/threading/thread_restrictions.h"
+#include "base/values.h"
+
+namespace remoting {
+
+VlogNetLog::VlogNetLog() : id_(0) {
+}
+
+VlogNetLog::~VlogNetLog() {
+}
+
+void VlogNetLog::AddEntry(
+ EventType type,
+ const Source& source,
+ EventPhase phase,
+ const scoped_refptr<EventParameters>& params) {
+ if (VLOG_IS_ON(4)) {
+ scoped_ptr<Value> value(
+ net::NetLog::EntryToDictionaryValue(
+ type, base::TimeTicks::Now(), source, phase, params, false));
+ std::string json;
+ base::JSONWriter::Write(value.get(), &json);
+ VLOG(4) << json;
+ }
+}
+
+uint32 VlogNetLog::NextID() {
+ return id_++;
+}
+
+net::NetLog::LogLevel VlogNetLog::GetLogLevel() const {
+ return LOG_ALL_BUT_BYTES;
+}
+
+void VlogNetLog::AddThreadSafeObserver(ThreadSafeObserver* observer,
+ net::NetLog::LogLevel log_level) {
+ NOTIMPLEMENTED();
+}
+
+void VlogNetLog::SetObserverLogLevel(ThreadSafeObserver* observer,
+ net::NetLog::LogLevel log_level) {
+ NOTIMPLEMENTED();
+}
+
+void VlogNetLog::RemoveThreadSafeObserver(ThreadSafeObserver* observer) {
+ NOTIMPLEMENTED();
+}
+
+} // namespace remoting
diff --git a/remoting/host/vlog_net_log.h b/remoting/host/vlog_net_log.h
new file mode 100644
index 0000000..eae349b
--- /dev/null
+++ b/remoting/host/vlog_net_log.h
@@ -0,0 +1,44 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef REMOTING_HOST_VLOG_NET_LOG_H_
+#define REMOTING_HOST_VLOG_NET_LOG_H_
+
+#include "base/memory/scoped_handle.h"
+#include "net/base/net_log.h"
+
+namespace remoting {
+
+// Redirectes all networking events (i.e. events logged through net::NetLog) to
+// VLOG(4). Note that an explicit reference to a net::NetLog object has to be
+// passed to networking classes to receive the events. There is no global
+// network events logger exists.
+class VlogNetLog : public net::NetLog {
+ public:
+ VlogNetLog();
+ virtual ~VlogNetLog();
+
+ // NetLog overrides:
+ virtual void AddEntry(
+ EventType type,
+ const Source& source,
+ EventPhase phase,
+ const scoped_refptr<NetLog::EventParameters>& params) OVERRIDE;
+ virtual uint32 NextID() OVERRIDE;
+ virtual LogLevel GetLogLevel() const OVERRIDE;
+ virtual void AddThreadSafeObserver(ThreadSafeObserver* observer,
+ LogLevel log_level) OVERRIDE;
+ virtual void SetObserverLogLevel(ThreadSafeObserver* observer,
+ LogLevel log_level) OVERRIDE;
+ virtual void RemoveThreadSafeObserver(ThreadSafeObserver* observer) OVERRIDE;
+
+ private:
+ uint32 id_;
+
+ DISALLOW_COPY_AND_ASSIGN(VlogNetLog);
+};
+
+} // namespace remoting
+
+#endif // REMOTING_HOST_VLOG_NET_LOG_H_
diff --git a/remoting/host/wts_session_process_launcher_win.cc b/remoting/host/wts_session_process_launcher_win.cc
index eced4f5..c417144 100644
--- a/remoting/host/wts_session_process_launcher_win.cc
+++ b/remoting/host/wts_session_process_launcher_win.cc
@@ -11,6 +11,7 @@
#include <sddl.h>
#include <limits>
+#include "base/base_switches.h"
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/command_line.h"
@@ -56,7 +57,8 @@ const char kChromotingIpcSwitchName[] = "chromoting-ipc";
// The command line parameters that should be copied from the service's command
// line to the host process.
-const char* kCopiedSwitchNames[] = { "auth-config", "host-config" };
+const char* kCopiedSwitchNames[] = {
+ "auth-config", "host-config", switches::kV, switches::kVModule };
// The security descriptor of the Chromoting IPC channel. It gives full access
// to LocalSystem and denies access by anyone else.
diff --git a/remoting/remoting.gyp b/remoting/remoting.gyp
index e1ae91d..f440327 100644
--- a/remoting/remoting.gyp
+++ b/remoting/remoting.gyp
@@ -297,6 +297,7 @@
'variables': { 'enable_wexit_time_destructors': 1, },
'dependencies': [
'../base/base.gyp:base',
+ '../base/base.gyp:base_static',
'../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
'../ipc/ipc.gyp:ipc',
'remoting_version_resources',
@@ -893,6 +894,8 @@
'host/user_authenticator_linux.cc',
'host/user_authenticator_mac.cc',
'host/user_authenticator_win.cc',
+ 'host/vlog_net_log.cc',
+ 'host/vlog_net_log.h',
],
'conditions': [
['toolkit_uses_gtk == 1', {