chromium/chrome/browser/ui/certificate_dialogs.cc

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40285824): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "chrome/browser/ui/certificate_dialogs.h"

#include <stddef.h>

#include <algorithm>
#include <memory>
#include <string>
#include <utility>
#include <vector>

#include "base/base64.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/task/thread_pool.h"
#include "chrome/browser/download/download_prefs.h"
#include "chrome/browser/ui/chrome_select_file_policy.h"
#include "chrome/grit/generated_resources.h"
#include "content/public/browser/web_contents.h"
#include "net/base/filename_util.h"
#include "net/cert/x509_util.h"
#include "third_party/boringssl/src/include/openssl/bytestring.h"
#include "third_party/boringssl/src/include/openssl/pkcs7.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/shell_dialogs/select_file_dialog.h"
#include "ui/shell_dialogs/selected_file_info.h"
#include "url/gurl.h"

#if BUILDFLAG(USE_NSS_CERTS)
#include "chrome/common/net/x509_certificate_model_nss.h"
#include "net/cert/x509_util_nss.h"
#endif

namespace {

enum CertFileType {};

void WriterCallback(const base::FilePath& path, const std::string& data) {}

std::string WrapAt64(const std::string& str) {}

std::string GetBase64String(const CRYPTO_BUFFER* cert) {}

////////////////////////////////////////////////////////////////////////////////
// General utility functions.

void ShowCertSelectFileDialogFullExport(
    ui::SelectFileDialog* select_file_dialog,
    const base::FilePath& suggested_path,
    gfx::NativeWindow parent) {}

class Exporter : public ui::SelectFileDialog::Listener {};

Exporter::Exporter(content::WebContents* web_contents,
                   gfx::NativeWindow parent,
                   std::vector<bssl::UniquePtr<CRYPTO_BUFFER>> cert_chain,
                   const std::string& suggested_file_name,
                   bool full_export)
    :{}

Exporter::~Exporter() {}

void Exporter::FileSelected(const ui::SelectedFileInfo& file, int index) {}

void Exporter::FileSelectionCanceled() {}

std::string Exporter::GetCMSString(size_t start, size_t end) const {}

}  // namespace

void ShowCertSelectFileDialog(ui::SelectFileDialog* select_file_dialog,
                              ui::SelectFileDialog::Type type,
                              const base::FilePath& suggested_path,
                              gfx::NativeWindow parent) {}

void ShowCertExportDialog(content::WebContents* web_contents,
                          gfx::NativeWindow parent,
                          std::vector<bssl::UniquePtr<CRYPTO_BUFFER>> certs,
                          const std::string& cert_title) {}

#if BUILDFLAG(USE_NSS_CERTS)
void ShowCertExportDialog(content::WebContents* web_contents,
                          gfx::NativeWindow parent,
                          net::ScopedCERTCertificateList::iterator certs_begin,
                          net::ScopedCERTCertificateList::iterator certs_end) {}
#endif

#if BUILDFLAG(CHROME_ROOT_STORE_CERT_MANAGEMENT_UI)
void ShowCertExportDialogSaveAll(
    content::WebContents* web_contents,
    gfx::NativeWindow parent,
    std::vector<bssl::UniquePtr<CRYPTO_BUFFER>> certs,
    const std::string& suggested_file_name) {}
#endif  // BUILDFLAG(CHROME_ROOT_STORE_CERT_MANAGEMENT_UI)