expose api only on platforms using nss cert database

This commit is contained in:
deepak1556 2016-04-19 10:47:28 +05:30
parent 2c0494dcef
commit 2d8286515d
4 changed files with 25 additions and 5 deletions

View file

@ -159,13 +159,14 @@ void PassLoginInformation(scoped_refptr<LoginHandler> login_handler,
login_handler->CancelAuth();
}
#if defined(USE_NSS_CERTS)
int ImportIntoCertStore(
CertificateManagerModel* model,
const base::DictionaryValue& options) {
std::string file_data, cert_path;
base::string16 password;
net::CertificateList imported_certs;
int rv;
int rv = -1;
options.GetString("clientCertificate", &cert_path);
options.GetString("password", &password);
@ -189,6 +190,7 @@ int ImportIntoCertStore(
}
return rv;
}
#endif
} // namespace
@ -402,6 +404,7 @@ bool App::MakeSingleInstance(
}
}
#if defined(USE_NSS_CERTS)
void App::ImportClientCertificate(
const base::DictionaryValue& options,
const net::CompletionCallback& callback) {
@ -429,6 +432,7 @@ void App::OnCertificateManagerModelCreated(
*(options.get()));
callback.Run(rv);
}
#endif
mate::ObjectTemplateBuilder App::GetObjectTemplateBuilder(
v8::Isolate* isolate) {
@ -469,7 +473,7 @@ mate::ObjectTemplateBuilder App::GetObjectTemplateBuilder(
.SetMethod("allowNTLMCredentialsForAllDomains",
&App::AllowNTLMCredentialsForAllDomains)
.SetMethod("getLocale", &App::GetLocale)
#if defined(OS_LINUX)
#if defined(USE_NSS_CERTS)
.SetMethod("importClientCertificate", &App::ImportClientCertificate)
#endif
.SetMethod("makeSingleInstance", &App::MakeSingleInstance);

View file

@ -11,12 +11,15 @@
#include "atom/browser/atom_browser_client.h"
#include "atom/browser/browser_observer.h"
#include "atom/common/native_mate_converters/callback.h"
#include "chrome/browser/certificate_manager_model.h"
#include "chrome/browser/process_singleton.h"
#include "content/public/browser/gpu_data_manager_observer.h"
#include "native_mate/handle.h"
#include "net/base/completion_callback.h"
#if defined(USE_NSS_CERTS)
#include "chrome/browser/certificate_manager_model.h"
#endif
namespace base {
class FilePath;
}
@ -43,10 +46,12 @@ class App : public AtomBrowserClient::Delegate,
int render_process_id,
int render_frame_id);
#if defined(USE_NSS_CERTS)
void OnCertificateManagerModelCreated(
scoped_ptr<base::DictionaryValue> options,
const net::CompletionCallback& callback,
scoped_ptr<CertificateManagerModel> model);
#endif
protected:
App();
@ -104,15 +109,21 @@ class App : public AtomBrowserClient::Delegate,
bool MakeSingleInstance(
const ProcessSingleton::NotificationCallback& callback);
std::string GetLocale();
#if defined(USE_NSS_CERTS)
void ImportClientCertificate(const base::DictionaryValue& options,
const net::CompletionCallback& callback);
#endif
#if defined(OS_WIN)
bool IsAeroGlassEnabled();
#endif
scoped_ptr<ProcessSingleton> process_singleton_;
#if defined(USE_NSS_CERTS)
scoped_ptr<CertificateManagerModel> certificate_manager_model_;
#endif
DISALLOW_COPY_AND_ASSIGN(App);
};

View file

@ -310,6 +310,9 @@
],
}], # OS=="mac" and mas_build==1
['OS=="linux"', {
'sources': [
'<@(lib_sources_nss)',
],
'link_settings': {
'ldflags': [
# Make binary search for libraries under current directory, so we

View file

@ -390,8 +390,6 @@
'atom/utility/atom_content_utility_client.h',
'chromium_src/chrome/browser/browser_process.cc',
'chromium_src/chrome/browser/browser_process.h',
'chromium_src/chrome/browser/certificate_manager_model.cc',
'chromium_src/chrome/browser/certificate_manager_model.h',
'chromium_src/chrome/browser/chrome_process_finder_win.cc',
'chromium_src/chrome/browser/chrome_process_finder_win.h',
'chromium_src/chrome/browser/chrome_notification_types.h',
@ -519,6 +517,10 @@
'<@(native_mate_files)',
'<(SHARED_INTERMEDIATE_DIR)/atom_natives.h',
],
'lib_sources_nss': [
'chromium_src/chrome/browser/certificate_manager_model.cc',
'chromium_src/chrome/browser/certificate_manager_model.h',
],
'lib_sources_win': [
'chromium_src/chrome/browser/ui/views/color_chooser_dialog.cc',
'chromium_src/chrome/browser/ui/views/color_chooser_dialog.h',