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

Side by Side Diff: chrome/browser/profiles/profile_io_data.cc

Issue 1232553003: Add new certificateProvider extension API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 3 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 (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/profiles/profile_io_data.h" 5 #include "chrome/browser/profiles/profile_io_data.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" 109 #include "chrome/browser/supervised_user/supervised_user_service_factory.h"
110 #include "chrome/browser/supervised_user/supervised_user_url_filter.h" 110 #include "chrome/browser/supervised_user/supervised_user_url_filter.h"
111 #endif 111 #endif
112 112
113 #if defined(OS_ANDROID) 113 #if defined(OS_ANDROID)
114 #include "content/public/browser/android/content_protocol_handler.h" 114 #include "content/public/browser/android/content_protocol_handler.h"
115 #endif // defined(OS_ANDROID) 115 #endif // defined(OS_ANDROID)
116 116
117 #if defined(OS_CHROMEOS) 117 #if defined(OS_CHROMEOS)
118 #include "chrome/browser/chromeos/certificate_provider/certificate_provider.h" 118 #include "chrome/browser/chromeos/certificate_provider/certificate_provider.h"
119 #include "chrome/browser/chromeos/certificate_provider/certificate_provider_serv ice.h"
120 #include "chrome/browser/chromeos/certificate_provider/certificate_provider_serv ice_factory.h"
119 #include "chrome/browser/chromeos/fileapi/external_file_protocol_handler.h" 121 #include "chrome/browser/chromeos/fileapi/external_file_protocol_handler.h"
120 #include "chrome/browser/chromeos/login/startup_utils.h" 122 #include "chrome/browser/chromeos/login/startup_utils.h"
121 #include "chrome/browser/chromeos/net/cert_verify_proc_chromeos.h" 123 #include "chrome/browser/chromeos/net/cert_verify_proc_chromeos.h"
122 #include "chrome/browser/chromeos/net/client_cert_filter_chromeos.h" 124 #include "chrome/browser/chromeos/net/client_cert_filter_chromeos.h"
123 #include "chrome/browser/chromeos/net/client_cert_store_chromeos.h" 125 #include "chrome/browser/chromeos/net/client_cert_store_chromeos.h"
124 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 126 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
125 #include "chrome/browser/chromeos/policy/policy_cert_service.h" 127 #include "chrome/browser/chromeos/policy/policy_cert_service.h"
126 #include "chrome/browser/chromeos/policy/policy_cert_service_factory.h" 128 #include "chrome/browser/chromeos/policy/policy_cert_service_factory.h"
127 #include "chrome/browser/chromeos/policy/policy_cert_verifier.h" 129 #include "chrome/browser/chromeos/policy/policy_cert_verifier.h"
128 #include "chrome/browser/chromeos/profiles/profile_helper.h" 130 #include "chrome/browser/chromeos/profiles/profile_helper.h"
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 // Use the device-wide system key slot only if the user is of the same 447 // Use the device-wide system key slot only if the user is of the same
446 // domain as the device is registered to. 448 // domain as the device is registered to.
447 policy::BrowserPolicyConnectorChromeOS* connector = 449 policy::BrowserPolicyConnectorChromeOS* connector =
448 g_browser_process->platform_part() 450 g_browser_process->platform_part()
449 ->browser_policy_connector_chromeos(); 451 ->browser_policy_connector_chromeos();
450 params->use_system_key_slot = 452 params->use_system_key_slot =
451 connector->GetUserAffiliation(user->email()) == 453 connector->GetUserAffiliation(user->email()) ==
452 policy::USER_AFFILIATION_MANAGED; 454 policy::USER_AFFILIATION_MANAGED;
453 } 455 }
454 } 456 }
457
458 chromeos::CertificateProviderService* cert_provider_service =
459 chromeos::CertificateProviderServiceFactory::GetForBrowserContext(
460 profile);
461 if (cert_provider_service) {
462 params->certificate_provider =
463 cert_provider_service->CreateCertificateProvider();
464 }
455 #endif 465 #endif
456 466
457 params->profile = profile; 467 params->profile = profile;
458 profile_params_.reset(params.release()); 468 profile_params_.reset(params.release());
459 469
460 ChromeNetworkDelegate::InitializePrefsOnUIThread( 470 ChromeNetworkDelegate::InitializePrefsOnUIThread(
461 &enable_referrers_, 471 &enable_referrers_,
462 &enable_do_not_track_, 472 &enable_do_not_track_,
463 &force_google_safesearch_, 473 &force_google_safesearch_,
464 &force_youtube_safety_mode_, 474 &force_youtube_safety_mode_,
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 DCHECK(io_data_->initialized_); 942 DCHECK(io_data_->initialized_);
933 return request_context_; 943 return request_context_;
934 } 944 }
935 945
936 scoped_ptr<net::ClientCertStore> 946 scoped_ptr<net::ClientCertStore>
937 ProfileIOData::ResourceContext::CreateClientCertStore() { 947 ProfileIOData::ResourceContext::CreateClientCertStore() {
938 if (!io_data_->client_cert_store_factory_.is_null()) 948 if (!io_data_->client_cert_store_factory_.is_null())
939 return io_data_->client_cert_store_factory_.Run(); 949 return io_data_->client_cert_store_factory_.Run();
940 #if defined(OS_CHROMEOS) 950 #if defined(OS_CHROMEOS)
941 return scoped_ptr<net::ClientCertStore>(new chromeos::ClientCertStoreChromeOS( 951 return scoped_ptr<net::ClientCertStore>(new chromeos::ClientCertStoreChromeOS(
942 nullptr, // no additional provider 952 io_data_->certificate_provider_->Copy(),
943 make_scoped_ptr(new chromeos::ClientCertFilterChromeOS( 953 make_scoped_ptr(new chromeos::ClientCertFilterChromeOS(
944 io_data_->use_system_key_slot(), io_data_->username_hash())), 954 io_data_->use_system_key_slot(), io_data_->username_hash())),
945 base::Bind(&CreateCryptoModuleBlockingPasswordDelegate, 955 base::Bind(&CreateCryptoModuleBlockingPasswordDelegate,
946 chrome::kCryptoModulePasswordClientAuth))); 956 chrome::kCryptoModulePasswordClientAuth)));
947 #elif defined(USE_NSS_CERTS) 957 #elif defined(USE_NSS_CERTS)
948 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreNSS( 958 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreNSS(
949 base::Bind(&CreateCryptoModuleBlockingPasswordDelegate, 959 base::Bind(&CreateCryptoModuleBlockingPasswordDelegate,
950 chrome::kCryptoModulePasswordClientAuth))); 960 chrome::kCryptoModulePasswordClientAuth)));
951 #elif defined(OS_WIN) 961 #elif defined(OS_WIN)
952 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreWin()); 962 return scoped_ptr<net::ClientCertStore>(new net::ClientCertStoreWin());
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1098 1108
1099 #if defined(ENABLE_SUPERVISED_USERS) 1109 #if defined(ENABLE_SUPERVISED_USERS)
1100 supervised_user_url_filter_ = profile_params_->supervised_user_url_filter; 1110 supervised_user_url_filter_ = profile_params_->supervised_user_url_filter;
1101 #endif 1111 #endif
1102 1112
1103 #if defined(OS_CHROMEOS) 1113 #if defined(OS_CHROMEOS)
1104 username_hash_ = profile_params_->username_hash; 1114 username_hash_ = profile_params_->username_hash;
1105 use_system_key_slot_ = profile_params_->use_system_key_slot; 1115 use_system_key_slot_ = profile_params_->use_system_key_slot;
1106 if (use_system_key_slot_) 1116 if (use_system_key_slot_)
1107 EnableNSSSystemKeySlotForResourceContext(resource_context_.get()); 1117 EnableNSSSystemKeySlotForResourceContext(resource_context_.get());
1118
1119 certificate_provider_ = profile_params_->certificate_provider.Pass();
1108 #endif 1120 #endif
1109 1121
1110 if (g_cert_verifier_for_testing) { 1122 if (g_cert_verifier_for_testing) {
1111 main_request_context_->set_cert_verifier(g_cert_verifier_for_testing); 1123 main_request_context_->set_cert_verifier(g_cert_verifier_for_testing);
1112 } else { 1124 } else {
1113 #if defined(OS_CHROMEOS) 1125 #if defined(OS_CHROMEOS)
1114 crypto::ScopedPK11Slot public_slot = 1126 crypto::ScopedPK11Slot public_slot =
1115 crypto::GetPublicSlotForChromeOSUser(username_hash_); 1127 crypto::GetPublicSlotForChromeOSUser(username_hash_);
1116 // The private slot won't be ready by this point. It shouldn't be necessary 1128 // The private slot won't be ready by this point. It shouldn't be necessary
1117 // for cert trust purposes anyway. 1129 // for cert trust purposes anyway.
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1318 new DevToolsNetworkTransactionFactory( 1330 new DevToolsNetworkTransactionFactory(
1319 network_controller_handle_.GetController(), shared_session), 1331 network_controller_handle_.GetController(), shared_session),
1320 shared_session->net_log(), backend)); 1332 shared_session->net_log(), backend));
1321 } 1333 }
1322 1334
1323 void ProfileIOData::SetCookieSettingsForTesting( 1335 void ProfileIOData::SetCookieSettingsForTesting(
1324 content_settings::CookieSettings* cookie_settings) { 1336 content_settings::CookieSettings* cookie_settings) {
1325 DCHECK(!cookie_settings_.get()); 1337 DCHECK(!cookie_settings_.get());
1326 cookie_settings_ = cookie_settings; 1338 cookie_settings_ = cookie_settings;
1327 } 1339 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698