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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/file_util.h" // for FileAccessProvider | 9 #include "base/file_util.h" // for FileAccessProvider |
10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "chrome/browser/chromeos/cros/cryptohome_library.h" | 29 #include "chrome/browser/chromeos/cros/cryptohome_library.h" |
30 #endif | 30 #endif |
31 | 31 |
32 namespace { | 32 namespace { |
33 | 33 |
34 static const char kKeyId[] = "id"; | 34 static const char kKeyId[] = "id"; |
35 static const char kSubNodesId[] = "subnodes"; | 35 static const char kSubNodesId[] = "subnodes"; |
36 static const char kNameId[] = "name"; | 36 static const char kNameId[] = "name"; |
37 static const char kReadOnlyId[] = "readonly"; | 37 static const char kReadOnlyId[] = "readonly"; |
38 static const char kUntrustedId[] = "untrusted"; | 38 static const char kUntrustedId[] = "untrusted"; |
39 static const char kIconId[] = "icon"; | |
40 static const char kSecurityDeviceId[] = "device"; | 39 static const char kSecurityDeviceId[] = "device"; |
41 static const char kErrorId[] = "error"; | 40 static const char kErrorId[] = "error"; |
42 | 41 |
43 // Enumeration of different callers of SelectFile. (Start counting at 1 so | 42 // Enumeration of different callers of SelectFile. (Start counting at 1 so |
44 // if SelectFile is accidentally called with params=NULL it won't match any.) | 43 // if SelectFile is accidentally called with params=NULL it won't match any.) |
45 enum { | 44 enum { |
46 EXPORT_PERSONAL_FILE_SELECTED = 1, | 45 EXPORT_PERSONAL_FILE_SELECTED = 1, |
47 IMPORT_PERSONAL_FILE_SELECTED, | 46 IMPORT_PERSONAL_FILE_SELECTED, |
48 IMPORT_SERVER_FILE_SELECTED, | 47 IMPORT_SERVER_FILE_SELECTED, |
49 IMPORT_CA_FILE_SELECTED, | 48 IMPORT_CA_FILE_SELECTED, |
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 cert_dict->SetString(kKeyId, CertToId(*cert)); | 963 cert_dict->SetString(kKeyId, CertToId(*cert)); |
965 cert_dict->SetString(kNameId, certificate_manager_model_->GetColumnText( | 964 cert_dict->SetString(kNameId, certificate_manager_model_->GetColumnText( |
966 *cert, CertificateManagerModel::COL_SUBJECT_NAME)); | 965 *cert, CertificateManagerModel::COL_SUBJECT_NAME)); |
967 cert_dict->SetBoolean( | 966 cert_dict->SetBoolean( |
968 kReadOnlyId, | 967 kReadOnlyId, |
969 certificate_manager_model_->cert_db().IsReadOnly(cert)); | 968 certificate_manager_model_->cert_db().IsReadOnly(cert)); |
970 cert_dict->SetBoolean( | 969 cert_dict->SetBoolean( |
971 kUntrustedId, | 970 kUntrustedId, |
972 certificate_manager_model_->cert_db().IsUntrusted(cert)); | 971 certificate_manager_model_->cert_db().IsUntrusted(cert)); |
973 // TODO(mattm): Other columns. | 972 // TODO(mattm): Other columns. |
974 cert_dict->SetString(kIconId, "none"); | |
975 subnodes->Append(cert_dict); | 973 subnodes->Append(cert_dict); |
976 } | 974 } |
977 std::sort(subnodes->begin(), subnodes->end(), comparator); | 975 std::sort(subnodes->begin(), subnodes->end(), comparator); |
978 | 976 |
979 dict->Set(kSubNodesId, subnodes); | 977 dict->Set(kSubNodesId, subnodes); |
980 nodes->Append(dict); | 978 nodes->Append(dict); |
981 } | 979 } |
982 std::sort(nodes->begin(), nodes->end(), comparator); | 980 std::sort(nodes->begin(), nodes->end(), comparator); |
983 | 981 |
984 ListValue args; | 982 ListValue args; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1037 // TODO(xiyuan): Use async way when underlying supports it. | 1035 // TODO(xiyuan): Use async way when underlying supports it. |
1038 base::FundamentalValue ready(cryptohome->Pkcs11IsTpmTokenReady()); | 1036 base::FundamentalValue ready(cryptohome->Pkcs11IsTpmTokenReady()); |
1039 web_ui_->CallJavascriptFunction("CertificateManager.onCheckTpmTokenReady", | 1037 web_ui_->CallJavascriptFunction("CertificateManager.onCheckTpmTokenReady", |
1040 ready); | 1038 ready); |
1041 } | 1039 } |
1042 #endif | 1040 #endif |
1043 | 1041 |
1044 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const { | 1042 gfx::NativeWindow CertificateManagerHandler::GetParentWindow() const { |
1045 return web_ui_->tab_contents()->view()->GetTopLevelNativeWindow(); | 1043 return web_ui_->tab_contents()->view()->GetTopLevelNativeWindow(); |
1046 } | 1044 } |
OLD | NEW |