зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1384753 - Add dummy login reputation service in reputationservice component. r=francois
Login reputation service is initialized during idle startup. --HG-- extra : rebase_source : 4f5b9fb730432c3fdb56f811128499628b76345c
This commit is contained in:
Родитель
34c0f59f0b
Коммит
a814160005
|
@ -1111,6 +1111,12 @@ BrowserGlue.prototype = {
|
|||
// early, so we use a maximum timeout for it.
|
||||
Services.tm.idleDispatchToMainThread(() => {
|
||||
SafeBrowsing.init();
|
||||
|
||||
// Login reputation depends on the Safe Browsing API.
|
||||
if (Services.prefs.getBoolPref("browser.safebrowsing.passwords.enabled")) {
|
||||
Cc["@mozilla.org/reputationservice/login-reputation-service;1"]
|
||||
.getService(Ci.ILoginReputationService);
|
||||
}
|
||||
}, 5000);
|
||||
|
||||
if (AppConstants.MOZ_CRASHREPORTER) {
|
||||
|
|
|
@ -181,6 +181,12 @@
|
|||
#define NS_APPLICATION_REPUTATION_SERVICE_CID \
|
||||
{ 0xd21b4c33, 0x716f, 0x4117, { 0x80, 0x41, 0x27, 0x70, 0xb5, 0x9f, 0xf8, 0xa6 } }
|
||||
|
||||
#define NS_LOGIN_REPUTATION_SERVICE_CONTRACTID \
|
||||
"@mozilla.org/reputationservice/login-reputation-service;1"
|
||||
|
||||
#define NS_LOGIN_REPUTATION_SERVICE_CID \
|
||||
{ 0x91fa9e67, 0x1427, 0x4ee9, { 0x8e, 0xe0, 0x1a, 0x6e, 0xd5, 0x78, 0xbe, 0xe1 } }
|
||||
|
||||
#define NS_ADDONCONTENTPOLICY_CID \
|
||||
{ 0xc26a8241, 0xecf4, 0x4aed, { 0x9f, 0x3c, 0xf1, 0xf5, 0xc7, 0x13, 0xb9, 0xa5 } }
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "nsTypeAheadFind.h"
|
||||
|
||||
#include "ApplicationReputation.h"
|
||||
#include "LoginReputation.h"
|
||||
#include "nsUrlClassifierDBService.h"
|
||||
#include "nsUrlClassifierStreamUpdater.h"
|
||||
#include "nsUrlClassifierUtils.h"
|
||||
|
@ -91,6 +92,8 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsTypeAheadFind)
|
|||
|
||||
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(ApplicationReputationService,
|
||||
ApplicationReputationService::GetSingleton)
|
||||
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(LoginReputationService,
|
||||
LoginReputationService::GetSingleton)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUrlClassifierPrefixSet)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsUrlClassifierStreamUpdater)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsUrlClassifierUtils, Init)
|
||||
|
@ -146,6 +149,7 @@ NS_DEFINE_NAMED_CID(NS_DOWNLOADPLATFORM_CID);
|
|||
NS_DEFINE_NAMED_CID(NS_FIND_SERVICE_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_TYPEAHEADFIND_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_APPLICATION_REPUTATION_SERVICE_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_LOGIN_REPUTATION_SERVICE_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_URLCLASSIFIERPREFIXSET_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_URLCLASSIFIERDBSERVICE_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_URLCLASSIFIERSTREAMUPDATER_CID);
|
||||
|
@ -181,6 +185,7 @@ static const Module::CIDEntry kToolkitCIDs[] = {
|
|||
{ &kNS_FIND_SERVICE_CID, false, nullptr, nsFindServiceConstructor },
|
||||
{ &kNS_TYPEAHEADFIND_CID, false, nullptr, nsTypeAheadFindConstructor },
|
||||
{ &kNS_APPLICATION_REPUTATION_SERVICE_CID, false, nullptr, ApplicationReputationServiceConstructor },
|
||||
{ &kNS_LOGIN_REPUTATION_SERVICE_CID, false, nullptr, LoginReputationServiceConstructor },
|
||||
{ &kNS_URLCLASSIFIERPREFIXSET_CID, false, nullptr, nsUrlClassifierPrefixSetConstructor },
|
||||
{ &kNS_URLCLASSIFIERDBSERVICE_CID, false, nullptr, nsUrlClassifierDBServiceConstructor },
|
||||
{ &kNS_URLCLASSIFIERSTREAMUPDATER_CID, false, nullptr, nsUrlClassifierStreamUpdaterConstructor },
|
||||
|
@ -218,6 +223,7 @@ static const Module::ContractIDEntry kToolkitContracts[] = {
|
|||
{ NS_FIND_SERVICE_CONTRACTID, &kNS_FIND_SERVICE_CID },
|
||||
{ NS_TYPEAHEADFIND_CONTRACTID, &kNS_TYPEAHEADFIND_CID },
|
||||
{ NS_APPLICATION_REPUTATION_SERVICE_CONTRACTID, &kNS_APPLICATION_REPUTATION_SERVICE_CID },
|
||||
{ NS_LOGIN_REPUTATION_SERVICE_CONTRACTID, &kNS_LOGIN_REPUTATION_SERVICE_CID },
|
||||
{ NS_URLCLASSIFIERPREFIXSET_CONTRACTID, &kNS_URLCLASSIFIERPREFIXSET_CID },
|
||||
{ NS_URLCLASSIFIERDBSERVICE_CONTRACTID, &kNS_URLCLASSIFIERDBSERVICE_CID },
|
||||
{ NS_URICLASSIFIERSERVICE_CONTRACTID, &kNS_URLCLASSIFIERDBSERVICE_CID },
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(b527be1e-8fbb-41d9-bee4-267a71236368)]
|
||||
interface ILoginReputationQueryCallback : nsISupports {
|
||||
void onQueryComplete();
|
||||
};
|
||||
|
||||
[scriptable, uuid(1b3f1dfe-ce3a-486b-953e-ce5ac863eff9)]
|
||||
interface ILoginReputationService : nsISupports {
|
||||
// XXX : Add QueryReputation interface
|
||||
};
|
|
@ -0,0 +1,38 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "LoginReputation.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
// MOZ_LOG=LoginReputation:5
|
||||
LazyLogModule LoginReputationService::prlog("LoginReputation");
|
||||
#define LR_LOG(args) MOZ_LOG(LoginReputationService::prlog, mozilla::LogLevel::Debug, args)
|
||||
#define LR_LOG_ENABLED() MOZ_LOG_TEST(LoginReputationService::prlog, mozilla::LogLevel::Debug)
|
||||
|
||||
NS_IMPL_ISUPPORTS(LoginReputationService,
|
||||
ILoginReputationService)
|
||||
|
||||
LoginReputationService*
|
||||
LoginReputationService::gLoginReputationService = nullptr;
|
||||
|
||||
already_AddRefed<LoginReputationService>
|
||||
LoginReputationService::GetSingleton()
|
||||
{
|
||||
if (!gLoginReputationService) {
|
||||
gLoginReputationService = new LoginReputationService();
|
||||
}
|
||||
return do_AddRef(gLoginReputationService);
|
||||
}
|
||||
|
||||
LoginReputationService::LoginReputationService()
|
||||
{
|
||||
LR_LOG(("Login reputation service starting up"));
|
||||
}
|
||||
|
||||
LoginReputationService::~LoginReputationService()
|
||||
{
|
||||
LR_LOG(("Login reputation service shutting down"));
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef LoginReputation_h__
|
||||
#define LoginReputation_h__
|
||||
|
||||
#include "ILoginReputation.h"
|
||||
#include "mozilla/Logging.h"
|
||||
|
||||
class LoginReputationService final : public ILoginReputationService
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_ILOGINREPUTATIONSERVICE
|
||||
|
||||
public:
|
||||
static already_AddRefed<LoginReputationService> GetSingleton();
|
||||
|
||||
private:
|
||||
/**
|
||||
* Global singleton object for holding this factory service.
|
||||
*/
|
||||
static LoginReputationService* gLoginReputationService;
|
||||
|
||||
/**
|
||||
* MOZ_LOG=LoginReputation:5
|
||||
*/
|
||||
static mozilla::LazyLogModule prlog;
|
||||
|
||||
LoginReputationService();
|
||||
~LoginReputationService();
|
||||
};
|
||||
|
||||
#endif // LoginReputation_h__
|
|
@ -10,6 +10,7 @@ with Files('*'):
|
|||
XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini']
|
||||
|
||||
XPIDL_SOURCES += [
|
||||
'ILoginReputation.idl',
|
||||
'nsIApplicationReputation.idl',
|
||||
]
|
||||
|
||||
|
@ -18,6 +19,7 @@ XPIDL_MODULE = 'reputationservice'
|
|||
UNIFIED_SOURCES += [
|
||||
'ApplicationReputation.cpp',
|
||||
'chromium/chrome/common/safe_browsing/csd.pb.cc',
|
||||
'LoginReputation.cpp',
|
||||
]
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
|
Загрузка…
Ссылка в новой задаче