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 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
923 for (net::CertificateList::const_iterator org_cert_it = i->second.begin(); | 928 for (net::CertificateList::const_iterator org_cert_it = i->second.begin(); |
924 org_cert_it != i->second.end(); ++org_cert_it) { | 929 org_cert_it != i->second.end(); ++org_cert_it) { |
925 DictionaryValue* cert_dict = new DictionaryValue; | 930 DictionaryValue* cert_dict = new DictionaryValue; |
926 net::X509Certificate* cert = org_cert_it->get(); | 931 net::X509Certificate* cert = org_cert_it->get(); |
927 cert_dict->SetString(kKeyId, CertToId(*cert)); | 932 cert_dict->SetString(kKeyId, CertToId(*cert)); |
928 cert_dict->SetString(kNameId, certificate_manager_model_->GetColumnText( | 933 cert_dict->SetString(kNameId, certificate_manager_model_->GetColumnText( |
929 *cert, CertificateManagerModel::COL_SUBJECT_NAME)); | 934 *cert, CertificateManagerModel::COL_SUBJECT_NAME)); |
930 cert_dict->SetBoolean( | 935 cert_dict->SetBoolean( |
931 kReadOnlyId, | 936 kReadOnlyId, |
932 certificate_manager_model_->cert_db().IsReadOnly(cert)); | 937 certificate_manager_model_->cert_db().IsReadOnly(cert)); |
| 938 cert_dict->SetBoolean( |
| 939 kUntrustedId, |
| 940 certificate_manager_model_->cert_db().IsUntrusted(cert)); |
933 // TODO(mattm): Other columns. | 941 // TODO(mattm): Other columns. |
934 cert_dict->SetString(kIconId, "none"); | 942 cert_dict->SetString(kIconId, "none"); |
935 subnodes->Append(cert_dict); | 943 subnodes->Append(cert_dict); |
936 } | 944 } |
937 std::sort(subnodes->begin(), subnodes->end(), comparator); | 945 std::sort(subnodes->begin(), subnodes->end(), comparator); |
938 | 946 |
939 dict->Set(kSubNodesId, subnodes); | 947 dict->Set(kSubNodesId, subnodes); |
940 nodes->Append(dict); | 948 nodes->Append(dict); |
941 } | 949 } |
942 std::sort(nodes->begin(), nodes->end(), comparator); | 950 std::sort(nodes->begin(), nodes->end(), comparator); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
997 // TODO(xiyuan): Use async way when underlying supports it. | 1005 // TODO(xiyuan): Use async way when underlying supports it. |
998 base::FundamentalValue ready(cryptohome->Pkcs11IsTpmTokenReady()); | 1006 base::FundamentalValue ready(cryptohome->Pkcs11IsTpmTokenReady()); |
999 web_ui_->CallJavascriptFunction("CertificateManager.onCheckTpmTokenReady", | 1007 web_ui_->CallJavascriptFunction("CertificateManager.onCheckTpmTokenReady", |
1000 ready); | 1008 ready); |
1001 } | 1009 } |
1002 #endif | 1010 #endif |
1003 | 1011 |
1004 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const { | 1012 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const { |
1005 return web_ui_->tab_contents()->view()->GetTopLevelNativeWindow(); | 1013 return web_ui_->tab_contents()->view()->GetTopLevelNativeWindow(); |
1006 } | 1014 } |
OLD | NEW |