OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/webui/options/certificate_manager_handler.h" | 5 #include "chrome/browser/ui/webui/options/certificate_manager_handler.h" |
6 | 6 |
7 #include "base/file_util.h" // for FileAccessProvider | 7 #include "base/file_util.h" // for FileAccessProvider |
8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
9 #include "base/safe_strerror_posix.h" | 9 #include "base/safe_strerror_posix.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "chrome/browser/chromeos/cros/cros_library.h" | 26 #include "chrome/browser/chromeos/cros/cros_library.h" |
27 #include "chrome/browser/chromeos/cros/cryptohome_library.h" | 27 #include "chrome/browser/chromeos/cros/cryptohome_library.h" |
28 #endif | 28 #endif |
29 | 29 |
30 namespace { | 30 namespace { |
31 | 31 |
32 static const char kKeyId[] = "id"; | 32 static const char kKeyId[] = "id"; |
33 static const char kSubNodesId[] = "subnodes"; | 33 static const char kSubNodesId[] = "subnodes"; |
34 static const char kNameId[] = "name"; | 34 static const char kNameId[] = "name"; |
35 static const char kReadOnlyId[] = "readonly"; | 35 static const char kReadOnlyId[] = "readonly"; |
| 36 static const char kUntrustedId[] = "untrusted"; |
36 static const char kIconId[] = "icon"; | 37 static const char kIconId[] = "icon"; |
37 static const char kSecurityDeviceId[] = "device"; | 38 static const char kSecurityDeviceId[] = "device"; |
38 static const char kErrorId[] = "error"; | 39 static const char kErrorId[] = "error"; |
39 | 40 |
40 // Enumeration of different callers of SelectFile. (Start counting at 1 so | 41 // Enumeration of different callers of SelectFile. (Start counting at 1 so |
41 // if SelectFile is accidentally called with params=NULL it won't match any.) | 42 // if SelectFile is accidentally called with params=NULL it won't match any.) |
42 enum { | 43 enum { |
43 EXPORT_PERSONAL_FILE_SELECTED = 1, | 44 EXPORT_PERSONAL_FILE_SELECTED = 1, |
44 IMPORT_PERSONAL_FILE_SELECTED, | 45 IMPORT_PERSONAL_FILE_SELECTED, |
45 IMPORT_SERVER_FILE_SELECTED, | 46 IMPORT_SERVER_FILE_SELECTED, |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 IDS_CERT_MANAGER_IMPORT_CA_DESCRIPTION_FORMAT)); | 341 IDS_CERT_MANAGER_IMPORT_CA_DESCRIPTION_FORMAT)); |
341 localized_strings->SetString("certificateCaTrustSSLLabel", | 342 localized_strings->SetString("certificateCaTrustSSLLabel", |
342 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_EDIT_CA_TRUST_SSL_LABEL)); | 343 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_EDIT_CA_TRUST_SSL_LABEL)); |
343 localized_strings->SetString("certificateCaTrustEmailLabel", | 344 localized_strings->SetString("certificateCaTrustEmailLabel", |
344 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_EDIT_CA_TRUST_EMAIL_LABEL)); | 345 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_EDIT_CA_TRUST_EMAIL_LABEL)); |
345 localized_strings->SetString("certificateCaTrustObjSignLabel", | 346 localized_strings->SetString("certificateCaTrustObjSignLabel", |
346 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_EDIT_CA_TRUST_OBJSIGN_LABEL)); | 347 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_EDIT_CA_TRUST_OBJSIGN_LABEL)); |
347 localized_strings->SetString("certificateImportErrorFormat", | 348 localized_strings->SetString("certificateImportErrorFormat", |
348 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_IMPORT_ERROR_FORMAT)); | 349 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_IMPORT_ERROR_FORMAT)); |
349 | 350 |
| 351 // Badges next to certificates |
| 352 localized_strings->SetString("badgeCertUntrusted", |
| 353 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_UNTRUSTED)); |
| 354 |
350 #if defined(OS_CHROMEOS) | 355 #if defined(OS_CHROMEOS) |
351 localized_strings->SetString("importAndBindCertificate", | 356 localized_strings->SetString("importAndBindCertificate", |
352 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_IMPORT_AND_BIND_BUTTON)); | 357 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_IMPORT_AND_BIND_BUTTON)); |
353 localized_strings->SetString("hardwareBackedKeyFormat", | 358 localized_strings->SetString("hardwareBackedKeyFormat", |
354 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_HARDWARE_BACKED_KEY_FORMAT)); | 359 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_HARDWARE_BACKED_KEY_FORMAT)); |
355 localized_strings->SetString("chromeOSDeviceName", | 360 localized_strings->SetString("chromeOSDeviceName", |
356 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_HARDWARE_BACKED)); | 361 l10n_util::GetStringUTF16(IDS_CERT_MANAGER_HARDWARE_BACKED)); |
357 #endif // defined(OS_CHROMEOS) | 362 #endif // defined(OS_CHROMEOS) |
358 } | 363 } |
359 | 364 |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 for (net::CertificateList::const_iterator org_cert_it = i->second.begin(); | 917 for (net::CertificateList::const_iterator org_cert_it = i->second.begin(); |
913 org_cert_it != i->second.end(); ++org_cert_it) { | 918 org_cert_it != i->second.end(); ++org_cert_it) { |
914 DictionaryValue* cert_dict = new DictionaryValue; | 919 DictionaryValue* cert_dict = new DictionaryValue; |
915 net::X509Certificate* cert = org_cert_it->get(); | 920 net::X509Certificate* cert = org_cert_it->get(); |
916 cert_dict->SetString(kKeyId, CertToId(*cert)); | 921 cert_dict->SetString(kKeyId, CertToId(*cert)); |
917 cert_dict->SetString(kNameId, certificate_manager_model_->GetColumnText( | 922 cert_dict->SetString(kNameId, certificate_manager_model_->GetColumnText( |
918 *cert, CertificateManagerModel::COL_SUBJECT_NAME)); | 923 *cert, CertificateManagerModel::COL_SUBJECT_NAME)); |
919 cert_dict->SetBoolean( | 924 cert_dict->SetBoolean( |
920 kReadOnlyId, | 925 kReadOnlyId, |
921 certificate_manager_model_->cert_db().IsReadOnly(cert)); | 926 certificate_manager_model_->cert_db().IsReadOnly(cert)); |
| 927 cert_dict->SetBoolean( |
| 928 kUntrustedId, |
| 929 certificate_manager_model_->cert_db().IsUntrusted(cert)); |
922 // TODO(mattm): Other columns. | 930 // TODO(mattm): Other columns. |
923 cert_dict->SetString(kIconId, "none"); | 931 cert_dict->SetString(kIconId, "none"); |
924 subnodes->Append(cert_dict); | 932 subnodes->Append(cert_dict); |
925 } | 933 } |
926 std::sort(subnodes->begin(), subnodes->end(), comparator); | 934 std::sort(subnodes->begin(), subnodes->end(), comparator); |
927 | 935 |
928 dict->Set(kSubNodesId, subnodes); | 936 dict->Set(kSubNodesId, subnodes); |
929 nodes->Append(dict); | 937 nodes->Append(dict); |
930 } | 938 } |
931 std::sort(nodes->begin(), nodes->end(), comparator); | 939 std::sort(nodes->begin(), nodes->end(), comparator); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 // TODO(xiyuan): Use async way when underlying supports it. | 994 // TODO(xiyuan): Use async way when underlying supports it. |
987 FundamentalValue ready(cryptohome->Pkcs11IsTpmTokenReady()); | 995 FundamentalValue ready(cryptohome->Pkcs11IsTpmTokenReady()); |
988 web_ui_->CallJavascriptFunction("CertificateManager.onCheckTpmTokenReady", | 996 web_ui_->CallJavascriptFunction("CertificateManager.onCheckTpmTokenReady", |
989 ready); | 997 ready); |
990 } | 998 } |
991 #endif | 999 #endif |
992 | 1000 |
993 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const { | 1001 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const { |
994 return web_ui_->tab_contents()->view()->GetTopLevelNativeWindow(); | 1002 return web_ui_->tab_contents()->view()->GetTopLevelNativeWindow(); |
995 } | 1003 } |
OLD | NEW |