OLD | NEW |
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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 return false; | 207 return false; |
208 } | 208 } |
209 | 209 |
210 // If signin cookies are not allowed, don't add the header. | 210 // If signin cookies are not allowed, don't add the header. |
211 if (!ChromeSigninClient::SettingsAllowSigninCookies( | 211 if (!ChromeSigninClient::SettingsAllowSigninCookies( |
212 io_data->GetCookieSettings())) { | 212 io_data->GetCookieSettings())) { |
213 return false; | 213 return false; |
214 } | 214 } |
215 | 215 |
216 // Only set the header for Drive and Gaia always, and other Google properties | 216 // Only set the header for Drive and Gaia always, and other Google properties |
217 // if new-profile-management is enabled. | 217 // if account consistency is enabled. |
218 // Vasquette, which is integrated with most Google properties, needs the | 218 // Vasquette, which is integrated with most Google properties, needs the |
219 // header to redirect certain user actions to Chrome native UI. Drive and Gaia | 219 // header to redirect certain user actions to Chrome native UI. Drive and Gaia |
220 // need the header to tell if the current user is connected. The drive path is | 220 // need the header to tell if the current user is connected. The drive path is |
221 // a temporary workaround until the more generic chrome.principals API is | 221 // a temporary workaround until the more generic chrome.principals API is |
222 // available. | 222 // available. |
223 const GURL& url = redirect_url.is_empty() ? request->url() : redirect_url; | 223 const GURL& url = redirect_url.is_empty() ? request->url() : redirect_url; |
224 GURL origin(url.GetOrigin()); | 224 GURL origin(url.GetOrigin()); |
225 bool is_enable_account_consistency = switches::IsEnableAccountConsistency(); | 225 bool is_enable_account_consistency = switches::IsEnableAccountConsistency(); |
226 bool is_google_url = | 226 bool is_google_url = |
227 !switches::IsEnableWebBasedSignin() && | |
228 is_enable_account_consistency && | 227 is_enable_account_consistency && |
229 (google_util::IsGoogleDomainUrl( | 228 (google_util::IsGoogleDomainUrl( |
230 url, | 229 url, |
231 google_util::ALLOW_SUBDOMAIN, | 230 google_util::ALLOW_SUBDOMAIN, |
232 google_util::DISALLOW_NON_STANDARD_PORTS) || | 231 google_util::DISALLOW_NON_STANDARD_PORTS) || |
233 google_util::IsYoutubeDomainUrl( | 232 google_util::IsYoutubeDomainUrl( |
234 url, | 233 url, |
235 google_util::ALLOW_SUBDOMAIN, | 234 google_util::ALLOW_SUBDOMAIN, |
236 google_util::DISALLOW_NON_STANDARD_PORTS)); | 235 google_util::DISALLOW_NON_STANDARD_PORTS)); |
237 if (!is_google_url && !IsDriveOrigin(origin) && | 236 if (!is_google_url && !IsDriveOrigin(origin) && |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 | 300 |
302 params.child_id = child_id; | 301 params.child_id = child_id; |
303 params.route_id = route_id; | 302 params.route_id = route_id; |
304 content::BrowserThread::PostTask( | 303 content::BrowserThread::PostTask( |
305 content::BrowserThread::UI, FROM_HERE, | 304 content::BrowserThread::UI, FROM_HERE, |
306 base::Bind(ProcessMirrorHeaderUIThread, child_id, route_id, params)); | 305 base::Bind(ProcessMirrorHeaderUIThread, child_id, route_id, params)); |
307 #endif // defined(OS_IOS) | 306 #endif // defined(OS_IOS) |
308 } | 307 } |
309 | 308 |
310 } // namespace signin | 309 } // namespace signin |
OLD | NEW |