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

Unified Diff: remoting/host/remoting_me2me_host.cc

Issue 10007048: Cleanup and simplify HostConfig and JsonHostConfig. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/host/plugin/daemon_controller_mac.cc ('k') | remoting/host/simple_host_process.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/remoting_me2me_host.cc
diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc
index adb79f9855ae7623879e30c543b7df3ebe13bca7..885f7a0d8aa71c0869ff7ca232dc9593331e9879 100644
--- a/remoting/host/remoting_me2me_host.cc
+++ b/remoting/host/remoting_me2me_host.cc
@@ -155,15 +155,13 @@ class HostProcess : public OAuthClient::Delegate {
// Read Host config from disk, returning true if successful.
bool LoadConfig(base::MessageLoopProxy* io_message_loop,
bool* tokens_pending) {
- scoped_refptr<JsonHostConfig> host_config =
- new JsonHostConfig(host_config_path_, io_message_loop);
- scoped_refptr<JsonHostConfig> auth_config =
- new JsonHostConfig(auth_config_path_, io_message_loop);
+ JsonHostConfig host_config(host_config_path_);
+ JsonHostConfig auth_config(auth_config_path_);
FilePath failed_path;
- if (!host_config->Read()) {
+ if (!host_config.Read()) {
failed_path = host_config_path_;
- } else if (!auth_config->Read()) {
+ } else if (!auth_config.Read()) {
failed_path = auth_config_path_;
}
if (!failed_path.empty()) {
@@ -171,7 +169,7 @@ class HostProcess : public OAuthClient::Delegate {
return false;
}
- if (!host_config->GetString(kHostIdConfigPath, &host_id_)) {
+ if (!host_config.GetString(kHostIdConfigPath, &host_id_)) {
LOG(ERROR) << "host_id is not defined in the config.";
return false;
}
@@ -181,8 +179,8 @@ class HostProcess : public OAuthClient::Delegate {
}
std::string host_secret_hash_string;
- if (!host_config->GetString(kHostSecretHashConfigPath,
- &host_secret_hash_string)) {
+ if (!host_config.GetString(kHostSecretHashConfigPath,
+ &host_secret_hash_string)) {
host_secret_hash_string = "plain:";
}
@@ -192,10 +190,10 @@ class HostProcess : public OAuthClient::Delegate {
}
// Use an XMPP connection to the Talk network for session signalling.
- if (!auth_config->GetString(kXmppLoginConfigPath, &xmpp_login_) ||
- !(auth_config->GetString(kXmppAuthTokenConfigPath, &xmpp_auth_token_) ||
- auth_config->GetString(kOAuthRefreshTokenConfigPath,
- &oauth_refresh_token_))) {
+ if (!auth_config.GetString(kXmppLoginConfigPath, &xmpp_login_) ||
+ !(auth_config.GetString(kXmppAuthTokenConfigPath, &xmpp_auth_token_) ||
+ auth_config.GetString(kOAuthRefreshTokenConfigPath,
+ &oauth_refresh_token_))) {
LOG(ERROR) << "XMPP credentials are not defined in the config.";
return false;
}
@@ -204,8 +202,8 @@ class HostProcess : public OAuthClient::Delegate {
if (*tokens_pending) {
xmpp_auth_token_ = ""; // This will be set to the access token later.
xmpp_auth_service_ = "oauth2";
- } else if (!auth_config->GetString(kXmppAuthServiceConfigPath,
- &xmpp_auth_service_)) {
+ } else if (!auth_config.GetString(kXmppAuthServiceConfigPath,
+ &xmpp_auth_service_)) {
// For the me2me host, we default to ClientLogin token for chromiumsync
// because earlier versions of the host had no HTTP stack with which to
// request an OAuth2 access token.
« no previous file with comments | « remoting/host/plugin/daemon_controller_mac.cc ('k') | remoting/host/simple_host_process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698