Chromium Code Reviews| Index: remoting/host/setup/oauth_helper.cc |
| diff --git a/remoting/host/setup/oauth_helper.cc b/remoting/host/setup/oauth_helper.cc |
| index 3228384fd0864de9bd5387f6bfa66fdb3a8450be..dfa53ed290a72be333f5e1eb98614692fe7f2099 100644 |
| --- a/remoting/host/setup/oauth_helper.cc |
| +++ b/remoting/host/setup/oauth_helper.cc |
| @@ -30,7 +30,13 @@ std::string GetOauthScope() { |
| "https://www.googleapis.com/auth/userinfo.email "; |
| } |
| -std::string GetOauthStartUrl() { |
| +std::string GetDefaultOauthRedirectUrl() { |
| + return |
| + "https://chromoting-oauth.talkgadget.google.com/talkgadget/oauth/" |
|
Sergey Ulanov
2012/10/17 23:41:36
nit: indent 4 spaces.
simonmorris
2012/10/18 00:10:09
Done.
|
| + "chrome-remote-desktop/rel/kgngmbheleoaphbjbaiobfdepmghbfah"; |
| +} |
| + |
| +std::string GetOauthStartUrl(const std::string& redirect_url) { |
| return base::StringPrintf( |
| "https://accounts.google.com/o/oauth2/auth" |
| "?scope=%s" |
| @@ -40,29 +46,24 @@ std::string GetOauthStartUrl() { |
| "&access_type=offline" |
| "&approval_prompt=force", |
| net::EscapeUrlEncodedData(GetOauthScope(), true).c_str(), |
| - net::EscapeUrlEncodedData(GetOauthRedirectUrl(), true).c_str(), |
| + redirect_url.c_str(), |
| net::EscapeUrlEncodedData(google_apis::GetOAuth2ClientID( |
| google_apis::CLIENT_REMOTING), true).c_str()); |
| } |
| -std::string GetOauthRedirectUrl() { |
| - return |
| - "https://chromoting-oauth.talkgadget.google.com/talkgadget/oauth/" |
| - "chrome-remote-desktop/rel/kgngmbheleoaphbjbaiobfdepmghbfah"; |
| -} |
| - |
| -std::string GetOauthCodeInUrl(const std::string& url) { |
| +std::string GetOauthCodeInUrl(const std::string& url, |
| + const std::string& redirect_url) { |
| url_parse::Parsed url_parsed; |
| ParseStandardURL(url.c_str(), url.length(), &url_parsed); |
| - std::string redirect = GetOauthRedirectUrl(); |
| - url_parse::Parsed redirect_parsed; |
| - ParseStandardURL(redirect.c_str(), redirect.length(), &redirect_parsed); |
| + url_parse::Parsed redirect_url_parsed; |
| + ParseStandardURL(redirect_url.c_str(), redirect_url.length(), |
|
Sergey Ulanov
2012/10/17 23:41:36
nit: indentation.
simonmorris
2012/10/18 00:10:09
I don't see what's wrong here.
Sergey Ulanov
2012/10/18 18:46:51
This line is indented 2 spaces relative to the pre
simonmorris
2012/10/18 18:50:42
Thanks - I didn't see that when I was editing the
simonmorris
2012/10/18 20:18:15
This looks like a glitch in the side-by-side diffs
|
| + &redirect_url_parsed); |
| if (GetComponent(url, url_parsed.scheme) != |
| - GetComponent(redirect, redirect_parsed.scheme)) { |
| + GetComponent(redirect_url, redirect_url_parsed.scheme)) { |
| return ""; |
| } |
| if (GetComponent(url, url_parsed.host) != |
| - GetComponent(redirect, redirect_parsed.host)) { |
| + GetComponent(redirect_url, redirect_url_parsed.host)) { |
| return ""; |
| } |
| url_parse::Component query = url_parsed.query; |