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