OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/sync/one_click_signin_helper.h" | 5 #include "chrome/browser/ui/sync/one_click_signin_helper.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 // NOTE: This should only be used for logging purposes since it relies on hard | 331 // NOTE: This should only be used for logging purposes since it relies on hard |
332 // coded URLs that could change. | 332 // coded URLs that could change. |
333 bool AreWeShowingSignin(GURL url, SyncPromoUI::Source source, | 333 bool AreWeShowingSignin(GURL url, SyncPromoUI::Source source, |
334 std::string email) { | 334 std::string email) { |
335 GURL::Replacements replacements; | 335 GURL::Replacements replacements; |
336 replacements.ClearQuery(); | 336 replacements.ClearQuery(); |
337 GURL clean_login_url = | 337 GURL clean_login_url = |
338 GURL(GaiaUrls::GetInstance()->service_login_url()).ReplaceComponents( | 338 GURL(GaiaUrls::GetInstance()->service_login_url()).ReplaceComponents( |
339 replacements); | 339 replacements); |
340 | 340 |
341 GURL clean_one_click_url = | |
342 GURL(GaiaUrls::GetInstance()->gaia_login_form_realm() + | |
343 "ChromeLoginPrompt").ReplaceComponents(replacements); | |
344 | |
345 return (url.ReplaceComponents(replacements) == clean_login_url && | 341 return (url.ReplaceComponents(replacements) == clean_login_url && |
346 source != SyncPromoUI::SOURCE_UNKNOWN) || | 342 source != SyncPromoUI::SOURCE_UNKNOWN) || |
347 (url.ReplaceComponents(replacements) == clean_one_click_url && | 343 (IsValidGaiaSigninRedirectOrResponseURL(url) && |
| 344 url.spec().find("ChromeLoginPrompt") != std::string::npos && |
348 !email.empty()); | 345 !email.empty()); |
349 } | 346 } |
350 | 347 |
351 | 348 |
352 // ConfirmEmailDialogDelegate ------------------------------------------------- | 349 // ConfirmEmailDialogDelegate ------------------------------------------------- |
353 | 350 |
354 class ConfirmEmailDialogDelegate : public TabModalConfirmDialogDelegate { | 351 class ConfirmEmailDialogDelegate : public TabModalConfirmDialogDelegate { |
355 public: | 352 public: |
356 // Callback indicating action performed by the user. The argument to the | 353 // Callback indicating action performed by the user. The argument to the |
357 // callback is the ID of the button pressed by the user. | 354 // callback is the ID of the button pressed by the user. |
(...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1266 contents->GetController().LoadURL(redirect_url_, | 1263 contents->GetController().LoadURL(redirect_url_, |
1267 content::Referrer(), | 1264 content::Referrer(), |
1268 content::PAGE_TRANSITION_AUTO_TOPLEVEL, | 1265 content::PAGE_TRANSITION_AUTO_TOPLEVEL, |
1269 std::string()); | 1266 std::string()); |
1270 } | 1267 } |
1271 | 1268 |
1272 // Clear the redirect URL. | 1269 // Clear the redirect URL. |
1273 redirect_url_ = GURL(); | 1270 redirect_url_ = GURL(); |
1274 sync_service->RemoveObserver(this); | 1271 sync_service->RemoveObserver(this); |
1275 } | 1272 } |
OLD | NEW |