-
Notifications
You must be signed in to change notification settings - Fork 873
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8125 from brave/ens_support_rebase
Add ENS support
- Loading branch information
Showing
77 changed files
with
1,022 additions
and
773 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
browser/decentralized_dns/decentralized_dns_service_delegate_impl.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* Copyright (c) 2021 The Brave Authors. All rights reserved. | ||
* 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 BRAVE_BROWSER_DECENTRALIZED_DNS_DECENTRALIZED_DNS_SERVICE_DELEGATE_IMPL_H_ | ||
#define BRAVE_BROWSER_DECENTRALIZED_DNS_DECENTRALIZED_DNS_SERVICE_DELEGATE_IMPL_H_ | ||
|
||
#include "brave/components/decentralized_dns/decentralized_dns_service_delegate.h" | ||
|
||
namespace decentralized_dns { | ||
|
||
class DecentralizedDnsServiceDelegateImpl | ||
: public DecentralizedDnsServiceDelegate { | ||
public: | ||
DecentralizedDnsServiceDelegateImpl() = default; | ||
~DecentralizedDnsServiceDelegateImpl() override = default; | ||
|
||
DecentralizedDnsServiceDelegateImpl( | ||
const DecentralizedDnsServiceDelegateImpl&) = delete; | ||
DecentralizedDnsServiceDelegateImpl& operator=( | ||
DecentralizedDnsServiceDelegateImpl&) = delete; | ||
|
||
void UpdateNetworkService() override; | ||
}; | ||
|
||
} // namespace decentralized_dns | ||
|
||
#endif // BRAVE_BROWSER_DECENTRALIZED_DNS_DECENTRALIZED_DNS_SERVICE_DELEGATE_IMPL_H_ |
48 changes: 48 additions & 0 deletions
48
browser/decentralized_dns/decentralized_dns_service_factory.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* Copyright (c) 2021 The Brave Authors. All rights reserved. | ||
* 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 "brave/browser/decentralized_dns/decentralized_dns_service_factory.h" | ||
|
||
#include <memory> | ||
|
||
#include "brave/browser/brave_browser_process_impl.h" | ||
#include "brave/browser/decentralized_dns/decentralized_dns_service_delegate_impl.h" | ||
#include "brave/components/decentralized_dns/decentralized_dns_service.h" | ||
#include "brave/components/decentralized_dns/utils.h" | ||
#include "components/keyed_service/content/browser_context_dependency_manager.h" | ||
|
||
namespace decentralized_dns { | ||
|
||
DecentralizedDnsServiceFactory::DecentralizedDnsServiceFactory() | ||
: BrowserContextKeyedServiceFactory( | ||
"DecentralizedDnsService", | ||
BrowserContextDependencyManager::GetInstance()) {} | ||
|
||
DecentralizedDnsServiceFactory::~DecentralizedDnsServiceFactory() {} | ||
|
||
// static | ||
DecentralizedDnsServiceFactory* DecentralizedDnsServiceFactory::GetInstance() { | ||
return base::Singleton<DecentralizedDnsServiceFactory>::get(); | ||
} | ||
|
||
// static | ||
DecentralizedDnsService* DecentralizedDnsServiceFactory::GetForContext( | ||
content::BrowserContext* context) { | ||
if (!IsDecentralizedDnsEnabled()) | ||
return nullptr; | ||
|
||
return static_cast<DecentralizedDnsService*>( | ||
GetInstance()->GetServiceForBrowserContext(context, true)); | ||
} | ||
|
||
KeyedService* DecentralizedDnsServiceFactory::BuildServiceInstanceFor( | ||
content::BrowserContext* context) const { | ||
return new DecentralizedDnsService( | ||
std::make_unique<DecentralizedDnsServiceDelegateImpl>(), context, | ||
g_brave_browser_process ? g_brave_browser_process->local_state() | ||
: nullptr); | ||
} | ||
|
||
} // namespace decentralized_dns |
41 changes: 41 additions & 0 deletions
41
browser/decentralized_dns/decentralized_dns_service_factory.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* Copyright (c) 2021 The Brave Authors. All rights reserved. | ||
* 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 BRAVE_BROWSER_DECENTRALIZED_DNS_DECENTRALIZED_DNS_SERVICE_FACTORY_H_ | ||
#define BRAVE_BROWSER_DECENTRALIZED_DNS_DECENTRALIZED_DNS_SERVICE_FACTORY_H_ | ||
|
||
#include "base/memory/singleton.h" | ||
#include "components/keyed_service/content/browser_context_keyed_service_factory.h" | ||
|
||
namespace decentralized_dns { | ||
|
||
class DecentralizedDnsService; | ||
|
||
class DecentralizedDnsServiceFactory | ||
: public BrowserContextKeyedServiceFactory { | ||
public: | ||
static DecentralizedDnsService* GetForContext( | ||
content::BrowserContext* context); | ||
static DecentralizedDnsServiceFactory* GetInstance(); | ||
|
||
private: | ||
friend struct base::DefaultSingletonTraits<DecentralizedDnsServiceFactory>; | ||
|
||
DecentralizedDnsServiceFactory(); | ||
~DecentralizedDnsServiceFactory() override; | ||
|
||
DecentralizedDnsServiceFactory(const DecentralizedDnsServiceFactory&) = | ||
delete; | ||
DecentralizedDnsServiceFactory& operator=( | ||
const DecentralizedDnsServiceFactory&) = delete; | ||
|
||
// BrowserContextKeyedServiceFactory overrides: | ||
KeyedService* BuildServiceInstanceFor( | ||
content::BrowserContext* context) const override; | ||
}; | ||
|
||
} // namespace decentralized_dns | ||
|
||
#endif // BRAVE_BROWSER_DECENTRALIZED_DNS_DECENTRALIZED_DNS_SERVICE_FACTORY_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.