| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/gtk/certificate_dialogs.h" | 5 #include "chrome/browser/gtk/certificate_dialogs.h" |
| 6 | 6 |
| 7 #include <cms.h> | 7 #include <cms.h> |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 void WriteFileOnFileThread(const FilePath& path, const std::string& data) { | 50 void WriteFileOnFileThread(const FilePath& path, const std::string& data) { |
| 51 ChromeThread::PostTask( | 51 ChromeThread::PostTask( |
| 52 ChromeThread::FILE, FROM_HERE, new Writer(path, data)); | 52 ChromeThread::FILE, FROM_HERE, new Writer(path, data)); |
| 53 } | 53 } |
| 54 | 54 |
| 55 //////////////////////////////////////////////////////////////////////////////// | 55 //////////////////////////////////////////////////////////////////////////////// |
| 56 // NSS certificate export functions. | 56 // NSS certificate export functions. |
| 57 | 57 |
| 58 class FreeNSSCMSMessage { | 58 typedef scoped_ptr_malloc<NSSCMSMessage, NSS_CMSMessage_Destroy> |
| 59 public: | |
| 60 inline void operator()(NSSCMSMessage* x) const { | |
| 61 NSS_CMSMessage_Destroy(x); | |
| 62 } | |
| 63 }; | |
| 64 typedef scoped_ptr_malloc<NSSCMSMessage, FreeNSSCMSMessage> | |
| 65 ScopedNSSCMSMessage; | 59 ScopedNSSCMSMessage; |
| 66 | 60 |
| 67 class FreeNSSCMSSignedData { | 61 typedef scoped_ptr_malloc<NSSCMSSignedData, NSS_CMSSignedData_Destroy> |
| 68 public: | |
| 69 inline void operator()(NSSCMSSignedData* x) const { | |
| 70 NSS_CMSSignedData_Destroy(x); | |
| 71 } | |
| 72 }; | |
| 73 typedef scoped_ptr_malloc<NSSCMSSignedData, FreeNSSCMSSignedData> | |
| 74 ScopedNSSCMSSignedData; | 62 ScopedNSSCMSSignedData; |
| 75 | 63 |
| 76 std::string GetDerString(CERTCertificate* cert) { | 64 std::string GetDerString(CERTCertificate* cert) { |
| 77 return std::string(reinterpret_cast<const char*>(cert->derCert.data), | 65 return std::string(reinterpret_cast<const char*>(cert->derCert.data), |
| 78 cert->derCert.len); | 66 cert->derCert.len); |
| 79 } | 67 } |
| 80 | 68 |
| 81 std::string WrapAt64(const std::string &str) { | 69 std::string WrapAt64(const std::string &str) { |
| 82 std::string result; | 70 std::string result; |
| 83 for (size_t i = 0; i < str.size(); i += 64) { | 71 for (size_t i = 0; i < str.size(); i += 64) { |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 | 239 |
| 252 void Exporter::FileSelectionCanceled(void* params) { | 240 void Exporter::FileSelectionCanceled(void* params) { |
| 253 delete this; | 241 delete this; |
| 254 } | 242 } |
| 255 | 243 |
| 256 } // namespace | 244 } // namespace |
| 257 | 245 |
| 258 void ShowCertExportDialog(gfx::NativeWindow parent, CERTCertificate* cert) { | 246 void ShowCertExportDialog(gfx::NativeWindow parent, CERTCertificate* cert) { |
| 259 new Exporter(parent, cert); | 247 new Exporter(parent, cert); |
| 260 } | 248 } |
| OLD | NEW |