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

Unified Diff: remoting/host/setup/oauth_helper.cc

Issue 11185037: [Chromoting] Let the Linux start-host app take a redirect-URL parameter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Windows include. Created 8 years, 2 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/setup/oauth_helper.h ('k') | remoting/host/setup/oauth_helper_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..6f110f6c2214af2ec5aa37dbc02c80252b462501 100644
--- a/remoting/host/setup/oauth_helper.cc
+++ b/remoting/host/setup/oauth_helper.cc
@@ -30,39 +30,40 @@ std::string GetOauthScope() {
"https://www.googleapis.com/auth/userinfo.email ";
}
-std::string GetOauthStartUrl() {
- return base::StringPrintf(
- "https://accounts.google.com/o/oauth2/auth"
- "?scope=%s"
- "&redirect_uri=%s"
- "&response_type=code"
- "&client_id=%s"
- "&access_type=offline"
- "&approval_prompt=force",
- net::EscapeUrlEncodedData(GetOauthScope(), true).c_str(),
- net::EscapeUrlEncodedData(GetOauthRedirectUrl(), true).c_str(),
- net::EscapeUrlEncodedData(google_apis::GetOAuth2ClientID(
- google_apis::CLIENT_REMOTING), true).c_str());
+std::string GetDefaultOauthRedirectUrl() {
+ return
+ "https://chromoting-oauth.talkgadget.google.com/talkgadget/oauth/"
+ "chrome-remote-desktop/rel/kgngmbheleoaphbjbaiobfdepmghbfah";
}
-std::string GetOauthRedirectUrl() {
- return
- "https://chromoting-oauth.talkgadget.google.com/talkgadget/oauth/"
- "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"
+ "&redirect_uri=%s"
+ "&response_type=code"
+ "&client_id=%s"
+ "&access_type=offline"
+ "&approval_prompt=force",
+ net::EscapeUrlEncodedData(GetOauthScope(), true).c_str(),
+ redirect_url.c_str(),
+ net::EscapeUrlEncodedData(google_apis::GetOAuth2ClientID(
+ google_apis::CLIENT_REMOTING), true).c_str());
}
-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(),
+ &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;
« no previous file with comments | « remoting/host/setup/oauth_helper.h ('k') | remoting/host/setup/oauth_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698