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

Side by Side Diff: chrome/browser/chromeos/platform_keys/platform_keys_nss.cc

Issue 1165323004: We should use UserID object to identify users instead of username. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/chromeos/platform_keys/platform_keys.h" 5 #include "chrome/browser/chromeos/platform_keys/platform_keys.h"
6 6
7 #include <cert.h> 7 #include <cert.h>
8 #include <cryptohi.h> 8 #include <cryptohi.h>
9 #include <keyhi.h> 9 #include <keyhi.h>
10 #include <secder.h> 10 #include <secder.h>
(...skipping 11 matching lines...) Expand all
22 #include "base/threading/worker_pool.h" 22 #include "base/threading/worker_pool.h"
23 #include "chrome/browser/browser_process.h" 23 #include "chrome/browser/browser_process.h"
24 #include "chrome/browser/browser_process_platform_part_chromeos.h" 24 #include "chrome/browser/browser_process_platform_part_chromeos.h"
25 #include "chrome/browser/chromeos/net/client_cert_filter_chromeos.h" 25 #include "chrome/browser/chromeos/net/client_cert_filter_chromeos.h"
26 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 26 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
27 #include "chrome/browser/chromeos/profiles/profile_helper.h" 27 #include "chrome/browser/chromeos/profiles/profile_helper.h"
28 #include "chrome/browser/extensions/api/enterprise_platform_keys/enterprise_plat form_keys_api.h" 28 #include "chrome/browser/extensions/api/enterprise_platform_keys/enterprise_plat form_keys_api.h"
29 #include "chrome/browser/net/nss_context.h" 29 #include "chrome/browser/net/nss_context.h"
30 #include "chrome/browser/profiles/profile.h" 30 #include "chrome/browser/profiles/profile.h"
31 #include "components/policy/core/common/cloud/cloud_policy_constants.h" 31 #include "components/policy/core/common/cloud/cloud_policy_constants.h"
32 #include "components/user_manager/user_id.h"
32 #include "content/public/browser/browser_context.h" 33 #include "content/public/browser/browser_context.h"
33 #include "content/public/browser/browser_thread.h" 34 #include "content/public/browser/browser_thread.h"
34 #include "crypto/nss_key_util.h" 35 #include "crypto/nss_key_util.h"
35 #include "crypto/scoped_nss_types.h" 36 #include "crypto/scoped_nss_types.h"
36 #include "net/base/crypto_module.h" 37 #include "net/base/crypto_module.h"
37 #include "net/base/net_errors.h" 38 #include "net/base/net_errors.h"
38 #include "net/cert/cert_database.h" 39 #include "net/cert/cert_database.h"
39 #include "net/cert/nss_cert_database.h" 40 #include "net/cert/nss_cert_database.h"
40 #include "net/cert/x509_certificate.h" 41 #include "net/cert/x509_certificate.h"
41 #include "net/cert/x509_util_nss.h" 42 #include "net/cert/x509_util_nss.h"
(...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 cert_request_info->cert_authorities = certificate_authorities; 775 cert_request_info->cert_authorities = certificate_authorities;
775 776
776 const user_manager::User* user = 777 const user_manager::User* user =
777 chromeos::ProfileHelper::Get()->GetUserByProfile( 778 chromeos::ProfileHelper::Get()->GetUserByProfile(
778 Profile::FromBrowserContext(browser_context)); 779 Profile::FromBrowserContext(browser_context));
779 780
780 // Use the device-wide system key slot only if the user is of the same 781 // Use the device-wide system key slot only if the user is of the same
781 // domain as the device is registered to. 782 // domain as the device is registered to.
782 policy::BrowserPolicyConnectorChromeOS* connector = 783 policy::BrowserPolicyConnectorChromeOS* connector =
783 g_browser_process->platform_part()->browser_policy_connector_chromeos(); 784 g_browser_process->platform_part()->browser_policy_connector_chromeos();
784 bool use_system_key_slot = connector->GetUserAffiliation(user->email()) == 785 bool use_system_key_slot = connector->GetUserAffiliation(user->GetUserID()) ==
785 policy::USER_AFFILIATION_MANAGED; 786 policy::USER_AFFILIATION_MANAGED;
786 787
787 scoped_ptr<SelectCertificatesState> state(new SelectCertificatesState( 788 scoped_ptr<SelectCertificatesState> state(new SelectCertificatesState(
788 user->username_hash(), use_system_key_slot, cert_request_info, callback)); 789 user->username_hash(), use_system_key_slot, cert_request_info, callback));
789 790
790 BrowserThread::PostTask( 791 BrowserThread::PostTask(
791 BrowserThread::IO, FROM_HERE, 792 BrowserThread::IO, FROM_HERE,
792 base::Bind(&SelectCertificatesOnIOThread, base::Passed(&state))); 793 base::Bind(&SelectCertificatesOnIOThread, base::Passed(&state)));
793 } 794 }
794 795
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 NSSOperationState* state_ptr = state.get(); 894 NSSOperationState* state_ptr = state.get();
894 GetCertDatabase(std::string() /* don't get any specific slot */, 895 GetCertDatabase(std::string() /* don't get any specific slot */,
895 base::Bind(&GetTokensWithDB, base::Passed(&state)), 896 base::Bind(&GetTokensWithDB, base::Passed(&state)),
896 browser_context, 897 browser_context,
897 state_ptr); 898 state_ptr);
898 } 899 }
899 900
900 } // namespace platform_keys 901 } // namespace platform_keys
901 902
902 } // namespace chromeos 903 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698