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

Side by Side Diff: components/password_manager/sync/browser/password_sync_util.cc

Issue 2233833002: Accept empty username as sync username in IsSyncAccountCredential (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 | components/password_manager/sync/browser/password_sync_util_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/password_manager/sync/browser/password_sync_util.h" 5 #include "components/password_manager/sync/browser/password_sync_util.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "components/autofill/core/common/password_form.h" 8 #include "components/autofill/core/common/password_form.h"
9 #include "google_apis/gaia/gaia_auth_util.h" 9 #include "google_apis/gaia/gaia_auth_util.h"
10 #include "google_apis/gaia/gaia_urls.h" 10 #include "google_apis/gaia/gaia_urls.h"
(...skipping 21 matching lines...) Expand all
32 } 32 }
33 33
34 bool IsSyncAccountCredential(const autofill::PasswordForm& form, 34 bool IsSyncAccountCredential(const autofill::PasswordForm& form,
35 const sync_driver::SyncService* sync_service, 35 const sync_driver::SyncService* sync_service,
36 const SigninManagerBase* signin_manager) { 36 const SigninManagerBase* signin_manager) {
37 const Origin gaia_origin(GaiaUrls::GetInstance()->gaia_url().GetOrigin()); 37 const Origin gaia_origin(GaiaUrls::GetInstance()->gaia_url().GetOrigin());
38 if (!Origin(GURL(form.signon_realm)).IsSameOriginWith(gaia_origin)) { 38 if (!Origin(GURL(form.signon_realm)).IsSameOriginWith(gaia_origin)) {
39 return false; 39 return false;
40 } 40 }
41 41
42 // The empty username can mean that Chrome did not detect it correctly. For
43 // reasons described in http://crbug.com/636292#c1, the username is suspected
44 // to be the sync username unless proven otherwise.
45 if (form.username_value.empty())
46 return true;
47
42 return gaia::AreEmailsSame( 48 return gaia::AreEmailsSame(
43 base::UTF16ToUTF8(form.username_value), 49 base::UTF16ToUTF8(form.username_value),
44 GetSyncUsernameIfSyncingPasswords(sync_service, signin_manager)); 50 GetSyncUsernameIfSyncingPasswords(sync_service, signin_manager));
45 } 51 }
46 52
47 } // namespace sync_util 53 } // namespace sync_util
48 } // namespace password_manager 54 } // namespace password_manager
OLDNEW
« no previous file with comments | « no previous file | components/password_manager/sync/browser/password_sync_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698