Chromium Code Reviews| 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 kIsUntrusted[] = "untrusted"; | |
|
wtc
2011/06/29 00:30:45
kIsUntrusted => kUntrustedId
to follow the naming
agl
2011/06/29 14:31:11
Done.
| |
| 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("badgeUntrusted", | |
|
mattm
2011/06/29 01:12:07
maybe badgeCertUntrusted (the localized strings n
agl
2011/06/29 14:31:11
Done.
| |
| 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 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 907 for (net::CertificateList::const_iterator org_cert_it = i->second.begin(); | 912 for (net::CertificateList::const_iterator org_cert_it = i->second.begin(); |
| 908 org_cert_it != i->second.end(); ++org_cert_it) { | 913 org_cert_it != i->second.end(); ++org_cert_it) { |
| 909 DictionaryValue* cert_dict = new DictionaryValue; | 914 DictionaryValue* cert_dict = new DictionaryValue; |
| 910 net::X509Certificate* cert = org_cert_it->get(); | 915 net::X509Certificate* cert = org_cert_it->get(); |
| 911 cert_dict->SetString(kKeyId, CertToId(*cert)); | 916 cert_dict->SetString(kKeyId, CertToId(*cert)); |
| 912 cert_dict->SetString(kNameId, certificate_manager_model_->GetColumnText( | 917 cert_dict->SetString(kNameId, certificate_manager_model_->GetColumnText( |
| 913 *cert, CertificateManagerModel::COL_SUBJECT_NAME)); | 918 *cert, CertificateManagerModel::COL_SUBJECT_NAME)); |
| 914 cert_dict->SetBoolean( | 919 cert_dict->SetBoolean( |
| 915 kReadOnlyId, | 920 kReadOnlyId, |
| 916 certificate_manager_model_->cert_db().IsReadOnly(cert)); | 921 certificate_manager_model_->cert_db().IsReadOnly(cert)); |
| 922 cert_dict->SetBoolean( | |
| 923 kIsUntrusted, | |
| 924 certificate_manager_model_->cert_db().IsUntrusted(cert)); | |
| 917 // TODO(mattm): Other columns. | 925 // TODO(mattm): Other columns. |
| 918 cert_dict->SetString(kIconId, "none"); | 926 cert_dict->SetString(kIconId, "none"); |
| 919 subnodes->Append(cert_dict); | 927 subnodes->Append(cert_dict); |
| 920 } | 928 } |
| 921 std::sort(subnodes->begin(), subnodes->end(), comparator); | 929 std::sort(subnodes->begin(), subnodes->end(), comparator); |
| 922 | 930 |
| 923 dict->Set(kSubNodesId, subnodes); | 931 dict->Set(kSubNodesId, subnodes); |
| 924 nodes->Append(dict); | 932 nodes->Append(dict); |
| 925 } | 933 } |
| 926 std::sort(nodes->begin(), nodes->end(), comparator); | 934 std::sort(nodes->begin(), nodes->end(), comparator); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 981 // TODO(xiyuan): Use async way when underlying supports it. | 989 // TODO(xiyuan): Use async way when underlying supports it. |
| 982 FundamentalValue ready(cryptohome->Pkcs11IsTpmTokenReady()); | 990 FundamentalValue ready(cryptohome->Pkcs11IsTpmTokenReady()); |
| 983 web_ui_->CallJavascriptFunction("CertificateManager.onCheckTpmTokenReady", | 991 web_ui_->CallJavascriptFunction("CertificateManager.onCheckTpmTokenReady", |
| 984 ready); | 992 ready); |
| 985 } | 993 } |
| 986 #endif | 994 #endif |
| 987 | 995 |
| 988 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const { | 996 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const { |
| 989 return web_ui_->tab_contents()->view()->GetTopLevelNativeWindow(); | 997 return web_ui_->tab_contents()->view()->GetTopLevelNativeWindow(); |
| 990 } | 998 } |
| OLD | NEW |