-
Notifications
You must be signed in to change notification settings - Fork 893
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 #5160 from brave/binance-version-2
Binance version 2 trading widget
- Loading branch information
Showing
57 changed files
with
6,827 additions
and
53 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* Copyright (c) 2020 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/binance/binance_service_factory.h" | ||
|
||
#include "brave/components/binance/browser/binance_service.h" | ||
#include "chrome/browser/profiles/incognito_helpers.h" | ||
#include "chrome/browser/profiles/profile.h" | ||
#include "components/keyed_service/content/browser_context_dependency_manager.h" | ||
|
||
// static | ||
BinanceServiceFactory* BinanceServiceFactory::GetInstance() { | ||
return base::Singleton<BinanceServiceFactory>::get(); | ||
} | ||
|
||
// static | ||
BinanceService* BinanceServiceFactory::GetForProfile(Profile* profile) { | ||
return static_cast<BinanceService*>( | ||
GetInstance()->GetServiceForBrowserContext(profile, true)); | ||
} | ||
|
||
BinanceServiceFactory::BinanceServiceFactory() | ||
: BrowserContextKeyedServiceFactory( | ||
"BinanceService", | ||
BrowserContextDependencyManager::GetInstance()) { | ||
} | ||
|
||
BinanceServiceFactory::~BinanceServiceFactory() { | ||
} | ||
|
||
KeyedService* BinanceServiceFactory::BuildServiceInstanceFor( | ||
content::BrowserContext* context) const { | ||
return new BinanceService(Profile::FromBrowserContext(context)); | ||
} | ||
|
||
content::BrowserContext* BinanceServiceFactory::GetBrowserContextToUse( | ||
content::BrowserContext* context) const { | ||
return chrome::GetBrowserContextRedirectedInIncognito(context); | ||
} |
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,35 @@ | ||
/* Copyright (c) 2020 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_BINANCE_BINANCE_SERVICE_FACTORY_H_ | ||
#define BRAVE_BROWSER_BINANCE_BINANCE_SERVICE_FACTORY_H_ | ||
|
||
#include "base/memory/singleton.h" | ||
#include "components/keyed_service/content/browser_context_keyed_service_factory.h" | ||
|
||
class BinanceService; | ||
class Profile; | ||
|
||
class BinanceServiceFactory : public BrowserContextKeyedServiceFactory { | ||
public: | ||
static BinanceService* GetForProfile(Profile* profile); | ||
static BinanceServiceFactory* GetInstance(); | ||
|
||
private: | ||
friend struct base::DefaultSingletonTraits<BinanceServiceFactory>; | ||
|
||
BinanceServiceFactory(); | ||
~BinanceServiceFactory() override; | ||
|
||
// BrowserContextKeyedServiceFactory overrides: | ||
KeyedService* BuildServiceInstanceFor( | ||
content::BrowserContext* context) const override; | ||
content::BrowserContext* GetBrowserContextToUse( | ||
content::BrowserContext* context) const override; | ||
|
||
DISALLOW_COPY_AND_ASSIGN(BinanceServiceFactory); | ||
}; | ||
|
||
#endif // BRAVE_BROWSER_BINANCE_BINANCE_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
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
Oops, something went wrong.