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

Side by Side Diff: chrome/browser/signin/signin_header_helper.cc

Issue 597603003: Open continue url from gaia incognito header (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: url-decode header value Created 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium 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 "chrome/browser/signin/signin_header_helper.h" 5 #include "chrome/browser/signin/signin_header_helper.h"
6 6
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "chrome/browser/prefs/incognito_mode_prefs.h" 10 #include "chrome/browser/prefs/incognito_mode_prefs.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 const std::string& header_value) { 70 const std::string& header_value) {
71 std::vector<std::string> fields; 71 std::vector<std::string> fields;
72 if (!Tokenize(header_value, std::string(","), &fields)) 72 if (!Tokenize(header_value, std::string(","), &fields))
73 return MirrorResponseHeaderDictionary(); 73 return MirrorResponseHeaderDictionary();
74 74
75 MirrorResponseHeaderDictionary dictionary; 75 MirrorResponseHeaderDictionary dictionary;
76 for (std::vector<std::string>::iterator i = fields.begin(); 76 for (std::vector<std::string>::iterator i = fields.begin();
77 i != fields.end(); ++i) { 77 i != fields.end(); ++i) {
78 std::string field(*i); 78 std::string field(*i);
79 std::vector<std::string> tokens; 79 std::vector<std::string> tokens;
80 if (Tokenize(field, "=", &tokens) != 2) { 80 size_t delim = field.find_first_of('=');
81 if (delim == std::string::npos) {
81 DLOG(WARNING) << "Unexpected GAIA header field '" << field << "'."; 82 DLOG(WARNING) << "Unexpected GAIA header field '" << field << "'.";
82 continue; 83 continue;
83 } 84 }
84 dictionary[tokens[0]] = tokens[1]; 85 dictionary[field.substr(0, delim)] = net::UnescapeURLComponent(
86 field.substr(delim + 1), net::UnescapeRule::URL_SPECIAL_CHARS);
85 } 87 }
86 return dictionary; 88 return dictionary;
87 } 89 }
88 90
89 // Returns the parameters contained in the X-Chrome-Manage-Accounts response 91 // Returns the parameters contained in the X-Chrome-Manage-Accounts response
90 // header. 92 // header.
91 signin::ManageAccountsParams BuildManageAccountsParams( 93 signin::ManageAccountsParams BuildManageAccountsParams(
92 const std::string& header_value) { 94 const std::string& header_value) {
93 signin::ManageAccountsParams params; 95 signin::ManageAccountsParams params;
94 MirrorResponseHeaderDictionary header_dictionary = 96 MirrorResponseHeaderDictionary header_dictionary =
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 135
134 #if !defined(OS_ANDROID) 136 #if !defined(OS_ANDROID)
135 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); 137 Browser* browser = chrome::FindBrowserWithWebContents(web_contents);
136 if (browser) { 138 if (browser) {
137 BrowserWindow::AvatarBubbleMode bubble_mode; 139 BrowserWindow::AvatarBubbleMode bubble_mode;
138 switch (service_type) { 140 switch (service_type) {
139 case signin::GAIA_SERVICE_TYPE_INCOGNITO: 141 case signin::GAIA_SERVICE_TYPE_INCOGNITO:
140 chrome::NewIncognitoWindow(browser); 142 chrome::NewIncognitoWindow(browser);
141 return; 143 return;
142 case signin::GAIA_SERVICE_TYPE_ADDSESSION: 144 case signin::GAIA_SERVICE_TYPE_ADDSESSION:
143 bubble_mode = BrowserWindow::AVATAR_BUBBLE_MODE_SIGNIN; 145 bubble_mode = BrowserWindow::AVATAR_BUBBLE_MODE_ADD_ACCOUNT;
144 break; 146 break;
145 case signin::GAIA_SERVICE_TYPE_REAUTH: 147 case signin::GAIA_SERVICE_TYPE_REAUTH:
146 bubble_mode = BrowserWindow::AVATAR_BUBBLE_MODE_REAUTH; 148 bubble_mode = BrowserWindow::AVATAR_BUBBLE_MODE_REAUTH;
147 break; 149 break;
148 default: 150 default:
149 bubble_mode = BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT; 151 bubble_mode = BrowserWindow::AVATAR_BUBBLE_MODE_ACCOUNT_MANAGEMENT;
150 } 152 }
151 browser->window()->ShowAvatarBubbleFromAvatarButton( 153 browser->window()->ShowAvatarBubbleFromAvatarButton(
152 bubble_mode, manage_accounts_params); 154 bubble_mode, manage_accounts_params);
153 } 155 }
154 #else // defined(OS_ANDROID) 156 #else // defined(OS_ANDROID)
155 if (service_type == signin::GAIA_SERVICE_TYPE_INCOGNITO) { 157 if (service_type == signin::GAIA_SERVICE_TYPE_INCOGNITO) {
158 GURL url(manage_accounts_params.continue_url.empty() ?
159 chrome::kChromeUINativeNewTabURL :
160 manage_accounts_params.continue_url);
156 web_contents->OpenURL(content::OpenURLParams( 161 web_contents->OpenURL(content::OpenURLParams(
157 GURL(chrome::kChromeUINativeNewTabURL), content::Referrer(), 162 url, content::Referrer(), OFF_THE_RECORD,
158 OFF_THE_RECORD, ui::PAGE_TRANSITION_AUTO_TOPLEVEL, false)); 163 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, false));
159 } else { 164 } else {
160 AccountManagementScreenHelper::OpenAccountManagementScreen( 165 AccountManagementScreenHelper::OpenAccountManagementScreen(
161 Profile::FromBrowserContext(web_contents->GetBrowserContext()), 166 Profile::FromBrowserContext(web_contents->GetBrowserContext()),
162 service_type); 167 service_type);
163 } 168 }
164 #endif // OS_ANDROID 169 #endif // OS_ANDROID
165 } 170 }
166 #endif // !defined(OS_IOS) 171 #endif // !defined(OS_IOS)
167 172
168 bool IsDriveOrigin(const GURL& url) { 173 bool IsDriveOrigin(const GURL& url) {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 279
275 params.child_id = child_id; 280 params.child_id = child_id;
276 params.route_id = route_id; 281 params.route_id = route_id;
277 content::BrowserThread::PostTask( 282 content::BrowserThread::PostTask(
278 content::BrowserThread::UI, FROM_HERE, 283 content::BrowserThread::UI, FROM_HERE,
279 base::Bind(ProcessMirrorHeaderUIThread, child_id, route_id, params)); 284 base::Bind(ProcessMirrorHeaderUIThread, child_id, route_id, params));
280 #endif // defined(OS_IOS) 285 #endif // defined(OS_IOS)
281 } 286 }
282 287
283 } // namespace signin 288 } // namespace signin
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698